remove all LieMatrix(sizt_t m, ...), which also has dangerous behavior
parent
96296333ae
commit
8c4aa2b9a6
|
@ -19,20 +19,6 @@
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
LieMatrix::LieMatrix(size_t m, size_t n, ...)
|
|
||||||
: Matrix(m,n) {
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, n);
|
|
||||||
for(size_t i = 0; i < m; ++i) {
|
|
||||||
for(size_t j = 0; j < n; ++j) {
|
|
||||||
double value = va_arg(ap, double);
|
|
||||||
(*this)(i,j) = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
void LieMatrix::print(const std::string& name) const {
|
void LieMatrix::print(const std::string& name) const {
|
||||||
gtsam::print(matrix(), name);
|
gtsam::print(matrix(), name);
|
||||||
|
|
|
@ -48,9 +48,6 @@ struct LieMatrix : public Matrix, public DerivedValue<LieMatrix> {
|
||||||
LieMatrix(size_t m, size_t n, const double* const data) :
|
LieMatrix(size_t m, size_t n, const double* const data) :
|
||||||
Matrix(Eigen::Map<const Matrix>(data, m, n)) {}
|
Matrix(Eigen::Map<const Matrix>(data, m, n)) {}
|
||||||
|
|
||||||
/** Specify arguments directly, as in Matrix_() - always force these to be doubles */
|
|
||||||
GTSAM_EXPORT LieMatrix(size_t m, size_t n, ...);
|
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Testable interface
|
/// @name Testable interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
|
@ -39,20 +39,17 @@ TEST( LieMatrix, construction ) {
|
||||||
TEST( LieMatrix, other_constructors ) {
|
TEST( LieMatrix, other_constructors ) {
|
||||||
Matrix init = (Matrix(2,2) << 10.0,20.0, 30.0,40.0);
|
Matrix init = (Matrix(2,2) << 10.0,20.0, 30.0,40.0);
|
||||||
LieMatrix exp(init);
|
LieMatrix exp(init);
|
||||||
LieMatrix a(2,2,10.0,20.0,30.0,40.0);
|
|
||||||
double data[] = {10,30,20,40};
|
double data[] = {10,30,20,40};
|
||||||
LieMatrix b(2,2,data);
|
LieMatrix b(2,2,data);
|
||||||
EXPECT(assert_equal(exp, a));
|
|
||||||
EXPECT(assert_equal(exp, b));
|
EXPECT(assert_equal(exp, b));
|
||||||
EXPECT(assert_equal(b, a));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST(LieMatrix, retract) {
|
TEST(LieMatrix, retract) {
|
||||||
LieMatrix init(2,2, 1.0,2.0,3.0,4.0);
|
LieMatrix init((Matrix(2,2) << 1.0,2.0,3.0,4.0));
|
||||||
Vector update = (Vector(4) << 3.0, 4.0, 6.0, 7.0);
|
Vector update = (Vector(4) << 3.0, 4.0, 6.0, 7.0);
|
||||||
|
|
||||||
LieMatrix expected(2,2, 4.0, 6.0, 9.0, 11.0);
|
LieMatrix expected((Matrix(2,2) << 4.0, 6.0, 9.0, 11.0));
|
||||||
LieMatrix actual = init.retract(update);
|
LieMatrix actual = init.retract(update);
|
||||||
|
|
||||||
EXPECT(assert_equal(expected, actual));
|
EXPECT(assert_equal(expected, actual));
|
||||||
|
@ -63,7 +60,7 @@ TEST(LieMatrix, retract) {
|
||||||
EXPECT(assert_equal(expectedUpdate, actualUpdate));
|
EXPECT(assert_equal(expectedUpdate, actualUpdate));
|
||||||
|
|
||||||
Vector expectedLogmap = (Vector(4) << 1, 2, 3, 4);
|
Vector expectedLogmap = (Vector(4) << 1, 2, 3, 4);
|
||||||
Vector actualLogmap = LieMatrix::Logmap(LieMatrix(2,2, 1.0, 2.0, 3.0, 4.0));
|
Vector actualLogmap = LieMatrix::Logmap(LieMatrix((Matrix(2,2) << 1.0, 2.0, 3.0, 4.0)));
|
||||||
EXPECT(assert_equal(expectedLogmap, actualLogmap));
|
EXPECT(assert_equal(expectedLogmap, actualLogmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,8 +287,8 @@ TEST (testSerializationSLAM, smallExample_nonlinear) {
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
TEST (testSerializationSLAM, factors) {
|
TEST (testSerializationSLAM, factors) {
|
||||||
|
|
||||||
LieVector lieVector(4, 1.0, 2.0, 3.0, 4.0);
|
LieVector lieVector((Vector(4) << 1.0, 2.0, 3.0, 4.0));
|
||||||
LieMatrix lieMatrix(2, 3, 1.0, 2.0, 3.0, 4.0, 5.0 ,6.0);
|
LieMatrix lieMatrix((Matrix(2, 3) << 1.0, 2.0, 3.0, 4.0, 5.0 ,6.0));
|
||||||
Point2 point2(1.0, 2.0);
|
Point2 point2(1.0, 2.0);
|
||||||
StereoPoint2 stereoPoint2(1.0, 2.0, 3.0);
|
StereoPoint2 stereoPoint2(1.0, 2.0, 3.0);
|
||||||
Point3 point3(1.0, 2.0, 3.0);
|
Point3 point3(1.0, 2.0, 3.0);
|
||||||
|
|
Loading…
Reference in New Issue