Class ForwardSolver<T extends MatrixMixin<T,?,?,?,?,?,U,?>,U extends VectorMixin<U,?,?,?,?,T,?,?>,V>
java.lang.Object
org.flag4j.linalg.solvers.exact.triangular.ForwardSolver<T,U,V>
- Type Parameters:
T
- Type of coefficient matrix.U
- Vector type equivalent to the coefficient matrix.V
- Type of the internal storage datastructures in the matrix and vector.
- All Implemented Interfaces:
LinearSolver<T,
U>
- Direct Known Subclasses:
ComplexForwardSolver
,RealForwardSolver
public abstract class ForwardSolver<T extends MatrixMixin<T,?,?,?,?,?,U,?>,U extends VectorMixin<U,?,?,?,?,T,?,?>,V>
extends Object
implements LinearSolver<T,U>
This solver solves linear systems of equations where the coefficient matrix in a lower triangular real dense matrix
and the constant vector is a real dense vector. That is, solves,
L*x=b
or L*X=B
for the vector x
or the
matrix X
respectively where L
is a lower triangular matrix.-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
Flag indicating if an explicit check should be made that the coefficient matrix is lower triangular.protected final boolean
Flag indicating if lower-triangular matrices passed to this solver will be unit lower-triangular (true) or simply lower-triangular (false).protected static final double
Threshold for determining if a determinant is to be considered zero when checking if the coefficient matrix is full rank.(package private) U
Storage for solution in solves which return a vector.(package private) T
Storage for solution in solves which return a 00000000protected V
Temporary storage for columns of the solution matrix. -
Constructor Summary
ModifierConstructorDescriptionprotected
ForwardSolver
(boolean isUnit, boolean enforceLower) Creates a solver for solving a lower-triangular system. -
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
-
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. -
isUnit
protected final boolean isUnitFlag indicating if lower-triangular matrices passed to this solver will be unit lower-triangular (true) or simply lower-triangular (false). -
enforceLower
protected final boolean enforceLowerFlag indicating if an explicit check should be made that the coefficient matrix is lower triangular. If false, the matrix will simply be assumed to be lower triangular. -
X
T extends MatrixMixin<T,?, X?, ?, ?, ?, U, ?> Storage for solution in solves which return a 00000000 -
x
U extends VectorMixin<U,?, x?, ?, ?, T, ?, ?> Storage for solution in solves which return a vector. -
xCol
Temporary storage for columns of the solution matrix. This can be used to improve cache performance when columns need to be traveled.
-
-
Constructor Details
-
ForwardSolver
protected ForwardSolver(boolean isUnit, boolean enforceLower) Creates a solver for solving a lower-triangular system.- Parameters:
isUnit
- Flag indicating if coefficient matrices passed will be unit lower-triangular or simply lower-triangular in general.enforceLower
- Flag indicating if an explicit check should be made that the coefficient matrix is lower 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.
-