From 8ba0a274dab4d4689fa38d027e9c55b68aeb34e0 Mon Sep 17 00:00:00 2001
From: jvallve <jvallve@iri.upc.edu>
Date: Fri, 4 Nov 2022 09:34:15 +0100
Subject: [PATCH] bug of eigen .asDiagonal() and gtest assert

---
 test/gtest_problem.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/gtest_problem.cpp b/test/gtest_problem.cpp
index b7e7f0cbb..1a90de3ec 100644
--- a/test/gtest_problem.cpp
+++ b/test/gtest_problem.cpp
@@ -183,8 +183,8 @@ TEST(Problem, SetOrigin_PO_2d)
         ASSERT_FALSE(fac->getFeatureOther());
     }
     auto x0_vector = prior.getVectorComposite().vector("PO");
-    auto P0_p = prior.at('P').getNoiseStd().cwiseAbs2().asDiagonal();
-    auto P0_o = prior.at('O').getNoiseStd().cwiseAbs2().asDiagonal();
+    MatrixXd P0_p = prior.at('P').getNoiseStd().cwiseAbs2().asDiagonal();
+    MatrixXd P0_o = prior.at('O').getNoiseStd().cwiseAbs2().asDiagonal();
 
     // check that the Feature measurement and covariance are the ones provided
     ASSERT_MATRIX_APPROX(x0_vector.head<2>(), fp->getMeasurement(), Constants::EPS_SMALL );
@@ -247,8 +247,8 @@ TEST(Problem, SetOrigin_PO_3d)
     }
 
     auto x0_vector = prior.getVectorComposite().vector("PO");
-    auto P0_p = prior.at('P').getNoiseStd().cwiseAbs2().asDiagonal();
-    auto P0_o = prior.at('O').getNoiseStd().cwiseAbs2().asDiagonal();
+    MatrixXd P0_p = prior.at('P').getNoiseStd().cwiseAbs2().asDiagonal();
+    MatrixXd P0_o = prior.at('O').getNoiseStd().cwiseAbs2().asDiagonal();
     
     // check that the Feature measurement and covariance are the ones provided
     ASSERT_MATRIX_APPROX(x0_vector.head<3>(), fp->getMeasurement(), Constants::EPS_SMALL );
-- 
GitLab