## org.apache.commons.math.linear
Class FieldLUDecompositionImpl<T extends FieldElement<T>>

    java.lang.Object
      org.apache.commons.math.linear.FieldLUDecompositionImpl<T>

Type Parameters:
  `T` - the type of the field elements

All Implemented Interfaces:
  FieldLUDecomposition<T>

    public class FieldLUDecompositionImpl<T extends FieldElement<T>>

extends Object
implements FieldLUDecomposition<T>

Calculates the LUP-decomposition of a square matrix.

The LUP-decomposition of a matrix A consists of three matrices L, U and P that satisfy: PA = LU, L is lower triangular, and U is upper triangular and P is a permutation matrix. All matrices are m×m.

Since `field elements` do not provide an ordering operator, the permutation matrix is computed here only in order to avoid a zero pivot element, no attempt is done to get the largest pivot element.

Since:
  2.0
Version:
  $Revision: 983921 $ $Date: 2010-08-10 12:46:06 +0200 (mar. 10 août 2010) $

Nested Class Summary
`private static class` `FieldLUDecompositionImpl.Solver<T extends FieldElement<T>>` Specialized solver.

Field Summary
`private FieldMatrix<T>` `cachedL` Cached value of L.
`private FieldMatrix<T>` `cachedP` Cached value of P.
`private FieldMatrix<T>` `cachedU` Cached value of U.
`private boolean` `even` Parity of the permutation associated with the LU decomposition
`private Field<T>` `field` Field to which the elements belong.
`private T[][]` `lu` Entries of LU decomposition.
`private int[]` `pivot` Pivot permutation associated with LU decomposition
`private boolean` `singular` Singularity indicator.

Constructor Summary
`FieldLUDecompositionImpl(FieldMatrix<T> matrix)` Calculates the LU-decomposition of the given matrix.

Method Summary
`T` `getDeterminant()` Return the determinant of the matrix
`FieldMatrix<T>` `getL()` Returns the matrix L of the decomposition.
`FieldMatrix<T>` `getP()` Returns the P rows permutation matrix.
`int[]` `getPivot()` Returns the pivot permutation vector.
`FieldDecompositionSolver<T>` `getSolver()` Get a solver for finding the A × X = B solution in exact linear sense.
`FieldMatrix<T>` `getU()` Returns the matrix U of the decomposition.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### field

    private final Field<T extends FieldElement<T>> field

  Field to which the elements belong.

### lu

    private T extends FieldElement<T>[][] lu

  Entries of LU decomposition.

### pivot

    private int[] pivot

  Pivot permutation associated with LU decomposition

### even

    private boolean even

  Parity of the permutation associated with the LU decomposition

### singular

    private boolean singular

  Singularity indicator.

### cachedL

    private FieldMatrix<T extends FieldElement<T>> cachedL

  Cached value of L.

### cachedU

    private FieldMatrix<T extends FieldElement<T>> cachedU

  Cached value of U.

### cachedP

    private FieldMatrix<T extends FieldElement<T>> cachedP

  Cached value of P.

Constructor Detail

### FieldLUDecompositionImpl

    public FieldLUDecompositionImpl(FieldMatrix<T> matrix)
                             throws NonSquareMatrixException

  Calculates the LU-decomposition of the given matrix.

  Parameters:
    `matrix` - The matrix to decompose.
  Throws:
    `NonSquareMatrixException` - if matrix is not square

Method Detail

### getL

    public FieldMatrix<T> getL()

  Returns the matrix L of the decomposition.

  L is an lower-triangular matrix

  Specified by:
    `getL` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    the L matrix (or null if decomposed matrix is singular)

### getU

    public FieldMatrix<T> getU()

  Returns the matrix U of the decomposition.

  U is an upper-triangular matrix

  Specified by:
    `getU` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    the U matrix (or null if decomposed matrix is singular)

### getP

    public FieldMatrix<T> 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`.

  Specified by:
    `getP` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    the P rows permutation matrix (or null if decomposed matrix is singular)
  See Also:
    `FieldLUDecomposition.getPivot()`

### getPivot

    public int[] getPivot()

  Returns the pivot permutation vector.

  Specified by:
    `getPivot` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    the pivot permutation vector
  See Also:
    `FieldLUDecomposition.getP()`

### getDeterminant

    public T getDeterminant()

  Return the determinant of the matrix

  Specified by:
    `getDeterminant` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    determinant of the matrix

### getSolver

    public FieldDecompositionSolver<T> getSolver()

  Get a solver for finding the A × X = B solution in exact linear sense.

  Specified by:
    `getSolver` in interface `FieldLUDecomposition<T extends FieldElement<T>>`
  Returns:
    a solver

Copyright (c) 2003-2013 Apache Software Foundation