SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.matrix.doubles.factorization.gaussianelimination
Class GaussianElimination

java.lang.Object
  extended by com.numericalmethod.suanshu.matrix.doubles.factorization.gaussianelimination.GaussianElimination

public class GaussianElimination
extends java.lang.Object

The Gaussian elimination performs elementary row operations to reduce a matrix to the row echelon form.

The two elementary row operations are: swapping rows, and adding multiples of a row to another row. This is equivalent to multiplying the original matrix with invertible matrices from the left. For a square matrix, this algorithm essentially computes an LU decomposition.

These two identities always hold:

 T %*% A == U
 P %*% A == L %*% U
 

See Also:

Field Summary
 double epsilon
          a precision parameter: when a number |x| ≤ ε, it is considered 0
 
Constructor Summary
GaussianElimination(Matrix A)
          Construct an instance of the Gaussian Elimination algorithm with partial pivoting.
GaussianElimination(Matrix A, boolean usePivoting, double epsilon)
          Construct an instance of the Gaussian Elimination algorithm.
 
Method Summary
 Matrix L()
          Get a copy of the lower triangular matrix L, such that P %*% A == L %*% U
 PermutationMatrix P()
          Get a copy of the permutation matrix, P, such that P %*% A == L %*% U
 Matrix T()
          Get a copy of the transformation matrix, T, such that T %*% A == U
 Matrix U()
          Get a copy of the upper triangular matrix U, such that T %*% A == U P %*% A == L %*% U
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

epsilon

public final double epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0

Constructor Detail

GaussianElimination

public GaussianElimination(Matrix A,
                           boolean usePivoting,
                           double epsilon)
Construct an instance of the Gaussian Elimination algorithm.

Parameters:
A - a matrix
usePivoting - true if partial pivoting is wanted, e.g., for numerical stability. In general, no pivoting means no row interchanges. It can be done only if Gaussian elimination never run into zeros on the diagonal. Since division by zero is a fatal error we usually avoid this pivoting strategy.
epsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0

GaussianElimination

public GaussianElimination(Matrix A)
Construct an instance of the Gaussian Elimination algorithm with partial pivoting.

Parameters:
A - a matrix
Method Detail

T

public Matrix T()
Get a copy of the transformation matrix, T, such that
T %*% A == U

Returns:
a copy of the transformation matrix T

U

public Matrix U()
Get a copy of the upper triangular matrix U, such that
 T %*% A == U
 P %*% A == L %*% U
 

Returns:
a copy of the U matrix

L

public Matrix L()
Get a copy of the lower triangular matrix L, such that
P %*% A == L %*% U

Returns:
a copy of the U matrix

P

public PermutationMatrix P()
Get a copy of the permutation matrix, P, such that
P %*% A == L %*% U

Returns:
a copy of the permutation matrix P

SuanShu, a Java numerical and statistical library

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