GTSAM_CONCEPT_ASSERT to replace BOOST equivalent.

release/4.3a0
Frank Dellaert 2023-02-06 00:19:15 -08:00
parent a38d76bcef
commit eb37866e92
34 changed files with 147 additions and 144 deletions

View File

@ -166,7 +166,7 @@ Concept Checks
Boost provides a nice way to check whether a given type satisfies a concept. For example, the following Boost provides a nice way to check whether a given type satisfies a concept. For example, the following
BOOST_CONCEPT_ASSERT(IsVectorSpace<Point2>) GTSAM_CONCEPT_ASSERT(IsVectorSpace<Point2>)
asserts that Point2 indeed is a model for the VectorSpace concept. asserts that Point2 indeed is a model for the VectorSpace concept.

View File

@ -51,7 +51,7 @@ template<typename VALUE>
class FastSet: public std::set<VALUE, std::less<VALUE>, class FastSet: public std::set<VALUE, std::less<VALUE>,
typename internal::FastDefaultAllocator<VALUE>::type> { typename internal::FastDefaultAllocator<VALUE>::type> {
BOOST_CONCEPT_ASSERT ((IsTestable<VALUE> )); GTSAM_CONCEPT_ASSERT(IsTestable<VALUE>);
public: public:

View File

@ -52,8 +52,8 @@ public:
typedef typename traits<G>::group_flavor flavor_tag; typedef typename traits<G>::group_flavor flavor_tag;
//typedef typename traits<G>::identity::value_type identity_value_type; //typedef typename traits<G>::identity::value_type identity_value_type;
BOOST_CONCEPT_USAGE(IsGroup) { GTSAM_CONCEPT_USAGE(IsGroup) {
BOOST_STATIC_ASSERT_MSG( static_assert(
(std::is_base_of<group_tag, structure_category_tag>::value), (std::is_base_of<group_tag, structure_category_tag>::value),
"This type's structure_category trait does not assert it as a group (or derived)"); "This type's structure_category trait does not assert it as a group (or derived)");
e = traits<G>::Identity(); e = traits<G>::Identity();
@ -82,7 +82,7 @@ private:
/// Check invariants /// Check invariants
template<typename G> template<typename G>
BOOST_CONCEPT_REQUIRES(((IsGroup<G>)),(bool)) // GTSAM_CONCEPT_REQUIRES(IsGroup<G>,bool) //
check_group_invariants(const G& a, const G& b, double tol = 1e-9) { check_group_invariants(const G& a, const G& b, double tol = 1e-9) {
G e = traits<G>::Identity(); G e = traits<G>::Identity();
return traits<G>::Equals(traits<G>::Compose(a, traits<G>::Inverse(a)), e, tol) return traits<G>::Equals(traits<G>::Compose(a, traits<G>::Inverse(a)), e, tol)
@ -128,7 +128,7 @@ struct AdditiveGroup : AdditiveGroupTraits<Class>, Testable<Class> {};
/// compose multiple times /// compose multiple times
template<typename G> template<typename G>
BOOST_CONCEPT_REQUIRES(((IsGroup<G>)),(G)) // GTSAM_CONCEPT_REQUIRES(IsGroup<G>,G) //
compose_pow(const G& g, size_t n) { compose_pow(const G& g, size_t n) {
if (n == 0) return traits<G>::Identity(); if (n == 0) return traits<G>::Identity();
else if (n == 1) return g; else if (n == 1) return g;
@ -139,8 +139,8 @@ compose_pow(const G& g, size_t n) {
/// Assumes nothing except group structure and Testable from G and H /// Assumes nothing except group structure and Testable from G and H
template<typename G, typename H> template<typename G, typename H>
class DirectProduct: public std::pair<G, H> { class DirectProduct: public std::pair<G, H> {
BOOST_CONCEPT_ASSERT((IsGroup<G>)); GTSAM_CONCEPT_ASSERT1(IsGroup<G>);
BOOST_CONCEPT_ASSERT((IsGroup<H>)); GTSAM_CONCEPT_ASSERT2(IsGroup<H>);
public: public:
/// Default constructor yields identity /// Default constructor yields identity
@ -170,8 +170,8 @@ struct traits<DirectProduct<G, H> > :
/// Assumes existence of three additive operators for both groups /// Assumes existence of three additive operators for both groups
template<typename G, typename H> template<typename G, typename H>
class DirectSum: public std::pair<G, H> { class DirectSum: public std::pair<G, H> {
BOOST_CONCEPT_ASSERT((IsGroup<G>)); // TODO(frank): check additive GTSAM_CONCEPT_ASSERT1(IsGroup<G>); // TODO(frank): check additive
BOOST_CONCEPT_ASSERT((IsGroup<H>)); // TODO(frank): check additive GTSAM_CONCEPT_ASSERT2(IsGroup<H>); // TODO(frank): check additive
const G& g() const { return this->first; } const G& g() const { return this->first; }
const H& h() const { return this->second;} const H& h() const { return this->second;}

View File

@ -264,8 +264,8 @@ public:
typedef typename traits<T>::TangentVector TangentVector; typedef typename traits<T>::TangentVector TangentVector;
typedef typename traits<T>::ChartJacobian ChartJacobian; typedef typename traits<T>::ChartJacobian ChartJacobian;
BOOST_CONCEPT_USAGE(IsLieGroup) { GTSAM_CONCEPT_USAGE(IsLieGroup) {
BOOST_STATIC_ASSERT_MSG( static_assert(
(std::is_base_of<lie_group_tag, structure_category_tag>::value), (std::is_base_of<lie_group_tag, structure_category_tag>::value),
"This type's trait does not assert it is a Lie group (or derived)"); "This type's trait does not assert it is a Lie group (or derived)");

View File

@ -22,12 +22,7 @@
#include <gtsam/base/Matrix.h> #include <gtsam/base/Matrix.h>
#include <gtsam/base/Testable.h> #include <gtsam/base/Testable.h>
#include <gtsam/base/OptionalJacobian.h> #include <gtsam/base/OptionalJacobian.h>
#include <gtsam/base/concepts.h>
#ifdef GTSAM_USE_BOOST_FEATURES
#include <boost/concept_check.hpp>
#include <boost/concept/requires.hpp>
#include <boost/type_traits/is_base_of.hpp>
#endif
namespace gtsam { namespace gtsam {
@ -66,7 +61,7 @@ struct HasManifoldPrereqs {
Eigen::Matrix<double, dim, 1> v; Eigen::Matrix<double, dim, 1> v;
OptionalJacobian<dim, dim> Hp, Hq, Hv; OptionalJacobian<dim, dim> Hp, Hq, Hv;
BOOST_CONCEPT_USAGE(HasManifoldPrereqs) { GTSAM_CONCEPT_USAGE(HasManifoldPrereqs) {
v = p.localCoordinates(q); v = p.localCoordinates(q);
q = p.retract(v); q = p.retract(v);
} }
@ -97,7 +92,7 @@ template<class Class>
struct ManifoldTraits: GetDimensionImpl<Class, Class::dimension> { struct ManifoldTraits: GetDimensionImpl<Class, Class::dimension> {
// Check that Class has the necessary machinery // Check that Class has the necessary machinery
BOOST_CONCEPT_ASSERT((HasManifoldPrereqs<Class>)); GTSAM_CONCEPT_ASSERT(HasManifoldPrereqs<Class>);
// Dimension of the manifold // Dimension of the manifold
enum { dimension = Class::dimension }; enum { dimension = Class::dimension };
@ -125,7 +120,7 @@ template<class Class> struct Manifold: ManifoldTraits<Class>, Testable<Class> {}
/// Check invariants for Manifold type /// Check invariants for Manifold type
template<typename T> template<typename T>
BOOST_CONCEPT_REQUIRES(((IsTestable<T>)),(bool)) // GTSAM_CONCEPT_REQUIRES(IsTestable<T>, bool) //
check_manifold_invariants(const T& a, const T& b, double tol=1e-9) { check_manifold_invariants(const T& a, const T& b, double tol=1e-9) {
typename traits<T>::TangentVector v0 = traits<T>::Local(a,a); typename traits<T>::TangentVector v0 = traits<T>::Local(a,a);
typename traits<T>::TangentVector v = traits<T>::Local(a,b); typename traits<T>::TangentVector v = traits<T>::Local(a,b);
@ -144,11 +139,11 @@ public:
typedef typename traits<T>::ManifoldType ManifoldType; typedef typename traits<T>::ManifoldType ManifoldType;
typedef typename traits<T>::TangentVector TangentVector; typedef typename traits<T>::TangentVector TangentVector;
BOOST_CONCEPT_USAGE(IsManifold) { GTSAM_CONCEPT_USAGE(IsManifold) {
BOOST_STATIC_ASSERT_MSG( static_assert(
(std::is_base_of<manifold_tag, structure_category_tag>::value), (std::is_base_of<manifold_tag, structure_category_tag>::value),
"This type's structure_category trait does not assert it as a manifold (or derived)"); "This type's structure_category trait does not assert it as a manifold (or derived)");
BOOST_STATIC_ASSERT(TangentVector::SizeAtCompileTime == dim); static_assert(TangentVector::SizeAtCompileTime == dim);
// make sure Chart methods are defined // make sure Chart methods are defined
v = traits<T>::Local(p, q); v = traits<T>::Local(p, q);
@ -166,7 +161,7 @@ template<typename T>
struct FixedDimension { struct FixedDimension {
typedef const int value_type; typedef const int value_type;
static const int value = traits<T>::dimension; static const int value = traits<T>::dimension;
BOOST_STATIC_ASSERT_MSG(value != Eigen::Dynamic, static_assert(value != Eigen::Dynamic,
"FixedDimension instantiated for dymanically-sized type."); "FixedDimension instantiated for dymanically-sized type.");
}; };
} // \ namespace gtsam } // \ namespace gtsam

View File

@ -27,8 +27,8 @@ namespace gtsam {
/// Assumes Lie group structure for G and H /// Assumes Lie group structure for G and H
template<typename G, typename H> template<typename G, typename H>
class ProductLieGroup: public std::pair<G, H> { class ProductLieGroup: public std::pair<G, H> {
BOOST_CONCEPT_ASSERT((IsLieGroup<G>)); GTSAM_CONCEPT_ASSERT1(IsLieGroup<G>);
BOOST_CONCEPT_ASSERT((IsLieGroup<H>)); GTSAM_CONCEPT_ASSERT2(IsLieGroup<H>);
typedef std::pair<G, H> Base; typedef std::pair<G, H> Base;
protected: protected:

View File

@ -33,9 +33,7 @@
#pragma once #pragma once
#ifdef GTSAM_USE_BOOST_FEATURES #include <gtsam/base/concepts.h>
#include <boost/concept_check.hpp>
#endif
#include <functional> #include <functional>
#include <iostream> #include <iostream>
@ -63,7 +61,7 @@ namespace gtsam {
bool r1,r2; bool r1,r2;
public: public:
BOOST_CONCEPT_USAGE(IsTestable) { GTSAM_CONCEPT_USAGE(IsTestable) {
// check print function, with optional string // check print function, with optional string
traits<T>::Print(t, std::string()); traits<T>::Print(t, std::string());
traits<T>::Print(t); traits<T>::Print(t);
@ -136,7 +134,7 @@ namespace gtsam {
template<typename T> template<typename T>
struct HasTestablePrereqs { struct HasTestablePrereqs {
BOOST_CONCEPT_USAGE(HasTestablePrereqs) { GTSAM_CONCEPT_USAGE(HasTestablePrereqs) {
t->print(str); t->print(str);
b = t->equals(*s,tol); b = t->equals(*s,tol);
} }
@ -154,7 +152,7 @@ namespace gtsam {
struct Testable { struct Testable {
// Check that T has the necessary methods // Check that T has the necessary methods
BOOST_CONCEPT_ASSERT((HasTestablePrereqs<T>)); GTSAM_CONCEPT_ASSERT(HasTestablePrereqs<T>);
static void Print(const T& m, const std::string& str = "") { static void Print(const T& m, const std::string& str = "") {
m.print(str); m.print(str);
@ -173,7 +171,7 @@ namespace gtsam {
* *
* NOTE: intentionally not in the gtsam namespace to allow for classes not in * NOTE: intentionally not in the gtsam namespace to allow for classes not in
* the gtsam namespace to be more easily enforced as testable * the gtsam namespace to be more easily enforced as testable
* @deprecated please use BOOST_CONCEPT_ASSERT and * @deprecated please use GTSAM_CONCEPT_ASSERT and
*/ */
#define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable<T>; #define GTSAM_CONCEPT_TESTABLE_INST(T) template class gtsam::IsTestable<T>;
#define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable<T>; #define GTSAM_CONCEPT_TESTABLE_TYPE(T) using _gtsam_Testable_##T = gtsam::IsTestable<T>;

View File

@ -168,7 +168,7 @@ struct HasVectorSpacePrereqs {
Class p, q; Class p, q;
Vector v; Vector v;
BOOST_CONCEPT_USAGE(HasVectorSpacePrereqs) { GTSAM_CONCEPT_USAGE(HasVectorSpacePrereqs) {
p = Class::Identity(); // identity p = Class::Identity(); // identity
q = p + p; // addition q = p + p; // addition
q = p - p; // subtraction q = p - p; // subtraction
@ -185,7 +185,7 @@ template<class Class>
struct VectorSpaceTraits: VectorSpaceImpl<Class, Class::dimension> { struct VectorSpaceTraits: VectorSpaceImpl<Class, Class::dimension> {
// Check that Class has the necessary machinery // Check that Class has the necessary machinery
BOOST_CONCEPT_ASSERT((HasVectorSpacePrereqs<Class>)); GTSAM_CONCEPT_ASSERT(HasVectorSpacePrereqs<Class>);
typedef vector_space_tag structure_category; typedef vector_space_tag structure_category;
@ -472,8 +472,8 @@ public:
typedef typename traits<T>::structure_category structure_category_tag; typedef typename traits<T>::structure_category structure_category_tag;
BOOST_CONCEPT_USAGE(IsVectorSpace) { GTSAM_CONCEPT_USAGE(IsVectorSpace) {
BOOST_STATIC_ASSERT_MSG( static_assert(
(std::is_base_of<vector_space_tag, structure_category_tag>::value), (std::is_base_of<vector_space_tag, structure_category_tag>::value),
"This type's trait does not assert it as a vector space (or derived)"); "This type's trait does not assert it as a vector space (or derived)");
r = p + q; r = p + q;

View File

@ -39,7 +39,7 @@ void testDefaultChart(TestResult& result_,
// First, check the basic chart concept. This checks that the interface is satisfied. // First, check the basic chart concept. This checks that the interface is satisfied.
// The rest of the function is even more detailed, checking the correctness of the chart. // The rest of the function is even more detailed, checking the correctness of the chart.
BOOST_CONCEPT_ASSERT((ChartConcept<Chart>)); GTSAM_CONCEPT_ASSERT(ChartConcept<Chart>);
T other = value; T other = value;

View File

@ -8,28 +8,22 @@
#pragma once #pragma once
// This is a helper to ease the transition to the new traits defined in this file.
// Uncomment this if you want all methods that are tagged as not implemented
// to cause compilation errors.
#ifdef COMPILE_ERROR_NOT_IMPLEMENTED
#ifdef GTSAM_USE_BOOST_FEATURES #ifdef GTSAM_USE_BOOST_FEATURES
#include <boost/static_assert.hpp> #include <boost/concept_check.hpp>
#endif #define GTSAM_CONCEPT_USAGE(concept) BOOST_CONCEPT_USAGE((concept))
#define GTSAM_CONCEPT_ASSERT(concept) BOOST_CONCEPT_ASSERT((concept))
#define CONCEPT_NOT_IMPLEMENTED BOOST_STATIC_ASSERT_MSG(boost::false_type, \ #define GTSAM_CONCEPT_ASSERT1(concept) BOOST_CONCEPT_ASSERT((concept))
"This method is required by the new concepts framework but has not been implemented yet."); #define GTSAM_CONCEPT_ASSERT2(concept) BOOST_CONCEPT_ASSERT((concept))
#define GTSAM_CONCEPT_ASSERT3(concept) BOOST_CONCEPT_ASSERT((concept))
#define GTSAM_CONCEPT_REQUIRES(concept, return_type) BOOST_CONCEPT_REQUIRES((concept), (return_type))
#else #else
// These do something sensible:
#include <exception> #define GTSAM_CONCEPT_USAGE(concept) void check##concept()
#define CONCEPT_NOT_IMPLEMENTED \ #define GTSAM_CONCEPT_ASSERT(concept) concept checkConcept [[maybe_unused]];
throw std::runtime_error("This method is required by the new concepts framework but has not been implemented yet."); #define GTSAM_CONCEPT_ASSERT1(concept) concept checkConcept1 [[maybe_unused]];
#define GTSAM_CONCEPT_ASSERT2(concept) concept checkConcept2 [[maybe_unused]];
#define GTSAM_CONCEPT_ASSERT3(concept) concept checkConcept3 [[maybe_unused]];
// This one just ignores concept for now:
#define GTSAM_CONCEPT_REQUIRES(concept, return_type) return_type
#endif #endif
namespace gtsam {
template <typename T> struct traits;
}

View File

@ -80,7 +80,7 @@ using namespace gtsam;
typedef Symmetric<2> S2; typedef Symmetric<2> S2;
TEST(Group, S2) { TEST(Group, S2) {
S2 e, s1 = S2::Transposition(0, 1); S2 e, s1 = S2::Transposition(0, 1);
BOOST_CONCEPT_ASSERT((IsGroup<S2>)); GTSAM_CONCEPT_ASSERT(IsGroup<S2>);
EXPECT(check_group_invariants(e, s1)); EXPECT(check_group_invariants(e, s1));
} }
@ -88,7 +88,7 @@ TEST(Group, S2) {
typedef Symmetric<3> S3; typedef Symmetric<3> S3;
TEST(Group, S3) { TEST(Group, S3) {
S3 e, s1 = S3::Transposition(0, 1), s2 = S3::Transposition(1, 2); S3 e, s1 = S3::Transposition(0, 1), s2 = S3::Transposition(1, 2);
BOOST_CONCEPT_ASSERT((IsGroup<S3>)); GTSAM_CONCEPT_ASSERT(IsGroup<S3>);
EXPECT(check_group_invariants(e, s1)); EXPECT(check_group_invariants(e, s1));
EXPECT(assert_equal(s1, s1 * e)); EXPECT(assert_equal(s1, s1 * e));
EXPECT(assert_equal(s1, e * s1)); EXPECT(assert_equal(s1, e * s1));
@ -127,7 +127,7 @@ struct traits<Dih6> : internal::MultiplicativeGroupTraits<Dih6> {
TEST(Group, Dih6) { TEST(Group, Dih6) {
Dih6 e, g(S2::Transposition(0, 1), Dih6 e, g(S2::Transposition(0, 1),
S3::Transposition(0, 1) * S3::Transposition(1, 2)); S3::Transposition(0, 1) * S3::Transposition(1, 2));
BOOST_CONCEPT_ASSERT((IsGroup<Dih6>)); GTSAM_CONCEPT_ASSERT(IsGroup<Dih6>);
EXPECT(check_group_invariants(e, g)); EXPECT(check_group_invariants(e, g));
EXPECT(assert_equal(e, compose_pow(g, 0))); EXPECT(assert_equal(e, compose_pow(g, 0)));
EXPECT(assert_equal(g, compose_pow(g, 1))); EXPECT(assert_equal(g, compose_pow(g, 1)));

View File

@ -1146,17 +1146,30 @@ TEST(Matrix, DLT )
} }
//****************************************************************************** //******************************************************************************
TEST(Matrix , IsVectorSpace) { TEST(Matrix, Matrix24IsVectorSpace) {
BOOST_CONCEPT_ASSERT((IsVectorSpace<Matrix24>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<Matrix24>);
typedef Eigen::Matrix<double,2,3,Eigen::RowMajor> RowMajor;
BOOST_CONCEPT_ASSERT((IsVectorSpace<RowMajor>));
BOOST_CONCEPT_ASSERT((IsVectorSpace<Matrix>));
BOOST_CONCEPT_ASSERT((IsVectorSpace<Vector>));
typedef Eigen::Matrix<double,1,-1> RowVector;
BOOST_CONCEPT_ASSERT((IsVectorSpace<RowVector>));
BOOST_CONCEPT_ASSERT((IsVectorSpace<Vector5>));
} }
TEST(Matrix, RowMajorIsVectorSpace) {
typedef Eigen::Matrix<double, 2, 3, Eigen::RowMajor> RowMajor;
GTSAM_CONCEPT_ASSERT(IsVectorSpace<RowMajor>);
}
TEST(Matrix, MatrixIsVectorSpace) {
GTSAM_CONCEPT_ASSERT(IsVectorSpace<Matrix>);
}
TEST(Matrix, VectorIsVectorSpace) {
GTSAM_CONCEPT_ASSERT(IsVectorSpace<Vector>);
}
TEST(Matrix, RowVectorIsVectorSpace) {
typedef Eigen::Matrix<double, 1, -1> RowVector;
GTSAM_CONCEPT_ASSERT1(IsVectorSpace<RowVector>);
GTSAM_CONCEPT_ASSERT2(IsVectorSpace<Vector5>);
}
//******************************************************************************
TEST(Matrix, AbsoluteError) { TEST(Matrix, AbsoluteError) {
double a = 2000, b = 1997, tol = 1e-1; double a = 2000, b = 1997, tol = 1e-1;
bool isEqual; bool isEqual;

View File

@ -266,11 +266,14 @@ TEST(Vector, linear_dependent3 )
} }
//****************************************************************************** //******************************************************************************
TEST(Vector, IsVectorSpace) { TEST(Vector, VectorIsVectorSpace) {
BOOST_CONCEPT_ASSERT((IsVectorSpace<Vector5>)); GTSAM_CONCEPT_ASSERT1(IsVectorSpace<Vector5>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<Vector>)); GTSAM_CONCEPT_ASSERT2(IsVectorSpace<Vector>);
}
TEST(Vector, RowVectorIsVectorSpace) {
typedef Eigen::Matrix<double,1,-1> RowVector; typedef Eigen::Matrix<double,1,-1> RowVector;
BOOST_CONCEPT_ASSERT((IsVectorSpace<RowVector>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<RowVector>);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -34,7 +34,7 @@ BearingRange3D br3D(Pose3().bearing(Point3(1, 0, 0)), 1);
//****************************************************************************** //******************************************************************************
TEST(BearingRange2D, Concept) { TEST(BearingRange2D, Concept) {
BOOST_CONCEPT_ASSERT((IsManifold<BearingRange2D>)); GTSAM_CONCEPT_ASSERT(IsManifold<BearingRange2D>);
} }
/* ************************************************************************* */ /* ************************************************************************* */
@ -46,7 +46,7 @@ TEST(BearingRange, 2D) {
//****************************************************************************** //******************************************************************************
TEST(BearingRange3D, Concept) { TEST(BearingRange3D, Concept) {
BOOST_CONCEPT_ASSERT((IsManifold<BearingRange3D>)); GTSAM_CONCEPT_ASSERT(IsManifold<BearingRange3D>);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -27,7 +27,7 @@ typedef Cyclic<2> Z2;
//****************************************************************************** //******************************************************************************
TEST(Cyclic, Concept) { TEST(Cyclic, Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Z3>)); GTSAM_CONCEPT_ASSERT(IsGroup<Z3>);
EXPECT_LONGS_EQUAL(0, traits<Z3>::Identity()); EXPECT_LONGS_EQUAL(0, traits<Z3>::Identity());
} }
@ -107,8 +107,8 @@ struct traits<K4> : internal::AdditiveGroupTraits<K4> {
TEST(Cyclic , DirectSum) { TEST(Cyclic , DirectSum) {
// The Direct sum of Z2 and Z2 is *not* Cyclic<4>, but the // The Direct sum of Z2 and Z2 is *not* Cyclic<4>, but the
// smallest non-cyclic group called the Klein four-group: // smallest non-cyclic group called the Klein four-group:
BOOST_CONCEPT_ASSERT((IsGroup<K4>)); GTSAM_CONCEPT_ASSERT1(IsGroup<K4>);
BOOST_CONCEPT_ASSERT((IsTestable<K4>)); GTSAM_CONCEPT_ASSERT2(IsTestable<K4>);
// Refer to http://en.wikipedia.org/wiki/Klein_four-group // Refer to http://en.wikipedia.org/wiki/Klein_four-group
K4 e(0,0), a(0, 1), b(1, 0), c(1, 1); K4 e(0,0), a(0, 1), b(1, 0), c(1, 1);

View File

@ -34,9 +34,9 @@ TEST(Point2 , Constructor) {
//****************************************************************************** //******************************************************************************
TEST(Double , Concept) { TEST(Double , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<double>)); GTSAM_CONCEPT_ASSERT1(IsGroup<double>);
BOOST_CONCEPT_ASSERT((IsManifold<double>)); GTSAM_CONCEPT_ASSERT2(IsManifold<double>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<double>)); GTSAM_CONCEPT_ASSERT3(IsVectorSpace<double>);
} }
//****************************************************************************** //******************************************************************************
@ -48,9 +48,9 @@ TEST(Double , Invariants) {
//****************************************************************************** //******************************************************************************
TEST(Point2 , Concept) { TEST(Point2 , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Point2>)); GTSAM_CONCEPT_ASSERT1(IsGroup<Point2>);
BOOST_CONCEPT_ASSERT((IsManifold<Point2>)); GTSAM_CONCEPT_ASSERT2(IsManifold<Point2>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<Point2>)); GTSAM_CONCEPT_ASSERT3(IsVectorSpace<Point2>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -34,9 +34,9 @@ TEST(Point3 , Constructor) {
//****************************************************************************** //******************************************************************************
TEST(Point3 , Concept) { TEST(Point3 , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Point3>)); GTSAM_CONCEPT_ASSERT1(IsGroup<Point3>);
BOOST_CONCEPT_ASSERT((IsManifold<Point3>)); GTSAM_CONCEPT_ASSERT2(IsManifold<Point3>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<Point3>)); GTSAM_CONCEPT_ASSERT3(IsVectorSpace<Point3>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -35,9 +35,9 @@ GTSAM_CONCEPT_LIE_INST(Pose2)
//****************************************************************************** //******************************************************************************
TEST(Pose2 , Concept) { TEST(Pose2 , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Pose2 >)); GTSAM_CONCEPT_ASSERT1(IsGroup<Pose2 >);
BOOST_CONCEPT_ASSERT((IsManifold<Pose2 >)); GTSAM_CONCEPT_ASSERT2(IsManifold<Pose2 >);
BOOST_CONCEPT_ASSERT((IsLieGroup<Pose2 >)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Pose2 >);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -29,9 +29,9 @@ typedef traits<Q>::ChartJacobian QuaternionJacobian;
//****************************************************************************** //******************************************************************************
TEST(Quaternion , Concept) { TEST(Quaternion , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Quaternion >)); GTSAM_CONCEPT_ASSERT1(IsGroup<Quaternion >);
BOOST_CONCEPT_ASSERT((IsManifold<Quaternion >)); GTSAM_CONCEPT_ASSERT2(IsManifold<Quaternion >);
BOOST_CONCEPT_ASSERT((IsLieGroup<Quaternion >)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Quaternion >);
} }
//****************************************************************************** //******************************************************************************

View File

@ -38,9 +38,9 @@ static double error = 1e-9, epsilon = 0.001;
//****************************************************************************** //******************************************************************************
TEST(Rot3 , Concept) { TEST(Rot3 , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<Rot3 >)); GTSAM_CONCEPT_ASSERT1(IsGroup<Rot3 >);
BOOST_CONCEPT_ASSERT((IsManifold<Rot3 >)); GTSAM_CONCEPT_ASSERT2(IsManifold<Rot3 >);
BOOST_CONCEPT_ASSERT((IsLieGroup<Rot3 >)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Rot3 >);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -36,9 +36,9 @@ TEST(SO3, Identity) {
//****************************************************************************** //******************************************************************************
TEST(SO3, Concept) { TEST(SO3, Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<SO3>)); GTSAM_CONCEPT_ASSERT1(IsGroup<SO3>);
BOOST_CONCEPT_ASSERT((IsManifold<SO3>)); GTSAM_CONCEPT_ASSERT2(IsManifold<SO3>);
BOOST_CONCEPT_ASSERT((IsLieGroup<SO3>)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<SO3>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -42,9 +42,9 @@ TEST(SO4, Identity) {
//****************************************************************************** //******************************************************************************
TEST(SO4, Concept) { TEST(SO4, Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<SO4>)); GTSAM_CONCEPT_ASSERT1(IsGroup<SO4>);
BOOST_CONCEPT_ASSERT((IsManifold<SO4>)); GTSAM_CONCEPT_ASSERT2(IsManifold<SO4>);
BOOST_CONCEPT_ASSERT((IsLieGroup<SO4>)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<SO4>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -84,9 +84,9 @@ TEST(SOn, SO5) {
//****************************************************************************** //******************************************************************************
TEST(SOn, Concept) { TEST(SOn, Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<SOn>)); GTSAM_CONCEPT_ASSERT1(IsGroup<SOn>);
BOOST_CONCEPT_ASSERT((IsManifold<SOn>)); GTSAM_CONCEPT_ASSERT2(IsManifold<SOn>);
BOOST_CONCEPT_ASSERT((IsLieGroup<SOn>)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<SOn>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -35,9 +35,9 @@ static const double s = 4;
//****************************************************************************** //******************************************************************************
TEST(Similarity2, Concepts) { TEST(Similarity2, Concepts) {
BOOST_CONCEPT_ASSERT((IsGroup<Similarity2>)); GTSAM_CONCEPT_ASSERT1(IsGroup<Similarity2>);
BOOST_CONCEPT_ASSERT((IsManifold<Similarity2>)); GTSAM_CONCEPT_ASSERT2(IsManifold<Similarity2>);
BOOST_CONCEPT_ASSERT((IsLieGroup<Similarity2>)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Similarity2>);
} }
//****************************************************************************** //******************************************************************************

View File

@ -54,9 +54,9 @@ const double degree = M_PI / 180;
//****************************************************************************** //******************************************************************************
TEST(Similarity3, Concepts) { TEST(Similarity3, Concepts) {
BOOST_CONCEPT_ASSERT((IsGroup<Similarity3 >)); GTSAM_CONCEPT_ASSERT1(IsGroup<Similarity3 >);
BOOST_CONCEPT_ASSERT((IsManifold<Similarity3 >)); GTSAM_CONCEPT_ASSERT2(IsManifold<Similarity3 >);
BOOST_CONCEPT_ASSERT((IsLieGroup<Similarity3 >)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Similarity3 >);
} }
//****************************************************************************** //******************************************************************************

View File

@ -31,9 +31,9 @@ GTSAM_CONCEPT_TESTABLE_INST(StereoPoint2)
//****************************************************************************** //******************************************************************************
TEST(StereoPoint2 , Concept) { TEST(StereoPoint2 , Concept) {
BOOST_CONCEPT_ASSERT((IsGroup<StereoPoint2>)); GTSAM_CONCEPT_ASSERT1(IsGroup<StereoPoint2>);
BOOST_CONCEPT_ASSERT((IsManifold<StereoPoint2 >)); GTSAM_CONCEPT_ASSERT2(IsManifold<StereoPoint2 >);
BOOST_CONCEPT_ASSERT((IsVectorSpace<StereoPoint2>)); GTSAM_CONCEPT_ASSERT3(IsVectorSpace<StereoPoint2>);
} }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -218,7 +218,7 @@ protected:
template <typename T> template <typename T>
class ScalarMultiplyExpression : public Expression<T> { class ScalarMultiplyExpression : public Expression<T> {
// Check that T is a vector space // Check that T is a vector space
BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace<T>)); GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace<T>);
public: public:
explicit ScalarMultiplyExpression(double s, const Expression<T>& e); explicit ScalarMultiplyExpression(double s, const Expression<T>& e);
@ -231,7 +231,7 @@ class ScalarMultiplyExpression : public Expression<T> {
template <typename T> template <typename T>
class BinarySumExpression : public Expression<T> { class BinarySumExpression : public Expression<T> {
// Check that T is a vector space // Check that T is a vector space
BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace<T>)); GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace<T>);
public: public:
explicit BinarySumExpression(const Expression<T>& e1, const Expression<T>& e2); explicit BinarySumExpression(const Expression<T>& e1, const Expression<T>& e2);

View File

@ -42,7 +42,7 @@ namespace gtsam {
*/ */
template <typename T> template <typename T>
class ExpressionFactor : public NoiseModelFactor { class ExpressionFactor : public NoiseModelFactor {
BOOST_CONCEPT_ASSERT((IsTestable<T>)); GTSAM_CONCEPT_ASSERT(IsTestable<T>);
protected: protected:

View File

@ -44,8 +44,8 @@ namespace gtsam {
template <class VALUE> template <class VALUE>
class ExtendedKalmanFilter { class ExtendedKalmanFilter {
// Check that VALUE type is a testable Manifold // Check that VALUE type is a testable Manifold
BOOST_CONCEPT_ASSERT((IsTestable<VALUE>)); GTSAM_CONCEPT_ASSERT1(IsTestable<VALUE>);
BOOST_CONCEPT_ASSERT((IsManifold<VALUE>)); GTSAM_CONCEPT_ASSERT2(IsManifold<VALUE>);
public: public:
typedef std::shared_ptr<ExtendedKalmanFilter<VALUE> > shared_ptr; typedef std::shared_ptr<ExtendedKalmanFilter<VALUE> > shared_ptr;

View File

@ -38,7 +38,7 @@ T & upAlign(T & value, unsigned requiredAlignment = TraceAlignment) {
// right now only word sized types are supported. // right now only word sized types are supported.
// Easy to extend if needed, // Easy to extend if needed,
// by somehow inferring the unsigned integer of same size // by somehow inferring the unsigned integer of same size
BOOST_STATIC_ASSERT(sizeof(T) == sizeof(size_t)); static_assert(sizeof(T) == sizeof(size_t));
size_t & uiValue = reinterpret_cast<size_t &>(value); size_t & uiValue = reinterpret_cast<size_t &>(value);
size_t misAlignment = uiValue % requiredAlignment; size_t misAlignment = uiValue % requiredAlignment;
if (misAlignment) { if (misAlignment) {
@ -559,7 +559,7 @@ public:
template <class T> template <class T>
class ScalarMultiplyNode : public ExpressionNode<T> { class ScalarMultiplyNode : public ExpressionNode<T> {
// Check that T is a vector space // Check that T is a vector space
BOOST_CONCEPT_ASSERT((gtsam::IsVectorSpace<T>)); GTSAM_CONCEPT_ASSERT(gtsam::IsVectorSpace<T>);
double scalar_; double scalar_;
std::shared_ptr<ExpressionNode<T> > expression_; std::shared_ptr<ExpressionNode<T> > expression_;

View File

@ -35,7 +35,7 @@ namespace gtsam {
template <class T> class BinaryMeasurement : public Factor { template <class T> class BinaryMeasurement : public Factor {
// Check that T type is testable // Check that T type is testable
BOOST_CONCEPT_ASSERT((IsTestable<T>)); GTSAM_CONCEPT_ASSERT(IsTestable<T>);
public: public:
// shorthand for a smart pointer to a measurement // shorthand for a smart pointer to a measurement

View File

@ -40,8 +40,8 @@ namespace gtsam {
class BetweenFactor: public NoiseModelFactorN<VALUE, VALUE> { class BetweenFactor: public NoiseModelFactorN<VALUE, VALUE> {
// Check that VALUE type is a testable Lie group // Check that VALUE type is a testable Lie group
BOOST_CONCEPT_ASSERT((IsTestable<VALUE>)); GTSAM_CONCEPT_ASSERT1(IsTestable<VALUE>);
BOOST_CONCEPT_ASSERT((IsLieGroup<VALUE>)); GTSAM_CONCEPT_ASSERT2(IsLieGroup<VALUE>);
public: public:

View File

@ -47,9 +47,9 @@ template<> struct traits<Product> : internal::LieGroupTraits<Product> {
//****************************************************************************** //******************************************************************************
TEST(Lie, ProductLieGroup) { TEST(Lie, ProductLieGroup) {
BOOST_CONCEPT_ASSERT((IsGroup<Product>)); GTSAM_CONCEPT_ASSERT1(IsGroup<Product>);
BOOST_CONCEPT_ASSERT((IsManifold<Product>)); GTSAM_CONCEPT_ASSERT2(IsManifold<Product>);
BOOST_CONCEPT_ASSERT((IsLieGroup<Product>)); GTSAM_CONCEPT_ASSERT3(IsLieGroup<Product>);
Product pair1; Product pair1;
Vector5 d; Vector5 d;
d << 1, 2, 0.1, 0.2, 0.3; d << 1, 2, 0.1, 0.2, 0.3;

View File

@ -37,27 +37,27 @@ typedef PinholeCamera<Cal3Bundler> Camera;
//****************************************************************************** //******************************************************************************
TEST(Manifold, SomeManifoldsGTSAM) { TEST(Manifold, SomeManifoldsGTSAM) {
//BOOST_CONCEPT_ASSERT((IsManifold<int>)); // integer is not a manifold //GTSAM_CONCEPT_ASSERT(IsManifold<int>); // integer is not a manifold
BOOST_CONCEPT_ASSERT((IsManifold<Camera>)); GTSAM_CONCEPT_ASSERT(IsManifold<Camera>);
BOOST_CONCEPT_ASSERT((IsManifold<Cal3_S2>)); GTSAM_CONCEPT_ASSERT(IsManifold<Cal3_S2>);
BOOST_CONCEPT_ASSERT((IsManifold<Cal3Bundler>)); GTSAM_CONCEPT_ASSERT(IsManifold<Cal3Bundler>);
BOOST_CONCEPT_ASSERT((IsManifold<Camera>)); GTSAM_CONCEPT_ASSERT(IsManifold<Camera>);
} }
//****************************************************************************** //******************************************************************************
TEST(Manifold, SomeLieGroupsGTSAM) { TEST(Manifold, SomeLieGroupsGTSAM) {
BOOST_CONCEPT_ASSERT((IsLieGroup<Rot2>)); GTSAM_CONCEPT_ASSERT(IsLieGroup<Rot2>);
BOOST_CONCEPT_ASSERT((IsLieGroup<Pose2>)); GTSAM_CONCEPT_ASSERT(IsLieGroup<Pose2>);
BOOST_CONCEPT_ASSERT((IsLieGroup<Rot3>)); GTSAM_CONCEPT_ASSERT(IsLieGroup<Rot3>);
BOOST_CONCEPT_ASSERT((IsLieGroup<Pose3>)); GTSAM_CONCEPT_ASSERT(IsLieGroup<Pose3>);
} }
//****************************************************************************** //******************************************************************************
TEST(Manifold, SomeVectorSpacesGTSAM) { TEST(Manifold, SomeVectorSpacesGTSAM) {
BOOST_CONCEPT_ASSERT((IsVectorSpace<double>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<double>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<float>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<float>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<Point2>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<Point2>);
BOOST_CONCEPT_ASSERT((IsVectorSpace<Matrix24>)); GTSAM_CONCEPT_ASSERT(IsVectorSpace<Matrix24>);
} }
//****************************************************************************** //******************************************************************************