public class GaussJordanElimination extends Object
GaussJordanElimination
data type provides methods
to solve a linear system of equations Ax = b,
where A is an nbyn matrix
and b is a length n vector.
If no solution exists, it finds a solution y to
yA = 0, yb ≠ 0, which
which serves as a certificate of infeasibility.
This implementation uses GaussJordan elimination with partial pivoting.
See GaussianElimination
for an implementation that uses
Gaussian elimination (but does not provide the certificate of infeasibility).
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 

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

Modifier and Type  Method and Description 

double[] 
dual()
Returns a solution to the linear system of equations yA = 0,
yb ≠ 0.

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
GaussJordanElimination data type. 
double[] 
primal()
Returns a solution to the linear system of equations Ax = b.

public GaussJordanElimination(double[][] A, double[] b)
A
 the nbyn constraint matrixb
 the length n righthandside vectorpublic double[] primal()
null
if no such solutionpublic double[] dual()
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)
GaussJordanElimination
data type.args
 the commandline arguments