Formatting and comments only

release/4.3a0
dellaert 2015-05-24 15:32:20 -07:00
parent 9fc9e70dd6
commit 2c235d98be
2 changed files with 14 additions and 23 deletions

View File

@ -121,12 +121,9 @@ struct AdditiveGroupTraits : GroupTraits<Class> {
template<typename G> template<typename G>
BOOST_CONCEPT_REQUIRES(((IsGroup<G>)),(G)) // BOOST_CONCEPT_REQUIRES(((IsGroup<G>)),(G)) //
compose_pow(const G& g, size_t n) { compose_pow(const G& g, size_t n) {
if (n == 0) if (n == 0) return traits<G>::Identity();
return traits<G>::Identity(); else if (n == 1) return g;
else if (n == 1) else return traits<G>::Compose(compose_pow(g, n - 1), g);
return g;
else
return traits<G>::Compose(compose_pow(g, n - 1), g);
} }
/// Template to construct the direct product of two arbitrary groups /// Template to construct the direct product of two arbitrary groups
@ -140,15 +137,12 @@ class DirectProduct: public std::pair<G, H> {
const H& h() const {return this->second;} const H& h() const {return this->second;}
public: public:
// Construct from two subgroup elements
DirectProduct(const G& g, const H& h):std::pair<G,H>(g,h) {
}
/// Default constructor yields identity /// Default constructor yields identity
DirectProduct():std::pair<G,H>(traits<G>::Identity(),traits<H>::Identity()) { DirectProduct():std::pair<G,H>(traits<G>::Identity(),traits<H>::Identity()) {}
}
static DirectProduct Identity() { // Construct from two subgroup elements
return DirectProduct(); DirectProduct(const G& g, const H& h):std::pair<G,H>(g,h) {}
}
DirectProduct operator*(const DirectProduct& other) const { DirectProduct operator*(const DirectProduct& other) const {
return DirectProduct(traits<G>::Compose(g(),other.g()), traits<H>::Compose(h(),other.h())); return DirectProduct(traits<G>::Compose(g(),other.g()), traits<H>::Compose(h(),other.h()));
} }
@ -174,15 +168,12 @@ class DirectSum: public std::pair<G, H> {
const H& h() const { return this->second;} const H& h() const { return this->second;}
public: public:
// Construct from two subgroup elements
DirectSum(const G& g, const H& h):std::pair<G,H>(g,h) {
}
/// Default constructor yields identity /// Default constructor yields identity
DirectSum():std::pair<G,H>(traits<G>::Identity(),traits<H>::Identity()) { DirectSum():std::pair<G,H>(traits<G>::Identity(),traits<H>::Identity()) {}
}
static DirectSum Identity() { // Construct from two subgroup elements
return DirectSum(); DirectSum(const G& g, const H& h):std::pair<G,H>(g,h) {}
}
DirectSum operator+(const DirectSum& other) const { DirectSum operator+(const DirectSum& other) const {
return DirectSum(g()+other.g(), h()+other.h()); return DirectSum(g()+other.g(), h()+other.h());
} }

View File

@ -90,7 +90,7 @@ struct ManifoldImpl<Class, Eigen::Dynamic> {
/// A helper that implements the traits interface for GTSAM manifolds. /// A helper that implements the traits interface for GTSAM manifolds.
/// To use this for your class type, define: /// To use this for your class type, define:
/// template<> struct traits<Class> : public Manifold<Class> { }; /// template<> struct traits<Class> : public internal::Manifold<Class> { };
template<class Class> template<class Class>
struct Manifold: Testable<Class>, ManifoldImpl<Class, Class::dimension> { struct Manifold: Testable<Class>, ManifoldImpl<Class, Class::dimension> {