|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ru.sscc.matrix.solve.RealDirectSolver
Basic abstract class for all real direct solvers of SLAE. The direct solver provides two abstract methods: matrix factorization and solve. The iterative refinement of the solution and the matrix inversion are implemented in this class.
Constructor Summary | |
RealDirectSolver()
|
Method Summary | |
java.lang.Object |
clone()
Should return a clear clone of the solver without attached matrix. |
DenseMatrix |
constructInverse(DenseMatrix target)
Constructs the inverse matrix with the help of the solve method. |
DenseMatrix |
constructRefinedInverse(RealMatrix matrix,
DenseMatrix target)
Constructs the inverse matrix with the help of the solveAndRefine method. |
void |
ensureFactorized()
Tests the matrix to be already factorized and throws IllegalStateException if not. |
abstract RealDirectSolver |
factorize()
Matrix factorization. |
boolean |
isFactorized()
Returns the matrix factorization tag. |
protected void |
setFactorized(boolean factorized)
Sets the factorization tag. |
abstract void |
solve(RealVector source,
RealVector target)
Solves SLAE using already factorized matrix. |
boolean |
solveAndRefine(RealMatrix matrix,
RealVector source,
RealVector target)
Solves SLAE and refines the solution using the iterative refinement algorithm. |
abstract int |
sourceSize()
Returns a size of right-hand side (rows number). |
abstract int |
targetSize()
Returns a size of solution (columns number). |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public RealDirectSolver()
Method Detail |
public abstract int sourceSize()
public abstract int targetSize()
public final boolean isFactorized()
protected final void setFactorized(boolean factorized)
public final void ensureFactorized()
public java.lang.Object clone()
public abstract RealDirectSolver factorize() throws CalculatingException
CalculatingException
and set the factorization tag
to true if the factorization was completed. For incorrect
matrix this exception should be thrown also but without change of
the factorization tag.public abstract void solve(RealVector source, RealVector target)
source
- a source vector (the right hand side of SLAE)target
- a target vector to write the solutionpublic boolean solveAndRefine(RealMatrix matrix, RealVector source, RealVector target)
RealMatrix.clone()
operation for this purpose before the factorization of the matrix.
The iterative refinement can improve the accuracy of the
result if the matrix-by-vector multiplication is produced with
higher accuracy. For example, when the matrix and the vectors are
presented as the float[] type vectors.matrix
- the initial matrixsource
- a source vector (the right hand side of SLAE)target
- a target vector to write the solutionpublic DenseMatrix constructInverse(DenseMatrix target)
target
- the dense matrix to store the result (null is allowed)public DenseMatrix constructRefinedInverse(RealMatrix matrix, DenseMatrix target)
matrix
- the initial matrixtarget
- the dense matrix to store the result (null is allowed)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |