Merge pull request #1891 from borglab/fix/gcc-warning

release/4.3a0
Varun Agrawal 2024-10-30 17:41:58 -04:00 committed by GitHub
commit b2e586bb27
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -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.
@ -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);