类 GaussianElimination
- java.lang.Object
-
- edu.princeton.cs.algs4.GaussianElimination
-
public class GaussianElimination extends java.lang.Object
TheGaussianElimination
data 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. See GaussianEliminationLite.java 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, see JAMA.For additional documentation, see Section 9.9 Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
-
-
构造器概要
构造器 构造器 说明 GaussianElimination(double[][] A, double[] b)
Solves the linear system of equations Ax = b, where A is an m-by-n matrix and b is a length m vector.
-
方法概要
修饰符和类型 方法 说明 boolean
isFeasible()
Returns true if there exists a solution to the linear system of equations Ax = b.static void
main(java.lang.String[] args)
Unit tests theGaussianElimination
data type.double[]
primal()
Returns a solution to the linear system of equations Ax = b.
-
-
-
构造器详细资料
-
GaussianElimination
public GaussianElimination(double[][] A, double[] b)
Solves the linear system of equations Ax = b, where A is an m-by-n matrix and b is a length m vector.- 参数:
A
- the m-by-n constraint matrixb
- the length m right-hand-side vector- 抛出:
java.lang.IllegalArgumentException
- if the dimensions disagree, i.e., the length ofb
does not equalm
-
-
方法详细资料
-
primal
public double[] primal()
Returns a solution to the linear system of equations Ax = b.- 返回:
- a solution x to the linear system of equations
Ax = b;
null
if no such solution
-
isFeasible
public boolean isFeasible()
Returns true if there exists a solution to the linear system of equations Ax = b.- 返回:
true
if there exists a solution to the linear system of equations Ax = b;false
otherwise
-
main
public static void main(java.lang.String[] args)
Unit tests theGaussianElimination
data type.- 参数:
args
- the command-line arguments
-
-