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 Ux=b or UX=B where U is an upper triangular matrix. This system is solved in an exact sense.
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    protected 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 Link icon

    Constructors
    Constructor
    Description
    BackSolver(boolean enforceTriU)
    Creates a solver for solving linear systems for upper triangular coefficient matrices.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    protected 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 Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.flag4j.linalg.solvers.LinearMatrixSolver Link icon

    solve, solve
  • Field Details Link icon

    • X Link icon

      protected T extends MatrixMixin<T,?,U,?> X
      For storing matrix results.
    • x Link icon

      protected U extends VectorMixin<U,T,?,?> x
      For storing vector results.
    • xCol Link icon

      protected V xCol
      For temporary storage of matrix columns to help improve cache performance.
    • enforceTriU Link icon

      protected final boolean enforceTriU
      Flag indicating if determinant should be computed.
    • checkSingular Link icon

      protected boolean 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.
  • Constructor Details Link icon

    • BackSolver Link icon

      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 Link icon

    • setCheckSingular Link icon

      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.
      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.
      Returns:
      A reference to this back solver instance.
    • checkParams Link icon

      protected void checkParams(T coeff, Shape constantShape)
      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 if enforceTriU is true and coeff is not upper triangular.
    • checkSingular Link icon

      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.