From 2c235d98beede725ce279b96ee5ab5d1f9f5e16f Mon Sep 17 00:00:00 2001 From: dellaert Date: Sun, 24 May 2015 15:32:20 -0700 Subject: [PATCH] Formatting and comments only --- gtsam/base/Group.h | 35 +++++++++++++---------------------- gtsam/base/Manifold.h | 2 +- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/gtsam/base/Group.h b/gtsam/base/Group.h index 16c1e6a23..8a1d69848 100644 --- a/gtsam/base/Group.h +++ b/gtsam/base/Group.h @@ -121,12 +121,9 @@ struct AdditiveGroupTraits : GroupTraits { template BOOST_CONCEPT_REQUIRES(((IsGroup)),(G)) // compose_pow(const G& g, size_t n) { - if (n == 0) - return traits::Identity(); - else if (n == 1) - return g; - else - return traits::Compose(compose_pow(g, n - 1), g); + if (n == 0) return traits::Identity(); + else if (n == 1) return g; + else return traits::Compose(compose_pow(g, n - 1), g); } /// Template to construct the direct product of two arbitrary groups @@ -140,15 +137,12 @@ class DirectProduct: public std::pair { const H& h() const {return this->second;} public: - // Construct from two subgroup elements - DirectProduct(const G& g, const H& h):std::pair(g,h) { - } /// Default constructor yields identity - DirectProduct():std::pair(traits::Identity(),traits::Identity()) { - } - static DirectProduct Identity() { - return DirectProduct(); - } + DirectProduct():std::pair(traits::Identity(),traits::Identity()) {} + + // Construct from two subgroup elements + DirectProduct(const G& g, const H& h):std::pair(g,h) {} + DirectProduct operator*(const DirectProduct& other) const { return DirectProduct(traits::Compose(g(),other.g()), traits::Compose(h(),other.h())); } @@ -174,15 +168,12 @@ class DirectSum: public std::pair { const H& h() const { return this->second;} public: - // Construct from two subgroup elements - DirectSum(const G& g, const H& h):std::pair(g,h) { - } /// Default constructor yields identity - DirectSum():std::pair(traits::Identity(),traits::Identity()) { - } - static DirectSum Identity() { - return DirectSum(); - } + DirectSum():std::pair(traits::Identity(),traits::Identity()) {} + + // Construct from two subgroup elements + DirectSum(const G& g, const H& h):std::pair(g,h) {} + DirectSum operator+(const DirectSum& other) const { return DirectSum(g()+other.g(), h()+other.h()); } diff --git a/gtsam/base/Manifold.h b/gtsam/base/Manifold.h index 6998b3b18..eafd7e3e2 100644 --- a/gtsam/base/Manifold.h +++ b/gtsam/base/Manifold.h @@ -90,7 +90,7 @@ struct ManifoldImpl { /// A helper that implements the traits interface for GTSAM manifolds. /// To use this for your class type, define: -/// template<> struct traits : public Manifold { }; +/// template<> struct traits : public internal::Manifold { }; template struct Manifold: Testable, ManifoldImpl {