Class RealForwardSolver

java.lang.Object
org.flag4j.linalg.solvers.exact.triangular.ForwardSolver<Matrix,Vector,double[]>
org.flag4j.linalg.solvers.exact.triangular.RealForwardSolver
All Implemented Interfaces:
LinearMatrixSolver<Matrix,Vector>, LinearSolver<Matrix>

public class RealForwardSolver extends ForwardSolver<Matrix,Vector,double[]>
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.
  • Constructor Details

    • RealForwardSolver

      public RealForwardSolver()
      Creates a solver to solve a linear system where the coefficient matrix is lower triangular.
    • RealForwardSolver

      public RealForwardSolver(boolean isUnit)
      Creates a solver to solve a linear system where the coefficient matrix is lower triangular or unit lower triangular.
      Parameters:
      isUnit - Flag which indicates if the coefficient matrix is unit lower triangular or not.
      • If true, the coefficient matrix is expected to be unit lower triangular.
      • If false, the coefficient matrix is expected to be lower triangular but not necessarily unit lower.
    • RealForwardSolver

      public RealForwardSolver(boolean isUnit, boolean enforceLower)
      Creates a solver to solve a linear system where the coefficient matrix is lower triangular or unit lower triangular.
      Parameters:
      isUnit - Flag which indicates if the coefficient matrix is unit lower triangular or not.
      • If true, the coefficient matrix is expected to be unit lower triangular.
      • If false, the coefficient matrix is expected to be lower triangular but not necessarily unit lower.
      enforceLower - Flag indicating if an explicit check should be made that the coefficient matrix is lower triangular.
  • Method Details

    • getDet

      public double getDet()
      Gets the determinant computed during the last solve.
    • solve

      public Vector solve(Matrix L, Vector b)
      Performs forward substitution for a unit lower triangular matrix L and a vector b. That is, solves the linear system L*x=b where L is a lower triangular matrix.
      Parameters:
      L - Lower triangular coefficient matrix. If L is not lower triangular, it will be treated as if it were.
      b - Constant vector.
      Returns:
      The result of solving the linear system L*x=b where L is a lower triangular matrix.
      Throws:
      SingularMatrixException - If
    • solve

      public Matrix solve(Matrix L, Matrix B)
      Performs forward substitution for a unit lower triangular matrix L and a matrix B. That is, solves the linear system L*X=B where L is a lower triangular matrix.
      Parameters:
      L - Lower triangular coefficient matrix. If L is not lower triangular, it will be treated as if it were.
      B - Constant Matrix.
      Returns:
      The result of solving the linear system L*X=B where L is a lower triangular matrix.
      Throws:
      SingularMatrixException - If the matrix lower triangular L is singular (i.e. has a zero on * the principle diagonal).
    • solveIdentity

      public Matrix solveIdentity(Matrix L)
      Performs forward substitution for a unit lower triangular matrix L and the identity matrix. That is, solves the linear system L*X=I where L is a lower triangular matrix and I is the appropriately sized identity matrix.
      Parameters:
      L - Lower triangular coefficient matrix. If L is not lower triangular, it will be treated as if it were.
      Returns:
      The result of solving the linear system L*X=B where L is a lower triangular matrix.
      Throws:
      SingularMatrixException - If the matrix lower triangular L is singular (i.e. has a zero on the principle diagonal).