Small refactor
parent
4a5a5c3738
commit
3d3d574325
|
@ -30,7 +30,7 @@ public:
|
||||||
i_(i) {
|
i_(i) {
|
||||||
assert(i<N);
|
assert(i<N);
|
||||||
}
|
}
|
||||||
// Idenity element
|
/// Idenity element
|
||||||
static Cyclic Identity() {
|
static Cyclic Identity() {
|
||||||
return Cyclic(0);
|
return Cyclic(0);
|
||||||
}
|
}
|
||||||
|
@ -54,25 +54,22 @@ public:
|
||||||
void print(const std::string& s = "") const {
|
void print(const std::string& s = "") const {
|
||||||
std::cout << s << i_ << std::endl;
|
std::cout << s << i_ << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// equals with an tolerance, prints out message if unequal
|
/// equals with an tolerance, prints out message if unequal
|
||||||
bool equals(const Cyclic& other, double tol = 1e-9) const {
|
bool equals(const Cyclic& other, double tol = 1e-9) const {
|
||||||
return other.i_ == i_;
|
return other.i_ == i_;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CYCLIC_TEMPLATE size_t N
|
|
||||||
#define CYCLIC_TYPE Cyclic<N>
|
|
||||||
|
|
||||||
/// Define cyclic group traits to be a model of the Group concept
|
/// Define cyclic group traits to be a model of the Group concept
|
||||||
template <CYCLIC_TEMPLATE>
|
template<size_t N>
|
||||||
struct traits_x<CYCLIC_TYPE > {
|
struct traits_x<Cyclic<N> > {
|
||||||
typedef group_tag structure_category;
|
typedef group_tag structure_category;
|
||||||
GTSAM_ADDITIVE_GROUP(CYCLIC_TYPE);
|
GTSAM_ADDITIVE_GROUP(Cyclic<N>)
|
||||||
static CYCLIC_TYPE Identity() { return CYCLIC_TYPE::Identity(); }
|
static Cyclic<N> Identity() { return Cyclic<N>::Identity();}
|
||||||
static bool Equals(const CYCLIC_TYPE& a, const CYCLIC_TYPE& b, double tol=1e-9) { return a.equals(b,tol); }
|
static bool Equals(const Cyclic<N>& a, const Cyclic<N>& b, double tol = 1e-9) {
|
||||||
static void Print(const CYCLIC_TYPE& c, const std::string &s="") { c.print(s); }
|
return a.equals(b, tol);
|
||||||
|
}
|
||||||
|
static void Print(const Cyclic<N>& c, const std::string &s = "") {c.print(s);}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // \namespace gtsam
|
} // \namespace gtsam
|
||||||
|
|
Loading…
Reference in New Issue