Package linalg

Class Solvers

java.lang.Object
linalg.Solvers

public class Solvers extends Object
This class contains methods for solving systems of linear equations.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Vector
    Performs back substitution for an upper triangular matrix R and a vector b.
    static Vector
    Performs forward substitution for a unit lower triangular matrix L and a vector b.
    static Vector
    solve​(Matrix A, Matrix b)
    Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense.
    static Vector
    solve​(Matrix A, Vector b)
    Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense.
    static Vector[]
    solve​(Matrix A, Vector... b)
    Solves multiple real or complex systems of equations with the same coefficient matrix.
    static Vector
    solveQR​(Matrix A, Matrix b)
    Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense.
    static Vector
    solveQR​(Matrix A, Vector b)
    Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • solve

      public static Vector[] solve(Matrix A, Vector... b)
      Solves multiple real or complex systems of equations with the same coefficient matrix. That is, solves for the vector x in Ax=b for many different b vectors.
      Parameters:
      A - - Coefficient matrix for system.
      b - - List of constant vectors. If a row vector is passed, it will be implicitly converted to a column vector.
      Returns:
    • solve

      public static Vector solve(Matrix A, Vector b)
      Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense. Here A is the coefficient matrix and b is a vector of constants. This is done using the LUPQ factorization of A.
      Parameters:
      A - - Coefficient Matrix for system.
      b - - Vector of constants. If a row vector is passed, it will be implicitly converted to a column vector.
      Returns:
      a column vector x that is the result of solving Ax=b.
    • solve

      public static Vector solve(Matrix A, Matrix b)
      Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense. Here A is the coefficient matrix and b is a vector of constants. This is done using the LUPQ factorization of A.
      Parameters:
      A - - Coefficient Matrix for system.
      b - - Vector of constants. If a row vector is passed, it will be implicitly converted to a column vector.
      Returns:
      a column vector x that is the result of solving Ax=b.
    • solveQR

      public static Vector solveQR(Matrix A, Vector b)
      Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense. Here A is the coefficient matrix and b is a vector of constants. This is done using the QR factorization of A.
      Parameters:
      A - - coefficient Matrix for system.
      b - - Vector of constants. If a row vector is passed, it will be implicitly converted to a column vector.
      Returns:
      a column vector x that is the result of solving Ax=b.
    • solveQR

      public static Vector solveQR(Matrix A, Matrix b)
      Solves a real or complex linear System of equations of from Ax=b for the vector x in an exact sense. Here A is the coefficient matrix and b is a vector of constants. This is done using the QR factorization of A.
      Parameters:
      A - - Coefficient Matrix for system.
      b - - Vector of constants. If a row vector is passed, it will be implicitly converted to a column vector.
      Returns:
      a column vector x that is the result of solving Ax=b.
    • backSolve

      public static Vector backSolve(Matrix R, Vector b)
      Performs back substitution for an upper triangular matrix R and a vector b. That is, this method solves the system Rx=b where R is an upper triangular matrix.
      Parameters:
      b - - Vector of constants.
      Returns:
      Returns the result of back substitution on the linear System.
    • forwardSolve

      public static Vector forwardSolve(Matrix L, Vector b)
      Performs forward substitution for a unit lower triangular matrix L and a vector b. That is, this method solves the system Lx=b where L is unit lower triangular.
      Parameters:
      L - - Unit Lower triangular matrix
      b - - Vector of constants
      Returns:
      Returns the result of forward substitution on the linear System.