diff --git a/.cproject b/.cproject index 617aa3795..f45c2d690 100644 --- a/.cproject +++ b/.cproject @@ -592,7 +592,6 @@ make - tests/testBayesTree.run true false @@ -600,7 +599,6 @@ make - testBinaryBayesNet.run true false @@ -648,7 +646,6 @@ make - testSymbolicBayesNet.run true false @@ -656,7 +653,6 @@ make - tests/testSymbolicFactor.run true false @@ -664,7 +660,6 @@ make - testSymbolicFactorGraph.run true false @@ -680,7 +675,6 @@ make - tests/testBayesTree true false @@ -1136,7 +1130,6 @@ make - testErrors.run true false @@ -1366,46 +1359,6 @@ true true - - make - -j5 - testBTree.run - true - true - true - - - make - -j5 - testDSF.run - true - true - true - - - make - -j5 - testDSFMap.run - true - true - true - - - make - -j5 - testDSFVector.run - true - true - true - - - make - -j5 - testFixedVector.run - true - true - true - make -j2 @@ -1488,6 +1441,7 @@ make + testSimulated2DOriented.run true false @@ -1527,6 +1481,7 @@ make + testSimulated2D.run true false @@ -1534,6 +1489,7 @@ make + testSimulated3D.run true false @@ -1547,6 +1503,46 @@ true true + + make + -j5 + testBTree.run + true + true + true + + + make + -j5 + testDSF.run + true + true + true + + + make + -j5 + testDSFMap.run + true + true + true + + + make + -j5 + testDSFVector.run + true + true + true + + + make + -j5 + testFixedVector.run + true + true + true + make -j5 @@ -1804,7 +1800,6 @@ cpack - -G DEB true false @@ -1812,7 +1807,6 @@ cpack - -G RPM true false @@ -1820,7 +1814,6 @@ cpack - -G TGZ true false @@ -1828,7 +1821,6 @@ cpack - --config CPackSourceConfig.cmake true false @@ -2185,6 +2177,14 @@ true true + + make + -j4 + testCyclic.run + true + true + true + make -j2 @@ -2683,7 +2683,6 @@ make - testGraph.run true false @@ -2691,7 +2690,6 @@ make - testJunctionTree.run true false @@ -2699,7 +2697,6 @@ make - testSymbolicBayesNetB.run true false @@ -3251,6 +3248,7 @@ make + tests/testGaussianISAM2 true false diff --git a/gtsam/base/concepts.h b/gtsam/base/concepts.h index cc86d98ac..967a91707 100644 --- a/gtsam/base/concepts.h +++ b/gtsam/base/concepts.h @@ -1,57 +1,62 @@ /* * concepts.h * - * Created on: Dec 4, 2014 - * Author: mike bosse + * @data Dec 4, 2014 + * @author Mike Bosse + * @author Frank Dellaert */ -#ifndef CONCEPTS_H_ -#define CONCEPTS_H_ +#pragma once -#include "manifold.h" -#include "chart.h" -#include +//#include "manifold.h" +//#include "chart.h" +#include +#include +#include namespace gtsam { namespace traits { -template -struct TangentVector { - //typedef XXX type; -}; - -// used to identify the manifold associated with a chart -template -struct Manifold { - //typedef XXX type; -}; - -template -struct DefaultChart { - //typedef XXX type; -}; - +/** + * @name Algebraic Structure Traits + * @brief Associate a unique tag with each of the main GTSAM concepts + */ +//@{ template -struct structure {}; // specializations should be derived from one of the following tags +struct structure_category {}; // specializations should be derived from one of the following tags +//@} + +/** + * @name Algebraic Structure Tags + * @brief Possible values for traits::structure_category::type + */ +//@{ struct manifold_tag {}; struct group_tag {}; struct lie_group_tag : public manifold_tag, public group_tag {}; struct vector_space_tag : public lie_group_tag {}; - -template -struct group_flavor {}; -struct additive_group_tag {}; -struct multiplicative_group_tag {}; +//@} } // namespace traits +namespace traits { + +/** @name Manifold Traits */ +//@{ +template struct TangentVector; +template struct DefaultChart; +//@} + +} // namespace traits + +/* template class ManifoldConcept { public: typedef T Manifold; - typedef traits::TangentVector::type TangentVector; - typedef traits::DefaultChart::type DefaultChart; + typedef typename traits::TangentVector::type TangentVector; + typedef typename traits::DefaultChart::type DefaultChart; static const size_t dim = traits::dimension::value; BOOST_CONCEPT_USAGE(ManifoldConcept) { @@ -81,6 +86,23 @@ class ChartConcept { TangentVector v; }; +*/ + +namespace traits { + +/** @name Group Traits */ +//@{ +template struct identity {}; +template struct group_flavor {}; +//@} + +/** @name Group Flavor Tags */ +//@{ +struct additive_group_tag {}; +struct multiplicative_group_tag {}; +//@} + +} // namespace traits template class GroupConcept { @@ -89,23 +111,24 @@ class GroupConcept { static const Group identity = traits::identity::value; BOOST_CONCEPT_USAGE(GroupConcept) { - BOOST_STATIC_ASSERT(boost::is_base_of >); + BOOST_STATIC_ASSERT(boost::is_base_of::type>::value ); Group ip = inverse(p); Group pq = compose(p, q); Group d = between(p, q); - bool test = equal(p, q); - bool test2 = operator_usage(p, q, traits::group_flavor); + test = equal(p, q); + test2 = operator_usage(p, q, traits::group_flavor::type); } bool check_invariants(const Group& a, const Group& b) { return (equal(compose(a, inverse(a)), identity)) && (equal(between(a, b), compose(inverse(a), b))) && (equal(compose(a, between(a, b)), b)) - && operator_usage(a, b, traits::group_flavor); + && operator_usage(a, b, traits::group_flavor::type); } private: Group p,q; + bool test, test2; bool operator_usage(const Group& a, const Group& b, const traits::multiplicative_group_tag&) { return equal(compose(a, b), a*b); @@ -116,7 +139,7 @@ class GroupConcept { } }; - +/* template class LieGroupConcept : public GroupConcept, public ManifoldConcept { @@ -127,8 +150,8 @@ class LieGroupConcept : public GroupConcept, public ManifoldConcept { template class VectorSpaceConcept : public LieGroupConcept { - typedef traits::DefaultChart::type Chart; - typedef GroupConcept::identity identity; + typedef typename traits::DefaultChart::type Chart; + typedef typename GroupConcept::identity identity; BOOST_CONCEPT_USAGE(VectorSpaceConcept) { BOOST_STATIC_ASSERT(boost::is_base_of >); @@ -148,7 +171,8 @@ class VectorSpaceConcept : public LieGroupConcept { private: V p,q,r; }; +*/ } // namespace gtsam -#endif /* CONCEPTS_H_ */ + diff --git a/gtsam/geometry/tests/testCyclic.cpp b/gtsam/geometry/tests/testCyclic.cpp new file mode 100644 index 000000000..f15654b2e --- /dev/null +++ b/gtsam/geometry/tests/testCyclic.cpp @@ -0,0 +1,67 @@ +/* ---------------------------------------------------------------------------- + + * GTSAM Copyright 2010, Georgia Tech Research Corporation, + * Atlanta, Georgia 30332-0415 + * All Rights Reserved + * Authors: Frank Dellaert, et al. (see THANKS for the full author list) + + * See LICENSE for the license information + + * -------------------------------------------------------------------------- */ + +/** + * @file testCyclic.cpp + * @brief Unit tests for cyclic group + * @author Frank Dellaert + **/ + +#include +#include + +namespace gtsam { + +template +class Cyclic { + size_t i_; +public: + static const Cyclic Identity = Cyclic(0); + Cyclic(size_t i) : + i_(i) { + } +}; + +namespace traits { +template struct identity > { + static const Cyclic value = Cyclic::Identity; + typedef Cyclic value_type; +}; +template struct group_flavor > { + typedef additive_group_tag type; +}; +} // \namespace traits + +} // \namespace gtsam + +//#include +#include +#include + +using namespace std; +using namespace gtsam; + +BOOST_CONCEPT_ASSERT((GroupConcept >)); + +/* ************************************************************************* */ +TEST(Cyclic, Constructor) { +Cyclic<6> g(0); +// EXPECT(assert_equal(p1, p2)); +// EXPECT_LONGS_EQUAL(2,offset2.size()); +} + +/* ************************************************************************* */ +int main() { +TestResult tr; +return TestRegistry::runAllTests(tr); +} +/* ************************************************************************* */ +