Orbital library

orbital.math
Class LUDecomposition

java.lang.Object
  extended by orbital.math.LUDecomposition
All Implemented Interfaces:
java.io.Serializable

public final class LUDecomposition
extends java.lang.Object
implements java.io.Serializable

LUDecomposition class, decomposing A into PA = LU. Solves linear equation systems.

Author:
André Platzer
See Also:
decompose(Matrix), NumericalAlgorithms, Serialized Form
Invariants:
!isInvertible() || getP().multiply(A).equals(getL().multiply(getU()))
Stereotype:
Structure, Wrapper
Note:
this class is more or less just a workaround for returning multiple values.

Constructor Summary
protected LUDecomposition(Matrix A, Matrix P, boolean sign)
          Gaussian LU-decomposition implementation.
 
Method Summary
static LUDecomposition decompose(Matrix M)
          Get the Gaussian LU-decomposition of a matrix.
 Arithmetic det()
          The determinant of A.
 Matrix getL()
          lower triangular matrix L with diagonal 1s.
 Matrix getP()
          permutation matrix.
 Matrix getU()
          upper triangular matrix U.
 boolean isInvertible()
          A is regular if and only if U is which depends upon whether there is a 0 on the diagonal.
 boolean isRegular()
          Deprecated. Since Orbital1.1 use isInvertible() instead.
 int linearRank()
          Rank of the matrix.
 Vector solve(Vector b)
          Solve linear equation system Ab.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LUDecomposition

protected LUDecomposition(Matrix A,
                          Matrix P,
                          boolean sign)
Gaussian LU-decomposition implementation. Such that P.A = L.U

Preconditions:
A.isSquare()
Method Detail

decompose

public static LUDecomposition decompose(Matrix M)
Get the Gaussian LU-decomposition of a matrix. Such that PA = LU

Number of multiplications is 1/3*(n3-n)

Preconditions:
M.isSquare()

isInvertible

public boolean isInvertible()
                     throws java.lang.ArithmeticException
A is regular if and only if U is which depends upon whether there is a 0 on the diagonal.

Throws:
java.lang.ArithmeticException
See Also:
Matrix.isInvertible()

isRegular

public boolean isRegular()
                  throws java.lang.ArithmeticException
Deprecated. Since Orbital1.1 use isInvertible() instead.

Throws:
java.lang.ArithmeticException

linearRank

public int linearRank()
Rank of the matrix. i.e. the number of non-zero elements on the diagonal of U.

See Also:
Matrix.linearRank()

det

public Arithmetic det()
The determinant of A.

det A = (-1)p*det U where p = sign P is the number of permutations in P. Since det(P)*det(A) = det(PA) = det(LU) = det(L)*det(U) = det(U).

See Also:
Matrix.det()

getL

public Matrix getL()
lower triangular matrix L with diagonal 1s.

Because of pivotising for numberical stability, this matrix only contains values with an absolute ≤1.


getU

public Matrix getU()
upper triangular matrix U.


getP

public Matrix getP()
permutation matrix.


solve

public Vector solve(Vector b)
Solve linear equation system Ab.

Implementation solves Lz = Pb per forward-substitution, and then solves Rx = z per backward-substitution.

Returns:
x such that Ax = b.

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.