Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.linear
Class LUDecompositionImpl

    java.lang.Object
      org.apache.commons.math.linear.LUDecompositionImpl

All Implemented Interfaces:
  LUDecomposition

    public class LUDecompositionImpl

extends Object
implements LUDecomposition

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.

As shown by the presence of the P matrix, this decomposition is implemented using partial pivoting.

Since:
  2.0
Version:
  $Revision: 990655 $ $Date: 2010-08-29 23:49:40 +0200 (dim. 29 août 2010) $

Nested Class Summary
`private static class` | `LUDecompositionImpl.Solver` Specialized solver.

Field Summary
`private RealMatrix` | `cachedL` Cached value of L.
`private RealMatrix` | `cachedP` Cached value of P.
`private RealMatrix` | `cachedU` Cached value of U.
`private static double` | `DEFAULT_TOO_SMALL` Default bound to determine effective singularity in LU decomposition
`private boolean` | `even` Parity of the permutation associated with the LU decomposition
`private double[][]` | `lu` Entries of LU decomposition.
`private int[]` | `pivot` Pivot permutation associated with LU decomposition
`private boolean` | `singular` Singularity indicator.

Constructor Summary
`LUDecompositionImpl(RealMatrix matrix)` Calculates the LU-decomposition of the given matrix.
`LUDecompositionImpl(RealMatrix matrix, double singularityThreshold)` Calculates the LU-decomposition of the given matrix.

Method Summary
`double` | `getDeterminant()` Return the determinant of the matrix
`RealMatrix` | `getL()` Returns the matrix L of the decomposition.
`RealMatrix` | `getP()` Returns the P rows permutation matrix.
`int[]` | `getPivot()` Returns the pivot permutation vector.
`DecompositionSolver` | `getSolver()` Get a solver for finding the A × X = B solution in exact linear sense.
`RealMatrix` | `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

### DEFAULT_TOO_SMALL

    private static final double DEFAULT_TOO_SMALL

  Default bound to determine effective singularity in LU decomposition

  See Also:
    Constant Field Values

### lu

    private double[][] 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 RealMatrix cachedL

  Cached value of L.

### cachedU

    private RealMatrix cachedU

  Cached value of U.

### cachedP

    private RealMatrix cachedP

  Cached value of P.

Constructor Detail

### LUDecompositionImpl

    public LUDecompositionImpl(RealMatrix matrix)
                        throws InvalidMatrixException

  Calculates the LU-decomposition of the given matrix.

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

### LUDecompositionImpl

    public LUDecompositionImpl(RealMatrix matrix,
                               double singularityThreshold)
                        throws NonSquareMatrixException

  Calculates the LU-decomposition of the given matrix.

  Parameters:
    `matrix` - The matrix to decompose.
    `singularityThreshold` - threshold (based on partial row norm) under which a matrix is considered singular
  Throws:
    `NonSquareMatrixException` - if matrix is not square

Method Detail

### getL

    public RealMatrix getL()

  Returns the matrix L of the decomposition.

  L is an lower-triangular matrix

  Specified by:
    `getL` in interface `LUDecomposition`
  Returns:
    the L matrix (or null if decomposed matrix is singular)

### getU

    public RealMatrix getU()

  Returns the matrix U of the decomposition.

  U is an upper-triangular matrix

  Specified by:
    `getU` in interface `LUDecomposition`
  Returns:
    the U matrix (or null if decomposed matrix is singular)

### getP

    public RealMatrix 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 `LUDecomposition`
  Returns:
    the P rows permutation matrix (or null if decomposed matrix is singular)
  See Also:
    `LUDecomposition.getPivot()`

### getPivot

    public int[] getPivot()

  Returns the pivot permutation vector.

  Specified by:
    `getPivot` in interface `LUDecomposition`
  Returns:
    the pivot permutation vector
  See Also:
    `LUDecomposition.getP()`

### getDeterminant

    public double getDeterminant()

  Return the determinant of the matrix

  Specified by:
    `getDeterminant` in interface `LUDecomposition`
  Returns:
    determinant of the matrix

### getSolver

    public DecompositionSolver getSolver()

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

  Specified by:
    `getSolver` in interface `LUDecomposition`
  Returns:
    a solver

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003-2013 Apache Software Foundation