quala main
Quasi-Newton and other accelerators
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
BroydenGood Class Reference

#include <quala/broyden-good.hpp>

Detailed Description

Broyden's “Good” method for solving systems of nonlinear equations \( F(x) = 0 \).

\[ \begin{aligned} B_{k+1} &= B_k + \frac{\left(y_k - B_k s_k\right) s_k^\top} {s_k^\top s_k} \\ H_{k+1} &= H_k + \frac{\left(s_k - H_k y_k\right) \left(s_k^\top H_k\right)} {s_k^\top H_k y_k} \\ s_k &\triangleq x_{k+1} - x_k \\ y_k &\triangleq F(x_{k+1}) - F(x_k) \\ \end{aligned} \]

Where \( B_k \) approximates the Jacobian of \( F(x_k) \) and \( H_k \triangleq B_k^{-1} \).

Todo:
Damping.

Definition at line 83 of file broyden-good.hpp.

+ Collaboration diagram for BroydenGood:

Public Types

using Params = BroydenGoodParams
 

Public Member Functions

 BroydenGood (Params params)
 
 BroydenGood (Params params, length_t n)
 
template<class VecS , class VecY >
bool update_sy (const anymat< VecS > &s, const anymat< VecY > &y, bool forced=false)
 Update the inverse Jacobian approximation using the new vectors sₖ = xₖ₊₁ - xₖ and yₖ = pₖ₊₁ - pₖ. More...
 
bool update (crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, bool forced=false)
 Update the inverse Jacobian approximation using the new vectors xₖ₊₁ and pₖ₊₁. More...
 
bool apply (rvec q, real_t γ)
 Apply the inverse Jacobian approximation to the given vector q, i.e. More...
 
void reset ()
 Throw away the approximation and all previous vectors s and y. More...
 
void resize (length_t n)
 Re-allocate storage for a problem with a different size. More...
 
const Paramsget_params () const
 Get the parameters. More...
 
length_t n () const
 Get the size of the s and y vectors in the buffer. More...
 
length_t history () const
 Get the number of previous vectors s and y stored in the buffer. More...
 
index_t succ (index_t i) const
 Get the next index in the circular buffer of previous s and y vectors. More...
 
index_t pred (index_t i) const
 Get the previous index in the circular buffer of s and y vectors. More...
 
length_t current_history () const
 Get the number of previous s and y vectors currently stored in the buffer. More...
 
auto s (index_t i)
 
auto s (index_t i) const
 
auto  (index_t i)
 
auto  (index_t i) const
 
template<class F >
void foreach_fwd (const F &fun) const
 Iterate over the indices in the history buffer, oldest first. More...
 
template<class F >
void foreach_rev (const F &fun) const
 Iterate over the indices in the history buffer, newest first. More...
 

Private Attributes

BroydenStorage sto
 
index_t idx = 0
 
bool full = false
 
Params params
 
real_t latest_γ = NaN
 

Member Typedef Documentation

◆ Params

Definition at line 85 of file broyden-good.hpp.

Constructor & Destructor Documentation

◆ BroydenGood() [1/2]

BroydenGood ( Params  params)
inline

Definition at line 87 of file broyden-good.hpp.

◆ BroydenGood() [2/2]

BroydenGood ( Params  params,
length_t  n 
)
inline

Definition at line 88 of file broyden-good.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ update_sy()

bool update_sy ( const anymat< VecS > &  s,
const anymat< VecY > &  y,
bool  forced = false 
)

Update the inverse Jacobian approximation using the new vectors sₖ = xₖ₊₁ - xₖ and yₖ = pₖ₊₁ - pₖ.

Definition at line 177 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

bool update ( crvec  xₖ,
crvec  xₙₑₓₜ,
crvec  pₖ,
crvec  pₙₑₓₜ,
bool  forced = false 
)
inline

Update the inverse Jacobian approximation using the new vectors xₖ₊₁ and pₖ₊₁.

Definition at line 243 of file broyden-good.hpp.

+ Here is the call graph for this function:

◆ apply()

bool apply ( rvec  q,
real_t  γ 
)
inline

Apply the inverse Jacobian approximation to the given vector q, i.e.

\( q \leftarrow H_k q \). Initial inverse Hessian approximation is set to \( H_0 = \gamma I \). The result is scaled by a factor γ. If γ is negative, the result is scaled by \( \frac{s^\top y}{y^\top y} \).

Definition at line 224 of file broyden-good.hpp.

+ Here is the call graph for this function:

◆ reset()

void reset ( )
inline

Throw away the approximation and all previous vectors s and y.

Definition at line 164 of file broyden-good.hpp.

+ Here is the caller graph for this function:

◆ resize()

void resize ( length_t  n)
inline

Re-allocate storage for a problem with a different size.

Causes a reset.

Definition at line 169 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_params()

const Params & get_params ( ) const
inline

Get the parameters.

Definition at line 115 of file broyden-good.hpp.

+ Here is the caller graph for this function:

◆ n()

length_t n ( ) const
inline

Get the size of the s and y vectors in the buffer.

Definition at line 118 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ history()

length_t history ( ) const
inline

Get the number of previous vectors s and y stored in the buffer.

Definition at line 120 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ succ()

index_t succ ( index_t  i) const
inline

Get the next index in the circular buffer of previous s and y vectors.

Definition at line 122 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pred()

index_t pred ( index_t  i) const
inline

Get the previous index in the circular buffer of s and y vectors.

Definition at line 124 of file broyden-good.hpp.

+ Here is the call graph for this function:

◆ current_history()

length_t current_history ( ) const
inline

Get the number of previous s and y vectors currently stored in the buffer.

Definition at line 127 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ s() [1/2]

auto s ( index_t  i)
inline

Definition at line 129 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ s() [2/2]

auto s ( index_t  i) const
inline

Definition at line 130 of file broyden-good.hpp.

+ Here is the call graph for this function:

◆ s̃() [1/2]

auto s̃ ( index_t  i)
inline

Definition at line 131 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ s̃() [2/2]

auto s̃ ( index_t  i) const
inline

Definition at line 132 of file broyden-good.hpp.

+ Here is the call graph for this function:

◆ foreach_fwd()

void foreach_fwd ( const F &  fun) const
inline

Iterate over the indices in the history buffer, oldest first.

Definition at line 136 of file broyden-good.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ foreach_rev()

void foreach_rev ( const F &  fun) const
inline

Iterate over the indices in the history buffer, newest first.

Definition at line 147 of file broyden-good.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ sto

BroydenStorage sto
private

Definition at line 157 of file broyden-good.hpp.

◆ idx

index_t idx = 0
private

Definition at line 158 of file broyden-good.hpp.

◆ full

bool full = false
private

Definition at line 159 of file broyden-good.hpp.

◆ params

Params params
private

Definition at line 160 of file broyden-good.hpp.

◆ latest_γ

real_t latest_γ = NaN
private

Definition at line 161 of file broyden-good.hpp.


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