public class GaussianElimination extends Object
GaussianEliminationdata type provides methods to solve a linear system of equations Ax = b, where A is an m-by-n matrix and b is a length n vector.
This is a bare-bones implementation that uses Gaussian elimination
with partial pivoting.
for a stripped-down version that assumes the matrix A is square
and nonsingular. See
GaussJordanElimination for an alternate
implementation that uses Gauss-Jordan elimination.
For an industrial-strength numerical linear algebra library,
This computes correct results if all arithmetic performed is without floating-point rounding error or arithmetic overflow. In practice, there will be floating-point rounding error; partial pivoting helps prevent accumulated floating-point 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|
Solves the linear system of equations Ax = b, where A is an m-by-n matrix and b is a length m vector.
|Modifier and Type||Method and Description|
Returns true if there exists a solution to the linear system of equations Ax = b.
Unit tests the
Returns a solution to the linear system of equations Ax = b.
public GaussianElimination(double A, double b)
A- the m-by-n constraint matrix
b- the length m right-hand-side vector
IllegalArgumentException- if the dimensions disagree, i.e., the length of
bdoes not equal
public double primal()
nullif no such solution
public boolean isFeasible()
trueif there exists a solution to the linear system of equations Ax = b;
public static void main(String args)
args- the command-line arguments