2#include "Wavefunction/DiracSpinor.hpp"
51 assert(depth > 0 &&
"AndersonHistory needs a depth of at least one");
71 std::size_t
size()
const {
return m_g.size(); }
75 std::vector<DiracSpinor> m_g{};
76 std::vector<DiracSpinor> m_r{};
77 std::vector<double> m_k{};
79 std::vector<std::vector<double>> m_gram{};
82 void drop_oldest(std::size_t n);
99 assert(depth > 0 &&
"AndersonVectorHistory needs a depth of at least one");
104 void push(
const std::vector<double> &x, std::vector<double> g);
115 std::vector<double>
mix();
118 std::size_t
size()
const {
return m_g.size(); }
122 std::vector<std::vector<double>> m_g{};
123 std::vector<std::vector<double>> m_r{};
125 std::vector<std::vector<double>> m_gram{};
128 void drop_oldest(std::size_t n);
Stores radial Dirac spinor: F_nk = (f, g)
Definition DiracSpinor.hpp:55
Anderson mixing history of a fixed-point iteration x -> G(x) on spinors, as used by the mixed-state s...
Definition Anderson.hpp:48
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 carri...
Definition Anderson.cpp:71
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 ...
Definition Anderson.cpp:105
std::size_t size() const
Number of kept entries.
Definition Anderson.hpp:71
Anderson mixing history of a fixed-point iteration x -> G(x) on a state held as one real vector,...
Definition Anderson.hpp:96
std::size_t size() const
Number of kept entries.
Definition Anderson.hpp:118
std::vector< double > mix()
The Anderson extrapolation over the kept entries, x = sum_k c_k g_k, with the coefficients of anderso...
Definition Anderson.cpp:170
void push(const std::vector< double > &x, std::vector< double > g)
Adds the entry for iterate x with map output g = G(x) (residual g - x); drops the oldest entry if the...
Definition Anderson.cpp:131
Core-polarisation (RPA) corrections to matrix elements of an external field.
Definition MatrixElements.hpp:9
std::vector< double > anderson_coefficients(const std::vector< std::vector< double > > &gram)
Anderson mixing coefficients for a fixed-point iteration x -> G(x).
Definition Anderson.cpp:17