From df55682ba5fcef5409eee3d966df08433bc7cfbe Mon Sep 17 00:00:00 2001 From: "Julio L. Paneque" Date: Fri, 5 Aug 2022 11:25:29 +0200 Subject: [PATCH] Fix Eigen error in 2D sphere manifolds Since Eigen does not allow to have a RowMajor column vector (see https://gitlab.com/libeigen/eigen/-/issues/416), the storage order must be set to ColMajor in that case. This fix adds that special case when generating 2D sphere manifolds. Change-Id: I594932e0dafc878e0b348f72524478588e61b34d --- include/ceres/sphere_manifold.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ceres/sphere_manifold.h b/include/ceres/sphere_manifold.h index 5d71cbbca..1189c11f4 100644 --- a/include/ceres/sphere_manifold.h +++ b/include/ceres/sphere_manifold.h @@ -114,12 +114,17 @@ class SphereManifold final : public Manifold { static constexpr int TangentSpaceDimension = AmbientSpaceDimension > 0 ? AmbientSpaceDimension - 1 : Eigen::Dynamic; + // NOTE: Eigen does not allow to have a RowMajor column vector. + // In that case, change the storage order + static constexpr int SafeRowMajor = + TangentSpaceDimension == 1 ? Eigen::ColMajor : Eigen::RowMajor; + using AmbientVector = Eigen::Matrix; using TangentVector = Eigen::Matrix; using MatrixPlusJacobian = Eigen::Matrix; + SafeRowMajor>; using MatrixMinusJacobian = Eigen::Matrix