Class BackSolver<T extends MatrixMixin<T,?,?,?,?,?,U,?>,U extends VectorMixin<U,?,?,?,?,T,?,?>,V>
java.lang.Object
org.flag4j.linalg.solvers.exact.triangular.BackSolver<T,U,V>
- Type Parameters:
T
- Type of matrix to decompose.U
- Vector type equivalent of matrix.V
- Type of internal storage for the matrix and vector.
- All Implemented Interfaces:
LinearSolver<T,
U>
- Direct Known Subclasses:
ComplexBackSolver
,RealBackSolver
public abstract class BackSolver<T extends MatrixMixin<T,?,?,?,?,?,U,?>,U extends VectorMixin<U,?,?,?,?,T,?,?>,V>
extends Object
implements LinearSolver<T,U>
Base class for solvers which solve a linear system of equations
U*x=b
or U*X=B
where U
is an upper
triangular matrix. This is solved in an exact sense.-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
Flag indicating if determinant should be computed.protected static final double
Threshold for determining if a determinant is to be considered zero when checking if the coefficient matrix is full rank.protected U
For storing vector results.protected T
For storing matrix results.protected V
For temporary storage of matrix columns to help improve cache performance. -
Constructor Summary
ConstructorDescriptionBackSolver
(boolean enforceTriU) Creates a solver for solving linear systems for upper triangular coefficient matrices. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkParams
(T coeff, int constantRows) Ensures passed parameters are valid for the back solver.protected void
checkSingular
(double detAbs, int numRows, int numCols) Checks if the coefficient matrix is singular based on the computed determinant.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.flag4j.linalg.solvers.LinearSolver
solve, solve
-
Field Details
-
X
For storing matrix results. -
x
For storing vector results. -
xCol
For temporary storage of matrix columns to help improve cache performance. -
enforceTriU
protected final boolean enforceTriUFlag indicating if determinant should be computed. -
RANK_CONDITION
protected static final double RANK_CONDITIONThreshold for determining if a determinant is to be considered zero when checking if the coefficient matrix is full rank.
-
-
Constructor Details
-
BackSolver
public BackSolver(boolean enforceTriU) Creates a solver for solving linear systems for upper triangular coefficient matrices.- Parameters:
enforceTriU
- Flag indicating if an explicit check should be made that the coefficient matrix is upper triangular.
-
-
Method Details
-
checkParams
Ensures passed parameters are valid for the back solver.- Parameters:
coeff
- Coefficient matrix in the linear system.constantRows
- Number of rows in the constant vector or matrix.- Throws:
IllegalArgumentException
- If coeff is not square,coeff.numRows()!=constantRows
, or ifenforceTriU
is true andcoeff
is not upper triangular.
-
checkSingular
protected void checkSingular(double detAbs, int numRows, int numCols) Checks if the coefficient matrix is singular based on the computed determinant.- Parameters:
detAbs
- Absolute value of computed determinant.numRows
- Number of rows in the coefficient matrix.numCols
- Number of columns in the coefficient matrix.
-