public class GaussianElimination extends Object
GaussianElimination
data type provides methods
to solve a linear system of equations Ax = b,
where A is an mbyn matrix
and b is a length n vector.
This is a barebones implementation that uses Gaussian elimination
with partial pivoting.
See GaussianEliminationLite.java
for a strippeddown version that assumes the matrix A is square
and nonsingular. See GaussJordanElimination
for an alternate
implementation that uses GaussJordan elimination.
For an industrialstrength numerical linear algebra library,
see JAMA.
This computes correct results if all arithmetic performed is without floatingpoint rounding error or arithmetic overflow. In practice, there will be floatingpoint rounding error; partial pivoting helps prevent accumulated floatingpoint rounding errors from growing out of control (though it does not provide any guarantees).
For additional documentation, see Section 9.9 Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
Constructor and Description 

GaussianElimination(double[][] A,
double[] b)
Solves the linear system of equations Ax = b,
where A is an mbyn matrix and b
is a length m vector.

Modifier and Type  Method and Description 

boolean 
isFeasible()
Returns true if there exists a solution to the linear system of
equations Ax = b.

static void 
main(String[] args)
Unit tests the
GaussianElimination data type. 
double[] 
primal()
Returns a solution to the linear system of equations Ax = b.

public GaussianElimination(double[][] A, double[] b)
A
 the mbyn constraint matrixb
 the length m righthandside vectorIllegalArgumentException
 if the dimensions disagree, i.e.,
the length of b
does not equal m
public double[] primal()
null
if no such solutionpublic boolean isFeasible()
true
if there exists a solution to the linear system
of equations Ax = b; false
otherwisepublic static void main(String[] args)
GaussianElimination
data type.args
 the commandline arguments