Added a function for Lie Scalar to get the value back out again

release/4.3a0
Alex Cunningham 2010-12-08 01:59:53 +00:00
parent 4c8d65a069
commit de6a3768c2
2 changed files with 9 additions and 0 deletions

View File

@ -33,6 +33,9 @@ namespace gtsam {
/** wrap a double */
LieScalar(double d) : d_(d) {}
/** access the underlying value */
double value() const { return d_; }
/** print @param s optional string naming the object */
inline void print(const std::string& name="") const {
std::cout << name << ": " << d_ << std::endl;
@ -45,8 +48,10 @@ namespace gtsam {
/**
* Returns dimensionality of the tangent space
* with member and static versions
*/
inline size_t dim() const { return 1; }
inline static size_t Dim() { return 1; }
/**
* Returns Exponential map update of T

View File

@ -20,11 +20,15 @@
using namespace gtsam;
const double tol=1e-9;
/* ************************************************************************* */
TEST( testLieScalar, construction ) {
double d = 2.;
LieScalar lie1(d), lie2(d);
EXPECT_DOUBLES_EQUAL(2., lie1.value(),tol);
EXPECT_DOUBLES_EQUAL(2., lie2.value(),tol);
EXPECT(lie1.dim() == 1);
EXPECT(assert_equal(lie1, lie2));
}