|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.linearsystem.Solver
public class Solver
Solve a system of linear equations in the form:
Ax = b,
where A has #rows <= #columns.
That is, the system must not be over-determined.
This linear system is solved in two steps.
Ax = 0 the homogeneous system for non trivial solutions.
Ax = b for a particular solution.
A is square and det(A) != 0, we use the LU decomposition.
Otherwise, we find the particular solution x = T %*% b.
The final solution is:
x_particular + {x_null_space_of_A}
hence, the translation of the null space of A by the vector x_particular.
| Nested Class Summary | |
|---|---|
static class |
Solver.NoSolution
RuntimeException thrown when it fails to solve a system of linear equations. |
| Field Summary | |
|---|---|
Matrix |
A
matrix A as in Ax = b |
VectorList |
basis
the basis of A; solution for the homogeneous part, Ax = 0 |
double |
epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0 |
boolean |
isFullRank
true iff A has full rank |
| Constructor Summary | |
|---|---|
Solver(Matrix A)
Construct a Solver instance to solve for different Vector b. |
|
Solver(Matrix A,
double epsilon)
Construct a Solver instance to solve for different Vector b. |
|
| Method Summary | |
|---|---|
VectorList |
homogeneousSoln()
Get the basis of the homogeneous solution for the linear system, Ax = b. |
Vector |
solve(Vector b)
Get a particular solution for the linear system, Ax = b |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final Matrix A
A as in Ax = b
public final boolean isFullRank
true iff A has full rank
public final VectorList basis
A; solution for the homogeneous part, Ax = 0
public final double epsilon
| Constructor Detail |
|---|
public Solver(Matrix A,
double epsilon)
Vector b.
A - a matrixepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0public Solver(Matrix A)
Vector b.
A - a matrix| Method Detail |
|---|
public Vector solve(Vector b)
Ax = b
b - a vector
Solver.NoSolution - if there is no solution to this systempublic VectorList homogeneousSoln()
Ax = b.
That is, the solutions for
Ax = 0
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||