Change all occurances of unnamed enum (deprecated in C++20) to `constexpr`

release/4.3a0
Fan Jiang 2024-12-02 14:11:51 -05:00
parent d8e4125558
commit 456df093f1
41 changed files with 58 additions and 77 deletions

View File

@ -22,7 +22,7 @@ In GTSAM, all properties and operations needed to use a type must be defined thr
In detail, we ask that the following items are defined in the traits object (although, not all are needed for optimization): In detail, we ask that the following items are defined in the traits object (although, not all are needed for optimization):
* values: * values:
* `enum { dimension = D};`, an enum that indicates the dimensionality *n* of the manifold. In Eigen-fashion, we also support manifolds whose dimensionality is only defined at runtime, by specifying the value -1. * `inline constexpr static auto dimension = D;`, a constexpr that indicates the dimensionality *n* of the manifold. In Eigen-fashion, we also support manifolds whose dimensionality is only defined at runtime, by specifying the value -1.
* types: * types:
* `TangentVector`, type that lives in tangent space. This will almost always be an `Eigen::Matrix<double,n,1>`. * `TangentVector`, type that lives in tangent space. This will almost always be an `Eigen::Matrix<double,n,1>`.
* `ChartJacobian`, a typedef for `OptionalJacobian<dimension, dimension>`. * `ChartJacobian`, a typedef for `OptionalJacobian<dimension, dimension>`.

View File

@ -184,9 +184,8 @@ public:
} }
#endif #endif
// Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
enum { NeedsToAlign = (sizeof(T) % 16) == 0 }; constexpr static const bool NeedsToAlign = (sizeof(T) % 16) == 0;
public: public:
GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
}; };

View File

