From 620ca2bd3a22d348e0f5c766fdf1db88c842d070 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 7 May 2020 15:18:48 -0400 Subject: [PATCH] const reference and minor updates --- gtsam/linear/NoiseModel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gtsam/linear/NoiseModel.cpp b/gtsam/linear/NoiseModel.cpp index 915550d22..6dffc86d9 100644 --- a/gtsam/linear/NoiseModel.cpp +++ b/gtsam/linear/NoiseModel.cpp @@ -136,20 +136,18 @@ bool Gaussian::equals(const Base& expected, double tol) const { const Gaussian* p = dynamic_cast (&expected); if (p == NULL) return false; if (typeid(*this) != typeid(*p)) return false; - //TODO(Alex); - //if (!sqrt_information_) return true; return equal_with_abs_tol(R(), p->R(), sqrt(tol)); } /* ************************************************************************* */ Matrix Gaussian::covariance() const { // Uses a fast version of `covariance = information().inverse();` - Matrix R = this->R(); + const Matrix& R = this->R(); Matrix I = Matrix::Identity(R.rows(), R.cols()); // Fast inverse of upper-triangular matrix R using forward-substitution Matrix Rinv = R.triangularView().solve(I); // (R' * R)^{-1} = R^{-1} * R^{-1}' - return (Rinv * Rinv.transpose()); + return Rinv * Rinv.transpose(); } /* ************************************************************************* */