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

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

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

    Modifier and Type
    Method
    Description
    protected 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.LinearMatrixSolver

    solve, solve
  • Field Details

    • X

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

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

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

      protected final boolean enforceTriU
      Flag indicating if determinant should be computed.
    • RANK_CONDITION

      protected static final double RANK_CONDITION
      Threshold for determining if a determinant is to be considered zero when checking if the coefficient matrix is full rank.
  • Constructor Details

    • BackSolver

      protected 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

      protected void checkParams(T coeff, int constantRows)
      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 if enforceTriU is true and coeff 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.