added group concept check

release/4.3a0
Mike Bosse 2014-12-04 13:10:50 +01:00
parent c225ee223c
commit b6576d7e27
2 changed files with 24 additions and 1 deletions

View File

@ -162,7 +162,7 @@ The group composition operation can be of two flavors:
* `gtsam::traits::additive_group_tag`
* `gtsam::traits::multiplicative_group_tag`
which should be queryable by `gtsam::traits::group_flavor<T>`
which should be queryable by `gtsam::traits::group_flavor<T>::tag`
Manifold Example

View File

@ -66,6 +66,29 @@ class ChartConcept {
};
template<class G>
class GroupConcept {
public:
typedef G Group;
static const Group identity = traits::identity<G>::value;
BOOST_CONCEPT_USAGE(GroupConcept) {
Group ip = inverse(p);
Group pq = compose(p, q);
Group d = between(p, q);
bool test = equal(p, q);
}
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));
}
private:
Group p,q;
};
} // namespace gtsam
#endif /* CONCEPTS_H_ */