Skip to content

Commit

Permalink
Remove unused variables in mapillary/opensfm/opensfm/src/foundation/n…
Browse files Browse the repository at this point in the history
…ewton_raphson.h

Summary:
LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance.

This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code.

 - If you approve of this diff, please use the "Accept & Ship" button :-)

Reviewed By: palmje

Differential Revision: D53779594

fbshipit-source-id: a22fbbc945140165686a74c9d0c921983ca54451
  • Loading branch information
r-barnes authored and facebook-github-bot committed Feb 15, 2024
1 parent 072abf0 commit 68b18f3
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions opensfm/src/foundation/newton_raphson.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ template <class F>
struct FiniteDiff<F, 1, 1> {
static typename TypeTraits<1, 1>::Jacobian Derivative(
const F& func, typename TypeTraits<1, 1>::Values& x) {
typename TypeTraits<1, 1>::Jacobian jacobian;
constexpr auto eps = 1e-15;
return (func(x + eps) - func(x)) / eps;
}
Expand Down Expand Up @@ -77,7 +76,6 @@ template <class F, int N, int M, class D = FiniteDiff<F, N, M>>
typename TypeTraits<N, M>::Values NewtonRaphson(
const F& func, const typename TypeTraits<N, M>::Values& initial_value,
int iterations, double tol = 1e-6) {
constexpr auto eps = std::numeric_limits<double>::epsilon();
auto current_value = initial_value;
for (int i = 0; i < iterations; ++i) {
const auto at_current_value = func(current_value);
Expand Down

0 comments on commit 68b18f3

Please sign in to comment.