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
diff --git a/include/ceres/sphere_manifold.h b/include/ceres/sphere_manifold.h index 5d71cbb..1189c11 100644 --- a/include/ceres/sphere_manifold.h +++ b/include/ceres/sphere_manifold.h
@@ -114,12 +114,17 @@ 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<double, AmbientSpaceDimension, 1>; using TangentVector = Eigen::Matrix<double, TangentSpaceDimension, 1>; using MatrixPlusJacobian = Eigen::Matrix<double, AmbientSpaceDimension, TangentSpaceDimension, - Eigen::RowMajor>; + SafeRowMajor>; using MatrixMinusJacobian = Eigen::Matrix<double, TangentSpaceDimension, AmbientSpaceDimension,