Class BigMatrix.LU

java.lang.Object
smile.math.matrix.BigMatrix.LU
All Implemented Interfaces:
Serializable
Enclosing class:
BigMatrix

public static class BigMatrix.LU extends Object implements Serializable
The LU decomposition. For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n.

The LU decomposition with pivoting always exists, even if the matrix is singular. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations if it is not singular. The decomposition can also be used to calculate the determinant.

See Also:
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    final int
    If info = 0, the LU decomposition was successful.
    final org.bytedeco.javacpp.IntPointer
    The pivot vector.
    final BigMatrix
    The LU decomposition.
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    LU(BigMatrix lu, org.bytedeco.javacpp.IntPointer ipiv, int info)
    Constructor.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    double
    det()
    Returns the matrix determinant.
    Returns the inverse of matrix.
    boolean
    Returns true if the matrix is singular.
    double[]
    solve(double[] b)
    Solve A * x = b.
    void
    Solve A * X = B.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details Link icon

    • lu Link icon

      public final BigMatrix lu
      The LU decomposition.
    • ipiv Link icon

      public final org.bytedeco.javacpp.IntPointer ipiv
      The pivot vector.
    • info Link icon

      public final int info
      If info = 0, the LU decomposition was successful. If info = i > 0, U(i,i) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.
  • Constructor Details Link icon

    • LU Link icon

      public LU(BigMatrix lu, org.bytedeco.javacpp.IntPointer ipiv, int info)
      Constructor.
      Parameters:
      lu - LU decomposition matrix.
      ipiv - the pivot vector.
      info - info > 0 if the matrix is singular.
  • Method Details Link icon

    • isSingular Link icon

      public boolean isSingular()
      Returns true if the matrix is singular.
      Returns:
      true if the matrix is singular.
    • det Link icon

      public double det()
      Returns the matrix determinant.
      Returns:
      the matrix determinant.
    • inverse Link icon

      public BigMatrix inverse()
      Returns the inverse of matrix. For pseudo inverse, use QRDecomposition.
      Returns:
      the inverse of matrix.
    • solve Link icon

      public double[] solve(double[] b)
      Solve A * x = b.
      Parameters:
      b - the right hand side of linear system.
      Returns:
      the solution vector.
      Throws:
      RuntimeException - when the matrix is singular.
    • solve Link icon

      public void solve(BigMatrix B)
      Solve A * X = B. B will be overwritten with the solution matrix on output.
      Parameters:
      B - the right hand side of linear system. On output, B will be overwritten with the solution matrix.
      Throws:
      RuntimeException - when the matrix is singular.