Class ComplexLU


public class ComplexLU extends LU<CMatrix>

Instances of this class can be used to compute the LU decomposition of a complex dense matrix.

The LU decomposition decomposes a matrix \( A \) into the product of a unit-lower triangular matrix \( L \) and an upper triangular matrix \( U \), such that: \[ A = LU \]

Pivoting Strategies:

Pivoting may be used to improve the stability of the decomposition. Pivoting involves swapping rows and/or columns within the matrix during decomposition.

This class supports three pivoting strategies via the LU.Pivoting enum:

  • LU.Pivoting.NONE: No pivoting is performed. This pivoting strategy is generally not recommended. \[ A = LU \]
  • LU.Pivoting.PARTIAL: Only row pivoting is performed to improve numerical stability. Generally, this is the preferred pivoting strategy. The decomposition then becomes, \[ PA = LU \]
  • where \( P \) is a permutation matrix representing the row swaps.
  • LU.Pivoting.FULL: Both row and column pivoting are performed to enhance numerical robustness. The decomposition then becomes, \[ PAQ = LU \] where \( P \) and \( Q \) are permutation matrices representing the row and column swaps respectively.

    Full pivoting may be useful for highly ill-conditioned matrices but, for practical purposes, partial pivoting is generally sufficient and more performant.

Storage Format:

The computed LU decomposition is stored within a single matrix LU, where:
  • The upper triangular part (including the diagonal) represents the non-zero values of \( U \).
  • The strictly lower triangular part represents the non-zero, non-diagonal values of \( L \). Since \( L \) is unit-lower triangular, the diagonal is not stored as it is known to be all zeros.

Usage:

The decomposition workflow typically follows these steps:
  1. Instantiate an instance of ComplexLU.
  2. Call LU.decompose(MatrixMixin) to perform the factorization.
  3. Retrieve the resulting matrices using getL(), getU(), LU.getP(), and LU.getQ().
See Also:
  • Constructor Details

    • ComplexLU

      public ComplexLU()

      Constructs a LU decomposer for complex dense matrices.

      This decomposition will be performed out-of-place using partial pivoting.

    • ComplexLU

      public ComplexLU(LU.Pivoting pivoting)

      Constructs a LU decomposer for complex dense matrices.

      This decomposition will be performed out-of-place.

      Parameters:
      pivoting - Pivoting to use. If pivoting is 2, full pivoting will be used. If pivoting is 1, partial pivoting will be used. If pivoting is any other value, no pivoting will be used.
    • ComplexLU

      protected ComplexLU(LU.Pivoting pivoting, boolean inPlace)
      Constructs a LU decomposer for complex dense matrices.
      Parameters:
      pivoting - Pivoting to use.
      inPlace - Flag indicating if the decomposition should be done in/out-of-place.
      • If true, then the decomposition will be done in-place.
      • If true, then the decomposition will be done out-of-place.
  • Method Details

    • noPivot

      protected void noPivot()
      Computes the LU decomposition using no pivoting (i.e. rows and columns are not swapped).
      Specified by:
      noPivot in class LU<CMatrix>
    • partialPivot

      protected void partialPivot()
      Computes the LU decomposition using partial pivoting (i.e. row swapping).
      Specified by:
      partialPivot in class LU<CMatrix>
    • fullPivot

      protected void fullPivot()
      Computes the LU decomposition using full/rook pivoting (i.e. row and column swapping).
      Specified by:
      fullPivot in class LU<CMatrix>
    • getL

      public CMatrix getL()
      Gets the unit lower triangular matrix of the decomposition.
      Specified by:
      getL in class LU<CMatrix>
      Returns:
      The lower triangular matrix of the decomposition.
      Throws:
      IllegalStateException - If this method is called before
      invalid reference
      #decompose(CMatrix)
      .
    • getU

      public CMatrix getU()
      Gets the upper triangular matrix of the decomposition.
      Specified by:
      getU in class LU<CMatrix>
      Returns:
      The lower triangular matrix of the decomposition.
      Throws:
      IllegalStateException - If this method is called before
      invalid reference
      #decompose(CMatrix)
      .