edu.mines.jtk.la
Class DMatrixLud

java.lang.Object
  extended by edu.mines.jtk.la.DMatrixLud

public class DMatrixLud
extends java.lang.Object

LU decomposition (with pivoting) of a matrix A. For an m-by-n matrix A, with m>=n, the LU decomposition is A(piv,:) = L*U, where L is an m-by-n unit lower triangular matrix, U is an n-by-n upper-triangular matrix, and piv is a permutation vector of length m.

The LU decomposition with pivoting always exists, even for singular matrices A. The primary use of LU decomposition is in the solution of square systems of simultaneous linear equations. These solutions will fila if the matrix A is singular.

This class was adapted from the package Jama, which was developed by Joe Hicklin, Cleve Moler, and Peter Webb of The MathWorks, Inc., and by Ronald Boisvert, Bruce Miller, Roldan Pozo, and Karin Remington of the National Institue of Standards and Technology.

Version:
2006.09.15
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
DMatrixLud(DMatrix a)
          Constructs an LU decomposition for the specified matrix A.
 
Method Summary
 double det()
          Returns the determinant of the matrix A.
 DMatrix getL()
          Gets the m-by-n unit lower triangular matrix factor L.
 int[] getPivot()
          Gets the pivot vector, an array of length m.
 DMatrix getU()
          Gets the n-by-n upper triangular matrix factor U.
 boolean isNonSingular()
          Determines whether the matrix A is non-singular.
 boolean isSingular()
          Determines whether the matrix A is singular.
 DMatrix solve(DMatrix b)
          Returns the solution X of the system A*X = B.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DMatrixLud

public DMatrixLud(DMatrix a)
Constructs an LU decomposition for the specified matrix A.

Parameters:
a - the matrix A.
Method Detail

isNonSingular

public boolean isNonSingular()
Determines whether the matrix A is non-singular.

Returns:
true, if non-singular; false, otherwise.

isSingular

public boolean isSingular()
Determines whether the matrix A is singular.

Returns:
true, if singular; false, otherwise.

getL

public DMatrix getL()
Gets the m-by-n unit lower triangular matrix factor L.

Returns:
the m-by-n factor L.

getU

public DMatrix getU()
Gets the n-by-n upper triangular matrix factor U.

Returns:
the n-by-n matrix factor U.

getPivot

public int[] getPivot()
Gets the pivot vector, an array of length m.

Returns:
the pivot vector.

solve

public DMatrix solve(DMatrix b)
Returns the solution X of the system A*X = B. This solution exists only if the matrix A is non-singular.

Parameters:
b - a matrix of right-hand-side vectors. This matrix must have the same number (m) of rows as the matrix A, but may have any number of columns.
Returns:
the matrix solution X.
Throws:
java.lang.IllegalStateException - if A is singular.

det

public double det()
Returns the determinant of the matrix A.

Returns:
the the determinant.
Throws:
java.lang.IllegalStateException - if A is not square.