Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Sep 25, 2024
1 parent 2682cde commit 9243655
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions gtsam/linear/NoiseModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,10 @@ Diagonal::Diagonal(const Vector& sigmas)

/* ************************************************************************* */
Diagonal::shared_ptr Diagonal::Variances(const Vector& variances, bool smart) {
if (smart) {
// check whether all the same entry
if ((variances.array() == variances(0)).all()) {
return Isotropic::Variance(variances.size(), variances(0), true);
} else
goto full;
}
full:
return shared_ptr(new Diagonal(variances.cwiseSqrt()));
// check whether all the same entry
return (smart && (variances.array() == variances(0)).all())
? Isotropic::Variance(variances.size(), variances(0), true)
: shared_ptr(new Diagonal(variances.cwiseSqrt()));
}

/* ************************************************************************* */
Expand Down

0 comments on commit 9243655

Please sign in to comment.