org.apache.ignite.ml.math.primitives.matrix

## Class LUDecomposition

- java.lang.Object
- - org.apache.ignite.ml.math.primitives.matrix.LUDecomposition

- All Implemented Interfaces:
    AutoCloseable

      public class LUDecomposition
      extends Object
      implements AutoCloseable

  Calculates the LU-decomposition of a square matrix.

  This class is inspired by class from Apache Common Math with similar name.

  See Also:
    MathWorld, Wikipedia

    TODO: IGNITE-11192, remove after resolve this issue.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LUDecomposition(Matrix matrix)` Calculates the LU-decomposition of the given matrix.
    `LUDecomposition(Matrix matrix, double singularityThreshold)` Calculates the LUP-decomposition of the given matrix.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Destroys decomposition components and other internal components of decomposition.
    `double` | `determinant()` Return the determinant of the matrix.
    `Matrix` | `getL()` Returns the matrix L of the decomposition.
    `Matrix` | `getP()` Returns the P rows permutation matrix.
    `Vector` | `getPivot()` Returns the pivot permutation vector.
    `Matrix` | `getU()` Returns the matrix U of the decomposition.
    `Matrix` | `solve(Matrix b)`
    `Vector` | `solve(Vector b)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LUDecomposition

          public LUDecomposition(Matrix matrix)

      Calculates the LU-decomposition of the given matrix. This constructor uses 1e-11 as default value for the singularity threshold.
      Parameters:
        `matrix` - Matrix to decompose.
      Throws:
        `CardinalityException` - if matrix is not square.

    - #### LUDecomposition

          public LUDecomposition(Matrix matrix,
                                 double singularityThreshold)

      Calculates the LUP-decomposition of the given matrix.
      Parameters:
        `matrix` - Matrix to decompose.
        `singularityThreshold` - threshold (based on partial row norm).
      Throws:
        `CardinalityException` - if matrix is not square.

  - ### Method Detail

    - #### close

          public void close()

      Destroys decomposition components and other internal components of decomposition.
      Specified by:
        `close` in interface `AutoCloseable`

    - #### getL

          public Matrix getL()

      Returns the matrix L of the decomposition.

      L is a lower-triangular matrix

      Returns:
        the L matrix (or null if decomposed matrix is singular).

    - #### getU

          public Matrix getU()

      Returns the matrix U of the decomposition.

      U is an upper-triangular matrix

      Returns:
        the U matrix (or null if decomposed matrix is singular).

    - #### getP

          public Matrix getP()

      Returns the P rows permutation matrix.

      P is a sparse matrix with exactly one element set to 1.0 in each row and each column, all other elements being set to 0.0.

      The positions of the 1 elements are given by the `pivot permutation vector`.

      Returns:
        the P rows permutation matrix (or null if decomposed matrix is singular).
      See Also:
        `getPivot()`

    - #### getPivot

          public Vector getPivot()

      Returns the pivot permutation vector.
      Returns:
        the pivot permutation vector.
      See Also:
        `getP()`

    - #### determinant

          public double determinant()

      Return the determinant of the matrix.
      Returns:
        determinant of the matrix.

    - #### solve

          public Vector solve(Vector b)

      Parameters:
        `b` - Vector to solve using this decomposition.
      Returns:
        Solution vector.

    - #### solve

          public Matrix solve(Matrix b)

      Parameters:
        `b` - Matrix to solve using this decomposition.
      Returns:
        Solution matrix.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022