Package org.tribuo.math.la
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 Summary
Modifier and TypeMethodDescriptiondouble
Compute the matrix determinant of the factorized matrix.int
dim1()
First dimension of the factorized matrix.int
dim2()
Second dimension of the factorized matrix.lower()
The lower triangular matrix, with ones on the diagonal.boolean
oddSwaps()
Is there an odd number of row swaps (used to compute the determinant).int[]
The row permutations applied to get this factorization.The row permutations stored as a sparse matrix of ones.Solves the system A * X = Y, where Y is the input matrix, and A is the matrix which produced this LU factorization.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.upper()
The upper triangular matrix.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.math.la.Matrix.Factorization
inverse
-
Method Details
-
lower
The lower triangular matrix, with ones on the diagonal.- Returns:
- The lower triangular matrix.
-
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
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 interfaceMatrix.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 interfaceMatrix.Factorization
- Returns:
- Second dimension size.
-
determinant
public double determinant()Compute the matrix determinant of the factorized matrix.- Specified by:
determinant
in interfaceMatrix.Factorization
- Returns:
- The matrix determinant.
-
solve
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 interfaceMatrix.Factorization
- Parameters:
vector
- The input vector y.- Returns:
- The vector b.
-
solve
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 interfaceMatrix.Factorization
- Parameters:
matrix
- The input matrix Y.- Returns:
- The matrix X.
-