Interface LUDecomposition<T extends Matrix>

All Superinterfaces:
DecompositionInterface<T>
All Known Subinterfaces:
LUDecomposition_F32<T>, LUDecomposition_F64<T>, LUSparseDecomposition<MatrixType>, LUSparseDecomposition_F32<T>, LUSparseDecomposition_F64<T>
All Known Implementing Classes:
LUDecompositionAlt_CDRM, LUDecompositionAlt_DDRM, LUDecompositionAlt_FDRM, LUDecompositionAlt_ZDRM, LUDecompositionBase_CDRM, LUDecompositionBase_DDRM, LUDecompositionBase_FDRM, LUDecompositionBase_ZDRM, LuUpLooking_DSCC, LuUpLooking_FSCC

public interface LUDecomposition<T extends Matrix>
extends DecompositionInterface<T>
LU Decomposition refactors the original matrix such that:
PT*L*U = A
where P is a pivot matrix, L is a lower triangular matrix, U is an upper triangular matrix and A is the original matrix.

LU Decomposition is useful since once the decomposition has been performed linear equations can be quickly solved and the original matrix A inverted. Different algorithms can be selected to perform the decomposition, all will have the same end result.

To use this class first specify the size of the matrix that will be decomposed by it in the constructor. Only square m by m matrices can be decomposed. Then to decompose a matrix call DecompositionInterface.decompose(T). If it encounters any problems an exception will be thrown. After that all the other functions will be available for solving and inverting matrices.

  • Method Summary

    Modifier and Type Method Description
    T getLower​(T lower)
    Returns the L matrix from the decomposition.
    T getRowPivot​(T pivot)
    For numerical stability there are often row interchanges.
    int[] getRowPivotV​(@Nullable IGrowArray pivot)
    Returns the row pivot vector
    T getUpper​(T upper)
    Returns the U matrix from the decomposition.
    boolean isSingular()
    Returns true if the decomposition detected a singular matrix.

    Methods inherited from interface org.ejml.interfaces.decomposition.DecompositionInterface

    decompose, inputModified
  • Method Details

    • getLower

      T getLower​(@Nullable T lower)

      Returns the L matrix from the decomposition. Should only be called after DecompositionInterface.decompose(org.ejml.data.Matrix) has been called.

      If parameter 'lower' is not null, then that matrix is used to store the L matrix. Otherwise a new matrix is created.

      Parameters:
      lower - Storage for T matrix. If null then a new matrix is returned. Modified.
      Returns:
      The L matrix.
    • getUpper

      T getUpper​(@Nullable T upper)

      Returns the U matrix from the decomposition. Should only be called after DecompositionInterface.decompose(org.ejml.data.Matrix) has been called.

      If parameter 'upper' is not null, then that matrix is used to store the U matrix. Otherwise a new matrix is created.

      Parameters:
      upper - Storage for U matrix. If null then a new matrix is returned. Modified.
      Returns:
      The U matrix.
    • getRowPivot

      T getRowPivot​(@Nullable T pivot)

      For numerical stability there are often row interchanges. This computes a pivot matrix that will undo those changes.

      Parameters:
      pivot - Storage for the pivot matrix. If null then a new matrix is returned. Modified.
      Returns:
      The pivot matrix.
    • getRowPivotV

      int[] getRowPivotV​(@Nullable @Nullable IGrowArray pivot)
      Returns the row pivot vector
      Parameters:
      pivot - (Optional) Storage for pivot vector
      Returns:
      The pivot vector
    • isSingular

      boolean isSingular()
      Returns true if the decomposition detected a singular matrix. This check will not work 100% of the time due to machine precision issues.
      Returns:
      True if the matrix is singular and false if it is not.