@ -36,7 +36,7 @@ namespace gtsam {
template <class Class, int N> template <class Class, int N>
struct LieGroup { struct LieGroup {
enum { dimension = N }; inline constexpr static auto dimension = N;
typedef OptionalJacobian<N, N> ChartJacobian; typedef OptionalJacobian<N, N> ChartJacobian;
typedef Eigen::Matrix<double, N, N> Jacobian; typedef Eigen::Matrix<double, N, N> Jacobian;
typedef Eigen::Matrix<double, N, 1> TangentVector; typedef Eigen::Matrix<double, N, 1> TangentVector;
@ -183,7 +183,7 @@ struct LieGroupTraits: GetDimensionImpl<Class, Class::dimension> {
/// @name Manifold /// @name Manifold
/// @{ /// @{
typedef Class ManifoldType; typedef Class ManifoldType;
enum { dimension = Class::dimension }; inline constexpr static auto dimension = Class::dimension;
typedef Eigen::Matrix<double, dimension, 1> TangentVector; typedef Eigen::Matrix<double, dimension, 1> TangentVector;
typedef OptionalJacobian<dimension, dimension> ChartJacobian; typedef OptionalJacobian<dimension, dimension> ChartJacobian;

View File

@ -55,7 +55,7 @@ namespace internal {
template<class Class> template<class Class>
struct HasManifoldPrereqs { struct HasManifoldPrereqs {
enum { dim = Class::dimension }; inline constexpr static auto dim = Class::dimension;
Class p, q; Class p, q;
Eigen::Matrix<double, dim, 1> v; Eigen::Matrix<double, dim, 1> v;
@ -95,7 +95,7 @@ struct ManifoldTraits: GetDimensionImpl<Class, Class::dimension> {
GTSAM_CONCEPT_ASSERT(HasManifoldPrereqs<Class>); GTSAM_CONCEPT_ASSERT(HasManifoldPrereqs<Class>);
// Dimension of the manifold // Dimension of the manifold
enum { dimension = Class::dimension }; inline constexpr static auto dimension = Class::dimension;
// Typedefs required by all manifold types. // Typedefs required by all manifold types.
typedef Class ManifoldType; typedef Class ManifoldType;

View File

@ -479,7 +479,7 @@ struct MultiplyWithInverse {
*/ */
template <typename T, int N> template <typename T, int N>
struct MultiplyWithInverseFunction { struct MultiplyWithInverseFunction {
enum { M = traits<T>::dimension }; inline constexpr static auto M = traits<T>::dimension;
typedef Eigen::Matrix<double, N, 1> VectorN; typedef Eigen::Matrix<double, N, 1> VectorN;
typedef Eigen::Matrix<double, N, N> MatrixN; typedef Eigen::Matrix<double, N, N> MatrixN;

View File

@ -67,9 +67,9 @@ public:
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum {dimension = dimension1 + dimension2}; inline constexpr static auto dimension = dimension1 + dimension2;
inline static size_t Dim() {return dimension;} inline static size_t Dim() { return dimension; }
inline size_t dim() const {return dimension;} inline size_t dim() const { return dimension; }
typedef Eigen::Matrix<double, dimension, 1> TangentVector; typedef Eigen::Matrix<double, dimension, 1> TangentVector;
typedef OptionalJacobian<dimension, dimension> ChartJacobian; typedef OptionalJacobian<dimension, dimension> ChartJacobian;

View File

@ -163,7 +163,7 @@ struct VectorSpaceImpl<Class,Eigen::Dynamic> {
template<class Class> template<class Class>
struct HasVectorSpacePrereqs { struct HasVectorSpacePrereqs {
enum { dim = Class::dimension }; inline constexpr static auto dim = Class::dimension;
Class p, q; Class p, q;
Vector v; Vector v;
@ -197,7 +197,7 @@ GTSAM_CONCEPT_ASSERT(HasVectorSpacePrereqs<Class>);
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = Class::dimension}; inline constexpr static auto dimension = Class::dimension;
typedef Class ManifoldType; typedef Class ManifoldType;
/// @} /// @}
}; };
@ -232,7 +232,7 @@ struct ScalarTraits : VectorSpaceImpl<Scalar, 1> {
/// @name Manifold /// @name Manifold
/// @{ /// @{
typedef Scalar ManifoldType; typedef Scalar ManifoldType;
enum { dimension = 1 }; inline constexpr static auto dimension = 1;
typedef Eigen::Matrix<double, 1, 1> TangentVector; typedef Eigen::Matrix<double, 1, 1> TangentVector;
typedef OptionalJacobian<1, 1> ChartJacobian; typedef OptionalJacobian<1, 1> ChartJacobian;
@ -305,7 +305,7 @@ struct traits<Eigen::Matrix<double, M, N, Options, MaxRows, MaxCols> > :
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = M*N}; inline constexpr static auto dimension = M * N;
typedef Fixed ManifoldType; typedef Fixed ManifoldType;
typedef Eigen::Matrix<double, dimension, 1> TangentVector; typedef Eigen::Matrix<double, dimension, 1> TangentVector;
typedef Eigen::Matrix<double, dimension, dimension> Jacobian; typedef Eigen::Matrix<double, dimension, dimension> Jacobian;
@ -377,7 +377,7 @@ struct DynamicTraits {
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = Eigen::Dynamic }; inline constexpr static auto dimension = Eigen::Dynamic;
typedef Eigen::VectorXd TangentVector; typedef Eigen::VectorXd TangentVector;
typedef Eigen::MatrixXd Jacobian; typedef Eigen::MatrixXd Jacobian;
typedef OptionalJacobian<dimension, dimension> ChartJacobian; typedef OptionalJacobian<dimension, dimension> ChartJacobian;

View File

@ -291,7 +291,7 @@ class Basis {
*/ */
template <class T> template <class T>
class ManifoldEvaluationFunctor : public VectorEvaluationFunctor { class ManifoldEvaluationFunctor : public VectorEvaluationFunctor {
enum { M = traits<T>::dimension }; inline constexpr static auto M = traits<T>::dimension;
using Base = VectorEvaluationFunctor; using Base = VectorEvaluationFunctor;
public: public:

View File

@ -162,9 +162,7 @@ private:
/// @} /// @}
// Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
enum { inline constexpr static auto NeedsToAlign = (sizeof(B) % 16) == 0 || (sizeof(R) % 16) == 0;
NeedsToAlign = (sizeof(B) % 16) == 0 || (sizeof(R) % 16) == 0
};
public: public:
GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
}; };

View File

@ -73,7 +73,7 @@ class GTSAM_EXPORT Cal3 {
double u0_ = 0.0f, v0_ = 0.0f; ///< principal point double u0_ = 0.0f, v0_ = 0.0f; ///< principal point
public: public:
enum { dimension = 5 }; inline constexpr static auto dimension = 5;
///< shared pointer to calibration object ///< shared pointer to calibration object
using shared_ptr = std::shared_ptr<Cal3>; using shared_ptr = std::shared_ptr<Cal3>;

View File

@ -37,7 +37,7 @@ class GTSAM_EXPORT Cal3Bundler : public Cal3f {
// Note: u0 and v0 are constants and not optimized. // Note: u0 and v0 are constants and not optimized.
public: public:
enum { dimension = 3 }; inline constexpr static auto dimension = 3;
using shared_ptr = std::shared_ptr<Cal3Bundler>; using shared_ptr = std::shared_ptr<Cal3Bundler>;
/// @name Constructors /// @name Constructors

View File

@ -36,7 +36,7 @@ class GTSAM_EXPORT Cal3DS2 : public Cal3DS2_Base {
using Base = Cal3DS2_Base; using Base = Cal3DS2_Base;
public: public:
enum { dimension = 9 }; inline constexpr static auto dimension = 9;
///< shared pointer to stereo calibration object ///< shared pointer to stereo calibration object
using shared_ptr = std::shared_ptr<Cal3DS2>; using shared_ptr = std::shared_ptr<Cal3DS2>;

View File

@ -46,7 +46,7 @@ class GTSAM_EXPORT Cal3DS2_Base : public Cal3 {
double tol_ = 1e-5; ///< tolerance value when calibrating double tol_ = 1e-5; ///< tolerance value when calibrating
public: public:
enum { dimension = 9 }; inline constexpr static auto dimension = 9;
///< shared pointer to stereo calibration object ///< shared pointer to stereo calibration object
using shared_ptr = std::shared_ptr<Cal3DS2_Base>; using shared_ptr = std::shared_ptr<Cal3DS2_Base>;

View File

@ -55,7 +55,7 @@ class GTSAM_EXPORT Cal3Fisheye : public Cal3 {
double tol_ = 1e-5; ///< tolerance value when calibrating double tol_ = 1e-5; ///< tolerance value when calibrating
public: public:
enum { dimension = 9 }; inline constexpr static auto dimension = 9;
///< shared pointer to fisheye calibration object ///< shared pointer to fisheye calibration object
using shared_ptr = std::shared_ptr<Cal3Fisheye>; using shared_ptr = std::shared_ptr<Cal3Fisheye>;

View File

@ -50,7 +50,7 @@ class GTSAM_EXPORT Cal3Unified : public Cal3DS2_Base {
double xi_ = 0.0f; ///< mirror parameter double xi_ = 0.0f; ///< mirror parameter
public: public:
enum { dimension = 10 }; inline constexpr static auto dimension = 10;
///< shared pointer to stereo calibration object ///< shared pointer to stereo calibration object
using shared_ptr = std::shared_ptr<Cal3Unified>; using shared_ptr = std::shared_ptr<Cal3Unified>;

View File

@ -33,7 +33,7 @@ namespace gtsam {
*/ */
class GTSAM_EXPORT Cal3_S2 : public Cal3 { class GTSAM_EXPORT Cal3_S2 : public Cal3 {
public: public:
enum { dimension = 5 }; inline constexpr static auto dimension = 5;
///< shared pointer to calibration object ///< shared pointer to calibration object
using shared_ptr = std::shared_ptr<Cal3_S2>; using shared_ptr = std::shared_ptr<Cal3_S2>;

View File

@ -32,7 +32,7 @@ class GTSAM_EXPORT Cal3_S2Stereo : public Cal3_S2 {
double b_ = 1.0f; ///< Stereo baseline. double b_ = 1.0f; ///< Stereo baseline.
public: public:
enum { dimension = 6 }; inline constexpr static auto dimension = 6;
///< shared pointer to stereo calibration object ///< shared pointer to stereo calibration object
using shared_ptr = std::shared_ptr<Cal3_S2Stereo>; using shared_ptr = std::shared_ptr<Cal3_S2Stereo>;

View File

@ -34,7 +34,7 @@ namespace gtsam {
*/ */
class GTSAM_EXPORT Cal3f : public Cal3 { class GTSAM_EXPORT Cal3f : public Cal3 {
public: public:
enum { dimension = 1 }; inline constexpr static auto dimension = 1;
using shared_ptr = std::shared_ptr<Cal3f>; using shared_ptr = std::shared_ptr<Cal3f>;
/// @name Constructors /// @name Constructors

View File

@ -252,9 +252,7 @@ class GTSAM_EXPORT CalibratedCamera: public PinholeBase {
public: public:
enum { inline constexpr static auto dimension = 6;
dimension = 6
};
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -82,7 +82,7 @@ class EssentialMatrix {
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = 5 }; inline constexpr static auto dimension = 5;
inline static size_t Dim() { return dimension;} inline static size_t Dim() { return dimension;}
inline size_t dim() const { return dimension;} inline size_t dim() const { return dimension;}

View File

@ -102,7 +102,7 @@ class GTSAM_EXPORT FundamentalMatrix {
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = 7 }; // 3 for U, 1 for s, 3 for V inline constexpr static auto dimension = 7; // 3 for U, 1 for s, 3 for V
inline static size_t Dim() { return dimension; } inline static size_t Dim() { return dimension; }
inline size_t dim() const { return dimension; } inline size_t dim() const { return dimension; }
@ -179,7 +179,7 @@ class GTSAM_EXPORT SimpleFundamentalMatrix {
/// @name Manifold /// @name Manifold
/// @{ /// @{
enum { dimension = 7 }; // 5 for E, 1 for fa, 1 for fb inline constexpr static auto dimension = 7; // 5 for E, 1 for fa, 1 for fb
inline static size_t Dim() { return dimension; } inline static size_t Dim() { return dimension; }
inline size_t dim() const { return dimension; } inline size_t dim() const { return dimension; }

View File

@ -47,7 +47,7 @@ class GTSAM_EXPORT Line3 {
double a_, b_; // Intersection of line with the world x-y plane rotated by R_ double a_, b_; // Intersection of line with the world x-y plane rotated by R_
// Also the closest point on line to origin // Also the closest point on line to origin
public: public:
enum { dimension = 4 }; inline constexpr static auto dimension = 4;
/** Default constructor is the Z axis **/ /** Default constructor is the Z axis **/
Line3() : Line3() :

View File

@ -39,9 +39,7 @@ private:
double d_; ///< The perpendicular distance to this plane double d_; ///< The perpendicular distance to this plane
public: public:
enum { inline constexpr static auto dimension = 3;
dimension = 3
};
/// @name Constructors /// @name Constructors
/// @{ /// @{

View File

@ -51,9 +51,7 @@ private:
public: public:
enum { inline constexpr static auto dimension = 6 + DimK; ///< Dimension depends on calibration
dimension = 6 + DimK
}; ///< Dimension depends on calibration
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -245,9 +245,7 @@ private:
public: public:
enum { inline constexpr static auto dimension = 6; ///< There are 6 DOF to optimize for
dimension = 6
}; ///< There are 6 DOF to optimize for
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -45,9 +45,7 @@ struct traits<QUATERNION_TYPE> {
/// @} /// @}
/// @name Basic manifold traits /// @name Basic manifold traits
/// @{ /// @{
enum { inline constexpr static auto dimension = 3;
dimension = 3
};
typedef OptionalJacobian<3, 3> ChartJacobian; typedef OptionalJacobian<3, 3> ChartJacobian;
typedef Eigen::Matrix<_Scalar, 3, 1, _Options, 3, 1> TangentVector; typedef Eigen::Matrix<_Scalar, 3, 1, _Options, 3, 1> TangentVector;

View File

@ -54,7 +54,7 @@ constexpr int NSquaredSO(int N) { return (N < 0) ? Eigen::Dynamic : N * N; }
template <int N> template <int N>
class SO : public LieGroup<SO<N>, internal::DimensionSO(N)> { class SO : public LieGroup<SO<N>, internal::DimensionSO(N)> {
public: public:
enum { dimension = internal::DimensionSO(N) }; inline constexpr static auto dimension = internal::DimensionSO(N);
using MatrixNN = Eigen::Matrix<double, N, N>; using MatrixNN = Eigen::Matrix<double, N, N>;
using VectorN2 = Eigen::Matrix<double, internal::NSquaredSO(N), 1>; using VectorN2 = Eigen::Matrix<double, internal::NSquaredSO(N), 1>;
using MatrixDD = Eigen::Matrix<double, dimension, dimension>; using MatrixDD = Eigen::Matrix<double, dimension, dimension>;

View File

@ -41,7 +41,7 @@ namespace gtsam {
*/ */
class GTSAM_EXPORT EmptyCal { class GTSAM_EXPORT EmptyCal {
public: public:
enum { dimension = 0 }; inline constexpr static auto dimension = 0;
EmptyCal() {} EmptyCal() {}
virtual ~EmptyCal() = default; virtual ~EmptyCal() = default;
using shared_ptr = std::shared_ptr<EmptyCal>; using shared_ptr = std::shared_ptr<EmptyCal>;
@ -73,7 +73,7 @@ class GTSAM_EXPORT EmptyCal {
*/ */
class GTSAM_EXPORT SphericalCamera { class GTSAM_EXPORT SphericalCamera {
public: public:
enum { dimension = 6 }; inline constexpr static auto dimension = 6;
using Measurement = Unit3; using Measurement = Unit3;
using MeasurementVector = std::vector<Unit3>; using MeasurementVector = std::vector<Unit3>;

View File

@ -61,9 +61,7 @@ private:
public: public:
enum { inline constexpr static auto dimension = 6;
dimension = 6
};
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -37,7 +37,7 @@ private:
double uL_, uR_, v_; double uL_, uR_, v_;
public: public:
enum { dimension = 3 }; inline constexpr static auto dimension = 3;
/// @name Standard Constructors /// @name Standard Constructors
/// @{ /// @{

View File

@ -53,9 +53,7 @@ private:
public: public:
enum { inline constexpr static auto dimension = 2;
dimension = 2
};
/// @name Constructors /// @name Constructors
/// @{ /// @{

View File

@ -42,9 +42,7 @@ private:
public: public:
enum { inline constexpr static auto dimension = 9;
dimension = 9
};
typedef std::pair<Point3, Velocity3> PositionAndVelocity; typedef std::pair<Point3, Velocity3> PositionAndVelocity;

View File

@ -224,9 +224,9 @@ private:
#endif #endif
// Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
enum { NeedsToAlign = (sizeof(T) % 16) == 0 }; inline constexpr static auto NeedsToAlign = (sizeof(T) % 16) == 0;
public: public:
GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
}; };
// ExpressionFactor // ExpressionFactor

View File

@ -434,7 +434,7 @@ class NoiseModelFactorN
public detail::NoiseModelFactorAliases<ValueTypes...> { public detail::NoiseModelFactorAliases<ValueTypes...> {
public: public:
/// N is the number of variables (N-way factor) /// N is the number of variables (N-way factor)
enum { N = sizeof...(ValueTypes) }; inline constexpr static auto N = sizeof...(ValueTypes);
using NoiseModelFactor::unwhitenedError; using NoiseModelFactor::unwhitenedError;

View File

@ -118,7 +118,7 @@ namespace gtsam {
#endif #endif
// Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
enum { NeedsToAlign = (sizeof(T) % 16) == 0 }; inline constexpr static auto NeedsToAlign = (sizeof(T) % 16) == 0;
public: public:
GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
}; };

View File

@ -115,7 +115,7 @@ TEST(Expression, Unary3) {
// Simple test class that implements the `VectorSpace` protocol. // Simple test class that implements the `VectorSpace` protocol.
class Class : public Point3 { class Class : public Point3 {
public: public:
enum {dimension = 3}; inline constexpr static auto dimension = 3;
using Point3::Point3; using Point3::Point3;
const Vector3& vector() const { return *this; } const Vector3& vector() const { return *this; }
inline static Class Identity() { return Class(0,0,0); } inline static Class Identity() { return Class(0,0,0); }

View File

@ -54,7 +54,7 @@ int TestValueData::DestructorCount = 0;
class TestValue { class TestValue {
TestValueData data_; TestValueData data_;
public: public:
enum {dimension = 0}; inline constexpr static auto dimension = 0;
void print(const std::string& str = "") const {} void print(const std::string& str = "") const {}
bool equals(const TestValue& other, double tol = 1e-9) const { return true; } bool equals(const TestValue& other, double tol = 1e-9) const { return true; }
size_t dim() const { return 0; } size_t dim() const { return 0; }

View File

@ -147,10 +147,10 @@ namespace gtsam {
} }
#endif #endif
// Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html // Alignment, see https://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html
enum { NeedsToAlign = (sizeof(VALUE) % 16) == 0 }; inline constexpr static auto NeedsToAlign = (sizeof(VALUE) % 16) == 0;
public: public:
GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) GTSAM_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
}; // \class BetweenFactor }; // \class BetweenFactor
/// traits /// traits

View File

@ -49,7 +49,7 @@ ConvertNoiseModel(const SharedNoiseModel &model, size_t n,
*/ */
template <class Rot> template <class Rot>
class FrobeniusPrior : public NoiseModelFactorN<Rot> { class FrobeniusPrior : public NoiseModelFactorN<Rot> {
enum { Dim = Rot::VectorN2::RowsAtCompileTime }; inline constexpr static auto Dim = Rot::VectorN2::RowsAtCompileTime;
using MatrixNN = typename Rot::MatrixNN; using MatrixNN = typename Rot::MatrixNN;
Eigen::Matrix<double, Dim, 1> vecM_; ///< vectorized matrix to approximate Eigen::Matrix<double, Dim, 1> vecM_; ///< vectorized matrix to approximate
@ -79,7 +79,7 @@ class FrobeniusPrior : public NoiseModelFactorN<Rot> {
*/ */
template <class Rot> template <class Rot>
class FrobeniusFactor : public NoiseModelFactorN<Rot, Rot> { class FrobeniusFactor : public NoiseModelFactorN<Rot, Rot> {
enum { Dim = Rot::VectorN2::RowsAtCompileTime }; inline constexpr static auto Dim = Rot::VectorN2::RowsAtCompileTime;
public: public:
@ -111,7 +111,7 @@ class FrobeniusBetweenFactor : public NoiseModelFactorN<Rot, Rot> {
Rot R12_; ///< measured rotation between R1 and R2 Rot R12_; ///< measured rotation between R1 and R2
Eigen::Matrix<double, Rot::dimension, Rot::dimension> Eigen::Matrix<double, Rot::dimension, Rot::dimension>
R2hat_H_R1_; ///< fixed derivative of R2hat wrpt R1 R2hat_H_R1_; ///< fixed derivative of R2hat wrpt R1
enum { Dim = Rot::VectorN2::RowsAtCompileTime }; inline constexpr static auto Dim = Rot::VectorN2::RowsAtCompileTime;
public: public:

View File

@ -45,7 +45,7 @@ template <class T> T FindKarcherMean(std::initializer_list<T> &&rotations);
* */ * */
template <class T> class KarcherMeanFactor : public NonlinearFactor { template <class T> class KarcherMeanFactor : public NonlinearFactor {
// Compile time dimension: can be -1 // Compile time dimension: can be -1
enum { D = traits<T>::dimension }; inline constexpr static auto D = traits<T>::dimension;
// Runtime dimension: always >=0 // Runtime dimension: always >=0
size_t d_; size_t d_;

View File

@ -39,7 +39,7 @@ class GTSAM_UNSTABLE_EXPORT Event {
Point3 location_; ///< Location at time event was generated Point3 location_; ///< Location at time event was generated
public: public:
enum { dimension = 4 }; inline constexpr static auto dimension = 4;
/// Default Constructor /// Default Constructor
Event() : time_(0), location_(0, 0, 0) {} Event() : time_(0), location_(0, 0, 0) {}