High-precision calculations for one- and two-valence atomic systems
ExternalField::AndersonHistory

ok

Anderson mixing history of a fixed-point iteration x -> G(x) on spinors, as used by the mixed-state solvers.

Holds the map outputs \( g_k = G(x_k) \), the residuals \( r_k = g_k - x_k \) and their Gram matrix, and a scalar carried with each entry (an amplitude linear in the state, mixed with the same coefficients; zero if unused). The Gram matrix is kept incrementally: a new entry costs one inner product per kept entry, not a rebuild of the whole matrix. At most depth entries are kept: the oldest is dropped when the history is full, and (see anderson_coefficients) while the Gram matrix is ill-conditioned.

#include <Anderson.hpp>

Public Member Functions

 AndersonHistory (std::size_t depth)
 
void push (DiracSpinor g, DiracSpinor r, double r2, double k=0.0)
 Adds the entry (g, r), with |r|^2 = r2 (which the caller has from its convergence test) and the carried scalar k; drops the oldest entry if the history is full.
 
void mix (DiracSpinor *x, double *k=nullptr)
 The Anderson extrapolation over the kept entries, x = sum_k c_k g_k and (if k is non-null) k = sum_k c_k k_k, with the coefficients of anderson_coefficients; entries that had to be dropped for conditioning are dropped from the history too.
 
std::size_t size () const
 Number of kept entries.
 

Member Function Documentation

◆ push()

void ExternalField::AndersonHistory::push ( DiracSpinor  g,
DiracSpinor  r,
double  r2,
double  k = 0.0 
)

Adds the entry (g, r), with |r|^2 = r2 (which the caller has from its convergence test) and the carried scalar k; drops the oldest entry if the history is full.

◆ mix()

void ExternalField::AndersonHistory::mix ( DiracSpinor *  x,
double *  k = nullptr 
)

The Anderson extrapolation over the kept entries, x = sum_k c_k g_k and (if k is non-null) k = sum_k c_k k_k, with the coefficients of anderson_coefficients; entries that had to be dropped for conditioning are dropped from the history too.

If no entry is usable (the coefficients could not be solved for), x is the plain step: the latest map output, and the history is cleared.

◆ size()

std::size_t ExternalField::AndersonHistory::size ( ) const
inline

Number of kept entries.


The documentation for this class was generated from the following files: