Solves nonlinear equations in fixed-point form \(x = g(x)\) by
computing the next iterate as a linear combination of previous iterates
whose coefficients minimise the least-squares residual.
where \(r_k = g(x_k) - x_k\) and \(m_k \le m\) is the current
buffer depth.
In PathSim this class is the inner fixed-point solver used by the
simulation engine to resolve algebraic loops (cycles in the block
diagram). Each loop-closing ConnectionBooster owns an Anderson
instance that accelerates convergence of the fixed-point iteration
over the loop. The buffer depth m controls how many previous
iterates are retained; larger values improve convergence on difficult
loops at the cost of a small least-squares solve per iteration.
Parameters:
m (int) – buffer depth (number of stored iterates)
restart (bool) – if True, clear the buffer once it reaches depth m
Extends Anderson by prepending a Newton step when a Jacobian
of \(g\) is available. The Newton step
\[\tilde{x} = x - (J_g - I)^{-1}\,(g(x) - x)\]
provides a quadratically convergent initial correction; the subsequent
Anderson mixing step then stabilises the iteration and damps
oscillations.
In PathSim this solver is used inside every implicit ODE integration
engine (BDF, DIRK, ESDIRK). When a block provides a local Jacobian
(e.g. ODE or LTI blocks), the Newton pre-step yields much
faster convergence of the implicit update equation, reducing the
number of fixed-point iterations per timestep. Without a Jacobian the
solver falls back to pure Anderson acceleration.