diff --git a/gtsam/linear/NoiseModel.cpp b/gtsam/linear/NoiseModel.cpp index cb77902d0..584f758a1 100644 --- a/gtsam/linear/NoiseModel.cpp +++ b/gtsam/linear/NoiseModel.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- - * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) @@ -82,13 +82,13 @@ Gaussian::shared_ptr Gaussian::SqrtInformation(const Matrix& R, bool smart) { size_t m = R.rows(), n = R.cols(); if (m != n) throw invalid_argument("Gaussian::SqrtInformation: R not square"); - boost::optional diagonal = boost::none; - if (smart) - diagonal = checkIfDiagonal(R); - if (diagonal) - return Diagonal::Sigmas(diagonal->array().inverse(), true); - else - return shared_ptr(new Gaussian(R.rows(), R)); + if (smart) { + boost::optional diagonal = checkIfDiagonal(R); + if (diagonal) + return Diagonal::Sigmas(diagonal->array().inverse(), true); + } + // NOTE(frank): only reaches here if !smart && !diagonal + return shared_ptr(new Gaussian(R.rows(), R)); } /* ************************************************************************* */