33 Eigen::Matrix<real_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor>;
92 template <
class VecS,
class VecY>
171 throw std::invalid_argument(
"BroydenGood::Params::memory must be >= 1");
176template <
class VecS,
class VecY>
189 r +=
s̃(i) * r.dot(
s(i));
191 const real_t sᵀHy = sₖ.dot(r);
201 real_t γ = sᵀHy / sₖ.squaredNorm();
202 real_t sgn_γ = γ >= 0 ? 1 : -1;
206 : (1 - γθ̅) / (1 - γ);
207 damp = θ / (sₖ.squaredNorm() * (1 - θ + θ * γ));
213 latest_γ = sₖ.dot(yₖ) / yₖ.squaredNorm();
237 q +=
s̃(i) * q.dot(
s(i));
245 const auto s = xₙₑₓₜ - xₖ;
246 const auto y = pₙₑₓₜ - pₖ;
Broyden's “Good” method for solving systems of nonlinear equations .
void foreach_rev(const F &fun) const
Iterate over the indices in the history buffer, newest first.
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ₖ₊₁.
BroydenGood(Params params)
length_t current_history() const
Get the number of previous s and y vectors currently stored in the buffer.
index_t succ(index_t i) const
Get the next index in the circular buffer of previous s and y vectors.
index_t pred(index_t i) const
Get the previous index in the circular buffer of s and y vectors.
length_t n() const
Get the size of the s and y vectors in the buffer.
const Params & get_params() const
Get the parameters.
length_t history() const
Get the number of previous vectors s and y stored in the buffer.
void foreach_fwd(const F &fun) const
Iterate over the indices in the history buffer, oldest first.
void resize(length_t n)
Re-allocate storage for a problem with a different size.
void reset()
Throw away the approximation and all previous vectors s and y.
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ₖ.
BroydenGood(Params params, length_t n)
bool apply(rvec q, real_t γ)
Apply the inverse Jacobian approximation to the given vector q, i.e.
real_t powell_damping_factor
Powell's trick, damping, prevents nonsingularity.
Eigen::Ref< const vec > crvec
Default type for immutable references to vectors.
real_t min_div_abs
Reject update if .
bool restarted
If set to true, the buffer is cleared after memory iterations.
constexpr real_t NaN
Not a number.
length_t memory
Length of the history to keep.
index_t length_t
Default type for vector sizes.
real_t min_stepsize
Minimum automatic step size.
bool force_pos_def
If set to true, the inverse Jacobian estimate should remain definite.
Eigen::Index index_t
Default type for vector indices.
double real_t
Default floating point type.
Eigen::MatrixBase< Derived > anymat
Generic type for vector and matrix arguments.
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Parameters for the BroydenGood class.
void resize(length_t n, length_t history)
Re-allocate storage for a problem with a different size.
length_t n() const
Get the size of the s and s̃ vectors in the buffer.
length_t history() const
Get the number of previous vectors s and s̃ stored in the buffer.
Eigen::Matrix< real_t, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor > storage_t