<ConjugateGradientSolver />¶
Doxygen:
SofaCaribou::solver::ConjugateGradientSolver
Implementation of a Conjugate Gradient linear solver for selfadjoint (symmetric) positive-definite matrices.
Attribute |
Format |
Default |
Description |
---|---|---|---|
printLog |
bool |
false |
Output informative messages at the initialization and during the simulation. |
verbose |
bool |
false |
Output convergence status at each iterations of the CG. |
maximum_number_of_iterations |
int |
25 |
Maximum number of iterations before diverging. |
residual_tolerance_threshold |
float |
1e-5 |
Convergence criterion: The CG iterations will stop when the residual norm of the residual \(\frac{|r_{k}|}{|r_0|} = \frac{|r_{k} - a_k A p_k|}{|b|}\) at iteration k is lower than this threshold (here \(b\) is the right-hand side vector). |
preconditioning_method |
option |
None |
Preconditioning method used.
|
Quick example¶
XML
<Node>
<StaticODESolver newton_iterations="10" correction_tolerance_threshold="1e-8" residual_tolerance_threshold="1e-8" printLog="1" />
<ConjugateGradientSolver maximum_number_of_iterations="2500" residual_tolerance_threshold="1e-12" preconditioning_method="Diagonal" printLog="0" />
</Node>
Python
node.addObject('StaticODESolver', newton_iterations=10, correction_tolerance_threshold=1e-8, residual_tolerance_threshold=1e-8, printLog=True)
node.addObject('ConjugateGradientSolver', maximum_number_of_iterations=2500, residual_tolerance_threshold=1e-12, preconditioning_method="Diagonal", printLog=False)
Available python bindings¶
- class ConjugateGradientSolver¶
- K()¶
- Returns
Reference to the system matrix
- Return type
- Note
No copy involved.
Get the system matrix A = (mM + bB + kK) as a compressed sparse column major matrix.
- assemble(m, b, k)¶
- Parameters
- Returns
Reference to the system matrix
- Return type
- Note
No copy involved.
Get the system matrix A = (mM + bB + kK) as a compressed sparse column major matrix.