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