diff --git a/gtsam/linear/NoiseModel.cpp b/gtsam/linear/NoiseModel.cpp index 3d11542db..fcaec3afa 100644 --- a/gtsam/linear/NoiseModel.cpp +++ b/gtsam/linear/NoiseModel.cpp @@ -74,22 +74,27 @@ boost::optional checkIfDiagonal(const Matrix M) { /* ************************************************************************* */ 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"); + 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(reciprocal(*diagonal),true); - else return shared_ptr(new Gaussian(R.rows(),R)); + if (diagonal) + return Diagonal::Sigmas(reciprocal(*diagonal), true); + else + return shared_ptr(new Gaussian(R.rows(), R)); } /* ************************************************************************* */ Gaussian::shared_ptr Gaussian::Information(const Matrix& M, bool smart) { size_t m = M.rows(), n = M.cols(); - if (m != n) throw invalid_argument("Gaussian::Information: R not square"); + if (m != n) + throw invalid_argument("Gaussian::Information: R not square"); boost::optional diagonal = boost::none; if (smart) diagonal = checkIfDiagonal(M); - if (diagonal) return Diagonal::Precisions(*diagonal, true); + if (diagonal) + return Diagonal::Precisions(*diagonal, true); else { Matrix R = RtR(M); return shared_ptr(new Gaussian(R.rows(), R)); @@ -97,14 +102,18 @@ Gaussian::shared_ptr Gaussian::Information(const Matrix& M, bool smart) { } /* ************************************************************************* */ -Gaussian::shared_ptr Gaussian::Covariance(const Matrix& covariance, bool smart) { +Gaussian::shared_ptr Gaussian::Covariance(const Matrix& covariance, + bool smart) { size_t m = covariance.rows(), n = covariance.cols(); - if (m != n) throw invalid_argument("Gaussian::Covariance: covariance not square"); + if (m != n) + throw invalid_argument("Gaussian::Covariance: covariance not square"); boost::optional variances = boost::none; if (smart) variances = checkIfDiagonal(covariance); - if (variances) return Diagonal::Variances(*variances,true); - else return shared_ptr(new Gaussian(n, inverse_square_root(covariance))); + if (variances) + return Diagonal::Variances(*variances, true); + else + return shared_ptr(new Gaussian(n, inverse_square_root(covariance))); } /* ************************************************************************* */