Added a function for Lie Scalar to get the value back out again
parent
4c8d65a069
commit
de6a3768c2
|
|
@ -33,6 +33,9 @@ namespace gtsam {
|
||||||
/** wrap a double */
|
/** wrap a double */
|
||||||
LieScalar(double d) : d_(d) {}
|
LieScalar(double d) : d_(d) {}
|
||||||
|
|
||||||
|
/** access the underlying value */
|
||||||
|
double value() const { return d_; }
|
||||||
|
|
||||||
/** print @param s optional string naming the object */
|
/** print @param s optional string naming the object */
|
||||||
inline void print(const std::string& name="") const {
|
inline void print(const std::string& name="") const {
|
||||||
std::cout << name << ": " << d_ << std::endl;
|
std::cout << name << ": " << d_ << std::endl;
|
||||||
|
|
@ -45,8 +48,10 @@ namespace gtsam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns dimensionality of the tangent space
|
* Returns dimensionality of the tangent space
|
||||||
|
* with member and static versions
|
||||||
*/
|
*/
|
||||||
inline size_t dim() const { return 1; }
|
inline size_t dim() const { return 1; }
|
||||||
|
inline static size_t Dim() { return 1; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns Exponential map update of T
|
* Returns Exponential map update of T
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,15 @@
|
||||||
|
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
|
const double tol=1e-9;
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST( testLieScalar, construction ) {
|
TEST( testLieScalar, construction ) {
|
||||||
double d = 2.;
|
double d = 2.;
|
||||||
LieScalar lie1(d), lie2(d);
|
LieScalar lie1(d), lie2(d);
|
||||||
|
|
||||||
|
EXPECT_DOUBLES_EQUAL(2., lie1.value(),tol);
|
||||||
|
EXPECT_DOUBLES_EQUAL(2., lie2.value(),tol);
|
||||||
EXPECT(lie1.dim() == 1);
|
EXPECT(lie1.dim() == 1);
|
||||||
EXPECT(assert_equal(lie1, lie2));
|
EXPECT(assert_equal(lie1, lie2));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue