class AndersonMixer(mixing_fraction=None, regularization_parameter=None)

Class representing a mixer following the Anderson mixing scheme, based on the algorithm described in

Eyert, J. Comp. Phys., 124, 271 (1996)
  • mixing_fraction (float) – The mixing fraction.
    Default: Automatically determined in the first step.
  • regularization_parameter (float) – Regularization parameter for numerical stability.
    Default: 0.01
Returns:The fraction of the output to be mixed in with the next input.
Return type:float
Returns:The stabilization factor to be added to the diagonal of the linear system.
Return type:float

Usage Examples

Set up an Anderson mixer which automatically sets the mixing fraction optimally:

# Iteration control parameters with the default Anderson mixer.

Set up an Anderson mixer with a user defined mixing fraction.

# Iteration control parameters with a custom Anderson mixer.


AndersonMixer implements the Anderson method [Eye96], [And65].

In the Anderson mixing scheme the best guess for the next input is given by

\[h_{n+1}^{\rm in} = \bar{h}^{\rm in}_{n} + \eta \Delta\left(\bar{h}^{\rm in}_n\right),\]

where \(\eta\) is the mixing fraction, \(h_i^\mathrm{in}\) is the input value of the mixing_variable at iteration \(i\), and \(\Delta (h^i) = h^{\rm out}_i - h^{\rm in}_i\) is the residual vector.

\(\bar{h}^{\rm in}_{n}\) is determined using a linear combination of solutions from the previous number_of_history_steps:

\[\bar{h}^{\rm in}_n = h^{\rm in}_{n} +\sum_j^{n_{\rm hist}} \theta^n_j\left(h^{\rm in}_{n-j} - h^{\rm in}_{n}\right)\]

in which the variables \(\theta^i_n\) are determined by minimizing the residual of \(\bar{h}^{\rm in}_n\).


[And65]Donald G. Anderson. Iterative procedures for nonlinear integral equations. J. ACM, 12(4):547–560, October 1965. doi:10.1145/321296.321305.
[Eye96]V. Eyert. A comparative study on methods for convergence acceleration of iterative vector sequences. Journal of Computational Physics, 124(2):271 – 285, 1996. doi:10.1006/jcph.1996.0059.