The ConjugateGradient class – …

class nifty.ConjugateGradient(convergence_tolerance=0.0001, convergence_level=3, iteration_limit=None, reset_count=None, preconditioner=None, callback=None)[source]

Bases: keepers.logging.loggable.Loggable, object

Implementation of the Conjugate Gradient scheme.

It is an iterative method for solving a linear system of equations:
Ax = b
Parameters:

convergence_tolerance : float optional

Tolerance specifying the case of convergence. (default: 1E-4)

convergence_level : integer optional

Number of times the tolerance must be undershot before convergence is reached. (default: 3)

iteration_limit : integer optional

Maximum number of iterations performed (default: None).

reset_count : integer optional

Number of iterations after which to restart; i.e., forget previous conjugated directions (default: None).

preconditioner : Operator optional

This operator can be provided which transforms the variables of the system to improve the conditioning (default: None).

callback : callable optional

Function f(energy, iteration_number) supplied by the user to perform in-situ analysis at every iteration step. When being called the current energy and iteration_number are passed. (default: None)

References

Thomas V. Mikosch et al., “Numerical Optimization”, Second Edition, 2006, Springer-Verlag New York

Attributes

convergence_tolerance (float) Tolerance specifying the case of convergence.
convergence_level (integer) Number of times the tolerance must be undershot before convergence is reached. (default: 3)
iteration_limit (integer) Maximum number of iterations performed.
reset_count (integer) Number of iterations after which to restart; i.e., forget previous conjugated directions.
preconditioner (function) This operator can be provided which transforms the variables of the system to improve the conditioning (default: None).
callback (callable) Function f(energy, iteration_number) supplied by the user to perform in-situ analysis at every iteration step. When being called the current energy and iteration_number are passed. (default: None)

Methods

__call__(A, b, x0) Runs the conjugate gradient minimization.