nifty8.minimization.conjugate_gradient module#
- class ConjugateGradient(controller, nreset=20)[source]#
Bases:
Minimizer
Implementation of the Conjugate Gradient scheme.
- It is an iterative method for solving a linear system of equations:
Ax = b
- Parameters:
controller (
nifty8.IterationController
) – Object that decides when to terminate the minimization.nreset (int) – every nreset CG steps the residual will be recomputed accurately by applying the operator instead of updating the old residual
References
Jorge Nocedal & Stephen Wright, “Numerical Optimization”, Second Edition, 2006, Springer-Verlag New York
- __call__(energy, preconditioner=None)[source]#
Runs the conjugate gradient minimization.
- Parameters:
energy (Energy object at the starting point of the iteration.) – Its metric operator must be independent of position, otherwise linear conjugate gradient minimization will fail.
preconditioner (Operator optional) – This operator can be provided which transforms the variables of the system to improve the conditioning. Default: None.
- Returns:
QuadraticEnergy – state at last point of the iteration
int – Can be controller.CONVERGED or controller.ERROR