Class DenseMatrix.LUFactorization

java.lang.Object
org.tribuo.math.la.DenseMatrix.LUFactorization
All Implemented Interfaces:
Matrix.Factorization
Enclosing class:
DenseMatrix

public static final class DenseMatrix.LUFactorization extends Object implements Matrix.Factorization
The output of a successful LU factorization.

Essentially wraps a pair of DenseMatrix, but has additional operations which allow more efficient implementations when the matrices are known to be the result of a LU factorization.

Mutating the wrapped matrices will cause undefined behaviour in the methods of this class.

May be refactored into a record in the future.

  • Method Details

    • lower

      public DenseMatrix lower()
      The lower triangular matrix, with ones on the diagonal.
      Returns:
      The lower triangular matrix.
    • upper

      public DenseMatrix upper()
      The upper triangular matrix.
      Returns:
      The upper triangular matrix.
    • permutationArr

      public int[] permutationArr()
      The row permutations applied to get this factorization.
      Returns:
      The permutations.
    • permutationMatrix

      public Matrix permutationMatrix()
      The row permutations stored as a sparse matrix of ones.
      Returns:
      A sparse matrix version of the permutations.
    • oddSwaps

      public boolean oddSwaps()
      Is there an odd number of row swaps (used to compute the determinant).
      Returns:
      True if there is an odd number of swaps.
    • dim1

      public int dim1()
      Description copied from interface: Matrix.Factorization
      First dimension of the factorized matrix.
      Specified by:
      dim1 in interface Matrix.Factorization
      Returns:
      First dimension size.
    • dim2

      public int dim2()
      Description copied from interface: Matrix.Factorization
      Second dimension of the factorized matrix.
      Specified by:
      dim2 in interface Matrix.Factorization
      Returns:
      Second dimension size.
    • determinant

      public double determinant()
      Compute the matrix determinant of the factorized matrix.
      Specified by:
      determinant in interface Matrix.Factorization
      Returns:
      The matrix determinant.
    • solve

      public DenseVector solve(SGDVector vector)
      Solves a system of linear equations A * b = y, where y is the input vector, A is the matrix which produced this LU factorization, and b is the returned value.
      Specified by:
      solve in interface Matrix.Factorization
      Parameters:
      vector - The input vector y.
      Returns:
      The vector b.
    • solve

      public DenseMatrix solve(Matrix matrix)
      Solves the system A * X = Y, where Y is the input matrix, and A is the matrix which produced this LU factorization.
      Specified by:
      solve in interface Matrix.Factorization
      Parameters:
      matrix - The input matrix Y.
      Returns:
      The matrix X.