Skip to content

Commit

Permalink
missed two templates
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Oct 19, 2024
1 parent 07b11bc commit 7bb9894
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gtsam/nonlinear/NonlinearConjugateGradientOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ double HestenesStiefel(const Gradient &currentGradient,
const Gradient &prevGradient,
const Gradient &direction) {
// Hestenes-Stiefel: beta = g_n'*(g_n-g_n-1)/(-s_n-1')*(g_n-g_n-1)
VectorValues d = currentGradient - prevGradient;
Gradient d = currentGradient - prevGradient;
const double beta = std::max(0.0, currentGradient.dot(d) / -direction.dot(d));
return beta;
}

/// The Dai-Yuan formula for computing β, the direction of steepest descent.
template <typename Gradient>
double DaiYuan(const Gradient &currentGradient, const Gradient &prevGradient,
const VectorValues &direction) {
const Gradient &direction) {
// Dai-Yuan: beta = g_n'*g_n/(-s_n-1')*(g_n-g_n-1)
const double beta =
std::max(0.0, currentGradient.dot(currentGradient) /
Expand Down

0 comments on commit 7bb9894

Please sign in to comment.