13template <Config Conf = DefaultConfig>
37template <Config Conf = DefaultConfig>
80 throw std::logic_error(
"AndersonAccel::compute() called before "
81 "AndersonAccel::initialize()");
90 throw std::logic_error(
"AndersonAccel::compute() called before "
91 "AndersonAccel::initialize()");
118 return "AndersonAccel<" + std::string(config_t::get_name()) +
'>';
std::string get_name() const
AndersonAccel(Params params, length_t n)
length_t current_history() const
Get the number of columns currently stored in the buffer.
LimitedMemoryQR< config_t > qr
length_t n() const
Get the problem dimension.
void compute(crvec gₖ, crvec rₖ, rvec xₖ_aa)
Compute the accelerated iterate , given the function value at the current iterate and the correspond...
const Params & get_params() const
Get the parameters.
length_t history() const
Get the maximum number of stored columns.
void initialize(crvec g_0, crvec r_0)
Call this function on the first iteration to initialize the accelerator.
AndersonAccel(Params params)
void resize(length_t n)
Change the problem dimension.
void reset()
Reset the accelerator (but keep the last function value and residual, so calling initialize is not ne...
void scale_R(real_t scal)
Scale the factorization.
void compute(crvec gₖ, vec &&rₖ, rvec xₖ_aa)
Compute the accelerated iterate , given the function value at the current iterate and the correspond...
const LimitedMemoryQR< config_t > & get_QR() const
For testing purposes.
Incremental QR factorization using modified Gram-Schmidt with reorthogonalization.
length_t current_history() const
Get the number of columns currently stored in the buffer.
index_t ring_tail() const
Get the tail index of the circular buffer (points to one past the most recent element).
void resize(length_t n, length_t m)
Re-allocate storage for a problem with a different size.
void reset()
Reset all indices, clearing the Q and R matrices.
void scale_R(real_t scal)
Multiply the matrix R by a scalar.
#define USING_ALPAQA_CONFIG(Conf)
length_t memory
Length of the history to keep (the number of columns in the QR factorization).
typename Conf::real_t real_t
typename Conf::index_t index_t
typename Conf::length_t length_t
typename Conf::crvec crvec
real_t min_div_fac
Minimum divisor when solving close to singular systems, scaled by the maximum eigenvalue of R.
void minimize_update_anderson(LimitedMemoryQR< Conf > &qr, rmat< Conf > G̃, crvec< Conf > rₖ, crvec< Conf > rₗₐₛₜ, crvec< Conf > gₖ, real_t< Conf > min_div_fac, rvec< Conf > γ_LS, rvec< Conf > xₖ_aa)
Solve one step of Anderson acceleration to find a fixed point of a function g(x):
Parameters for the AndersonAccel class.