Contents
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:
LinearMatrixSolver<T,
,U> LinearSolver<T>
- Direct Known Subclasses:
ComplexBackSolver
,RealBackSolver
public abstract class BackSolver<T extends MatrixMixin<T,?,U,?>,U extends VectorMixin<U,T,?,?>,V>
extends Object
implements LinearMatrixSolver<T,U>
Base class for solvers which solve a linear system of equations or
where is an
upper triangular matrix. This system is solved in an exact sense.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag indicating if an explicit check should be made that the matrix is singular (or near singular).protected final boolean
Flag indicating if determinant should be computed.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
ConstructorsConstructorDescriptionBackSolver
(boolean enforceTriU) Creates a solver for solving linear systems for upper triangular coefficient matrices. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkParams
(T coeff, Shape constantShape) 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.protected BackSolver
<T, U, V> setCheckSingular
(boolean checkSingular) Sets a flag indicating if an explicit check should be made that the coefficient matrix is singular.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.LinearMatrixSolver
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. -
checkSingular
protected boolean checkSingularFlag indicating if an explicit check should be made that the matrix is singular (or near singular).- If
true
, an explicit singularity check will be made. - If
false
, no check will be made.
- If
-
-
Constructor Details
-
Method Details
-
setCheckSingular
Sets a flag indicating if an explicit check should be made that the coefficient matrix is singular.- Parameters:
checkSingular
- Flag indicating if an explicit check should be made that the matrix is singular (or near singular).- If
true
, an explicit singularity check will be made. - If
false
, no check will be made.
- If
- Returns:
- A reference to this back solver instance.
-
checkParams
Ensures passed parameters are valid for the back solver.- Parameters:
coeff
- Coefficient matrix in the linear system.constantRows
- Shape of 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.
-