SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Private Attributes | List of all members
sirius::mixer::Anderson< FUNCS > Class Template Reference

Anderson mixer. More...

#include <anderson_mixer.hpp>

Inherits sirius::mixer::Mixer< FUNCS... >.

Public Member Functions

 Anderson (std::size_t max_history, double beta, double beta0, double beta_scaling_factor)
 
void mix_impl () override
 
- Public Member Functions inherited from sirius::mixer::Mixer< FUNCS... >
 Mixer (std::size_t max_history)
 Construct a mixer. Functions have to initialized individually. More...
 
void initialize_function (const FunctionProperties< typename std::tuple_element< FUNC_INDEX, std::tuple< FUNCS... > >::type > &function_prop, const typename std::tuple_element< FUNC_INDEX, std::tuple< FUNCS... > >::type &init_value, ARGS &&... args)
 
void set_input (const typename std::tuple_element< FUNC_INDEX, std::tuple< FUNCS... > >::type &input)
 Set input for next mixing step. More...
 
void get_output (typename std::tuple_element< FUNC_INDEX, std::tuple< FUNCS... > >::type &output)
 Access last generated output. Mixing must have been performed at least once. More...
 
double mix (double rms_min__)
 Mix input and stored history. Returns the root mean square error computed by inner products of residuals. More...
 

Private Attributes

double beta_
 
double beta0_
 
double beta_scaling_factor_
 
sddk::mdarray< double, 2 > S_
 
sddk::mdarray< double, 2 > S_factorized_
 
std::size_t history_size_
 

Additional Inherited Members

- Static Public Attributes inherited from sirius::mixer::Mixer< FUNCS... >
static constexpr std::size_t number_of_functions
 
- Protected Member Functions inherited from sirius::mixer::Mixer< FUNCS... >
virtual void mix_impl ()=0
 
void update_residual ()
 
void update_rms ()
 
std::size_t idx_hist (std::size_t step) const
 
double inner_product (const std::tuple< std::unique_ptr< FUNCS >... > &x, const std::tuple< std::unique_ptr< FUNCS >... > &y)
 
void scale (double alpha, std::tuple< std::unique_ptr< FUNCS >... > &x)
 
void copy (const std::tuple< std::unique_ptr< FUNCS >... > &x, std::tuple< std::unique_ptr< FUNCS >... > &y)
 
void axpy (double alpha, const std::tuple< std::unique_ptr< FUNCS >... > &x, std::tuple< std::unique_ptr< FUNCS >... > &y)
 
void rotate (double c, double s, std::tuple< std::unique_ptr< FUNCS >... > &x, std::tuple< std::unique_ptr< FUNCS >... > &y)
 
- Protected Attributes inherited from sirius::mixer::Mixer< FUNCS... >
std::size_t step_
 
std::size_t max_history_
 
std::vector< double > rmse_history_
 
std::tuple< FunctionProperties< FUNCS >... > functions_
 
std::tuple< std::unique_ptr< FUNCS >... > input_
 
std::vector< std::tuple< std::unique_ptr< FUNCS >... > > output_history_
 
std::vector< std::tuple< std::unique_ptr< FUNCS >... > > residual_history_
 

Detailed Description

template<typename... FUNCS>
class sirius::mixer::Anderson< FUNCS >

Anderson mixer.

Quasi-Newton limited-memory method which updates \( x_{n+1} = x_n - G_nf_n \) where \( G_n \) is an approximate inverse Jacobian. Anderson is derived by taking the low-rank update to the inverse Jacobian

\[ G_{n+1} = (G_n + \Delta X_n - G_n \Delta F_n)(\Delta F_n^T \Delta F_n)^{-1}\Delta F_n^T \]

such that the secant equations \( G_{n+1} \Delta F_n = \Delta X_n \) are satisfied for previous iterations. Then \( G_n \) is taken \( -\beta I \). The Anderson class explicitly constructs the Gram matrix \( \Delta F_n^T \Delta F_n \) to solve the least-squares problem. For more stability use Anderson_stable, which comes at the cost of orthogonalizing \( \Delta F_n \).

Reference paper: Fang, Haw‐ren, and Yousef Saad. "Two classes of multisecant methods for nonlinear acceleration." Numerical Linear Algebra with Applications 16.3 (2009): 197-221.

Definition at line 65 of file anderson_mixer.hpp.

Constructor & Destructor Documentation

◆ Anderson()

template<typename... FUNCS>
sirius::mixer::Anderson< FUNCS >::Anderson ( std::size_t  max_history,
double  beta,
double  beta0,
double  beta_scaling_factor 
)
inline

Definition at line 75 of file anderson_mixer.hpp.

Member Function Documentation

◆ mix_impl()

template<typename... FUNCS>
void sirius::mixer::Anderson< FUNCS >::mix_impl ( )
inlineoverridevirtual

Implements sirius::mixer::Mixer< FUNCS... >.

Definition at line 86 of file anderson_mixer.hpp.

Member Data Documentation

◆ beta_

template<typename... FUNCS>
double sirius::mixer::Anderson< FUNCS >::beta_
private

Definition at line 68 of file anderson_mixer.hpp.

◆ beta0_

template<typename... FUNCS>
double sirius::mixer::Anderson< FUNCS >::beta0_
private

Definition at line 69 of file anderson_mixer.hpp.

◆ beta_scaling_factor_

template<typename... FUNCS>
double sirius::mixer::Anderson< FUNCS >::beta_scaling_factor_
private

Definition at line 70 of file anderson_mixer.hpp.

◆ S_

template<typename... FUNCS>
sddk::mdarray<double, 2> sirius::mixer::Anderson< FUNCS >::S_
private

Definition at line 71 of file anderson_mixer.hpp.

◆ S_factorized_

template<typename... FUNCS>
sddk::mdarray<double, 2> sirius::mixer::Anderson< FUNCS >::S_factorized_
private

Definition at line 72 of file anderson_mixer.hpp.

◆ history_size_

template<typename... FUNCS>
std::size_t sirius::mixer::Anderson< FUNCS >::history_size_
private

Definition at line 73 of file anderson_mixer.hpp.


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