Package org.ojalgo.matrix.task.iterative
Class ConjugateGradientSolver
java.lang.Object
org.ojalgo.matrix.task.iterative.IterativeSolverTask
org.ojalgo.matrix.task.iterative.KrylovSubspaceSolver
org.ojalgo.matrix.task.iterative.ConjugateGradientSolver
- All Implemented Interfaces:
IterativeSolverTask.SparseDelegate
,MatrixTask<Double>
,SolverTask<Double>
public final class ConjugateGradientSolver
extends KrylovSubspaceSolver
implements IterativeSolverTask.SparseDelegate
For solving [A][x]=[b] when [A] is symmetric and positive-definite.
This implementation is (Jacobi) preconditioned – using the diagonal elements to scale the residual.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ojalgo.matrix.task.iterative.IterativeSolverTask
IterativeSolverTask.Configurator, IterativeSolverTask.SparseDelegate
Nested classes/interfaces inherited from interface org.ojalgo.matrix.task.SolverTask
SolverTask.Factory<N extends Comparable<N>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate R064Store
private R064Store
private R064Store
private R064Store
Fields inherited from class org.ojalgo.matrix.task.iterative.IterativeSolverTask
DEFAULT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate R064Store
direction
(Structure1D structure) private R064Store
preconditioned
(Structure1D structure) private R064Store
residual
(Structure1D structure) double
resolve
(List<Equation> equations, PhysicalStore<Double> solution) solve
(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) Exactly how (if at all) a specific implementation makes use ofpreallocated
is not specified by this interface.private R064Store
vector
(Structure1D structure) Methods inherited from class org.ojalgo.matrix.task.iterative.IterativeSolverTask
configurator, debug, getAccuracyContext, getIterationsLimit, isDebugPrinterSet, preallocate, setAccuracyContext, setDebugPrinter, setIterationsLimit, solve, toListOfRows
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ojalgo.matrix.task.iterative.IterativeSolverTask.SparseDelegate
resolve
Methods inherited from interface org.ojalgo.matrix.task.SolverTask
preallocate, solve, toSolutionProvider
-
Field Details
-
myDirection
-
myPreconditioned
-
myResidual
-
myVector
-
-
Constructor Details
-
ConjugateGradientSolver
public ConjugateGradientSolver()
-
-
Method Details
-
resolve
- Specified by:
resolve
in interfaceIterativeSolverTask.SparseDelegate
-
solve
public MatrixStore<Double> solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) throws RecoverableCondition Description copied from interface:SolverTask
Exactly how (if at all) a specific implementation makes use of
preallocated
is not specified by this interface. It must be documented for each implementation.Should produce the same results as calling
SolverTask.solve(Access2D, Access2D)
.Use
SolverTask.preallocate(Structure2D, Structure2D)
to obtain a suitbalepreallocated
.- Specified by:
solve
in interfaceSolverTask<Double>
- Parameters:
rhs
- The Right Hand Side, wont be modfiedpreallocated
- Preallocated memory for the results, possibly some intermediate results. You must assume this is modified, but you cannot assume it will contain the full/ /correct solution.- Returns:
- The solution
- Throws:
RecoverableCondition
-
direction
-
preconditioned
-
residual
-
vector
-