SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.linearsystem
Class LU

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.linearsystem.LU

public class LU
extends java.lang.Object

Use the LU decomposition to solve

Ax = b
where A is square and det(A) != 0.

The dimensions of A and b must match.

That is,

 Ax = b;
 LUx = PAx = Pb
 

We first solve Ly = b by forward substitution then Ux = y by backward substitution.

See Also:
Wikipedia: Solving linear equations

Field Summary
 LowerTriangularMatrix L
          matrix L as in LUx = PAx = Pb
 PermutationMatrix P
          matrix P as in LUx = PAx = Pb
 UpperTriangularMatrix U
          matrix U as in LUx = PAx = Pb
 
Constructor Summary
LU(Matrix A)
          Construct an LU instance to solve for different Vector b's.
 
Method Summary
 Vector solve(Vector b)
          Solve Ax = b
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

L

public final LowerTriangularMatrix L
matrix L as in LUx = PAx = Pb


U

public final UpperTriangularMatrix U
matrix U as in LUx = PAx = Pb


P

public final PermutationMatrix P
matrix P as in LUx = PAx = Pb

Constructor Detail

LU

public LU(Matrix A)
Construct an LU instance to solve for different Vector b's.

Parameters:
A - a matrix A as in Ax = b
Throws:
Solver.NoSolution - if there is no solution to this system
Method Detail

solve

public Vector solve(Vector b)
Solve
Ax = b

Parameters:
b - a vector
Returns:
x such that
Ax = b

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.