Class ConjugateGradientSolver

java.lang.Object
org.ojalgo.matrix.task.iterative.IterativeSolverTask
org.ojalgo.matrix.task.iterative.ConjugateGradientSolver
All Implemented Interfaces:
MatrixTask<Double>, SolverTask<Double>

public final class ConjugateGradientSolver extends IterativeSolverTask
Conjugate Gradient solver for symmetric positive-definite systems [A][x]=[b].

Preconditioning

  • Requires a symmetric positive-definite preconditioner. Typical choices include the identity (no preconditioning), diagonal scaling, or symmetric Gauss–Seidel/SSOR variants. Using a non-symmetric or indefinite preconditioner invalidates the CG assumptions.
  • Diagonal entries that are zero (or deemed unusable) should be treated in a numerically safe way by the chosen preconditioner, commonly defaulting to an identity action on those positions.
When to use
  • Large, sparse systems with symmetric positive-definite A.
  • When only matrix–vector products are available and factorisations are undesirable.
  • As a robust default for SPD problems when faster convergence than simple stationary iterations is needed.
  • Not applicable to nonsymmetric or indefinite systems; use a method designed for general square systems in those cases.
  • Field Details

    • myDirection

      private transient R064Store myDirection
    • myPreconditioned

      private transient R064Store myPreconditioned
    • myResidual

      private transient R064Store myResidual
    • myVector

      private transient R064Store myVector
  • Constructor Details

    • ConjugateGradientSolver

      public ConjugateGradientSolver()
  • Method Details