16 const Eigen::Ref<const VectorR>& step,
17 const Eigen::Ref<const VectorR>& gradient_change,
18 Eigen::Ref<MatrixR> updated,
19 Eigen::Ref<VectorR> work)
23 const float curvature = step.dot(gradient_change);
24 if (!(curvature >
EPSILON) || !std::isfinite(curvature))
return false;
26 work.noalias() = previous * gradient_change;
27 const float quadratic = gradient_change.dot(work);
28 if (!(quadratic >
EPSILON) || !std::isfinite(quadratic))
return false;
30 const double rho = 1.0 / double(curvature);
31 const double coefficient = 0.5 * rho * (1.0 + rho * double(quadratic));
32 if (coefficient >
double(std::numeric_limits<float>::max()))
return false;
35 work = float(coefficient) * step - float(rho) * work;
36 if (!work.allFinite())
return false;
38 updated.selfadjointView<Eigen::Lower>().rankUpdate(step, work);
39 updated.triangularView<Eigen::Upper>() = updated.triangularView<Eigen::Lower>().transpose();
41 if (!updated.allFinite())
bool bfgs_inverse_update(const Eigen::Ref< const MatrixR > &previous, const Eigen::Ref< const VectorR > &step, const Eigen::Ref< const VectorR > &gradient_change, Eigen::Ref< MatrixR > updated, Eigen::Ref< VectorR > work)
Definition quasi_newton_update.h:15