jwo.utils
Class JWLUDecomp

java.lang.Object
  extended by jwo.utils.JWLUDecomp

public class JWLUDecomp
extends Object

Class for finding the solution of a set of linear algebraic equations via LU decomposition. Adapted from the algorithm documented in Numerical Recipes in C (Press et al, 1988, pp.43-45).

Version:
2.3, 11th April 2006.
Author:
Jo Wood

Constructor Summary
JWLUDecomp(float[][] lhs)
          Creates the LU Decomposed matrix based on LHS of a set of normal equations equations.
JWLUDecomp(float[][] lhs, float[] rhs)
          Solves a set of linear equations provided by a matrix holding the left hand side and a vector holding the right hand side.
 
Method Summary
 float[] getCoeff()
          Reports the solved coefficients.
 void luBackSub(float[] rhs)
          Performs forward and back substitution on an LU decomposed matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JWLUDecomp

public JWLUDecomp(float[][] lhs,
                  float[] rhs)
Solves a set of linear equations provided by a matrix holding the left hand side and a vector holding the right hand side. The number of rows corresponds to the number of equations, the number of columns corresponds to the number of unknowns. It therefore follows that the left hand side of the equation must have at least as many rows as columns. This constructor will convert the expression into a set of normal equations before using LU decomposition to solve the equations.

Parameters:
lhs - Matrix holding LHS of equations to solve.
rhs - Vector holding RHS of equations to solve.

JWLUDecomp

public JWLUDecomp(float[][] lhs)
Creates the LU Decomposed matrix based on LHS of a set of normal equations equations.

Parameters:
lhs - Matrix holding LHS of normal equations to solve.
Method Detail

getCoeff

public float[] getCoeff()
Reports the solved coefficients. The RHS of the equation must have been given through a constructor. Alternatively use luBackSub() to calculate on the fly.

Returns:
Solved coeffients.

luBackSub

public void luBackSub(float[] rhs)
Performs forward and back substitution on an LU decomposed matrix.

Parameters:
rhs - RHS of equations to be solved. The array of supplied values gets replaced with the solved coeffients.


Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009