Skip to content

Commit

Permalink
Merge pull request #1891 from borglab/fix/gcc-warning
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal authored Oct 30, 2024
2 parents f4f54dd + 8bd4738 commit b2e586b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gtsam/nonlinear/NonlinearConjugateGradientOptimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include <gtsam/base/Manifold.h>
#include <gtsam/nonlinear/NonlinearOptimizer.h>

#include <stdexcept>

namespace gtsam {

/// Fletcher-Reeves formula for computing β, the direction of steepest descent.
Expand Down Expand Up @@ -247,6 +249,9 @@ std::tuple<V, int> nonlinearConjugateGradient(
case DirectionMethod::DaiYuan:
beta = DaiYuan(currentGradient, prevGradient, direction);
break;
default:
throw std::runtime_error(
"NonlinearConjugateGradientOptimizer: Invalid directionMethod");
}

direction = currentGradient + (beta * direction);
Expand Down

0 comments on commit b2e586b

Please sign in to comment.