Revert "Resolved several MSVC compiling errors" -- bring back Lie*
This reverts commit 33bda1ef71
.
release/4.3a0
parent
33bda1ef71
commit
063cf72c00
93
gtsam.h
93
gtsam.h
|
@ -286,6 +286,99 @@ virtual class GenericValue : gtsam::Value {
|
||||||
void serializable() const;
|
void serializable() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <gtsam/base/deprecated/LieScalar.h>
|
||||||
|
class LieScalar {
|
||||||
|
// Standard constructors
|
||||||
|
LieScalar();
|
||||||
|
LieScalar(double d);
|
||||||
|
|
||||||
|
// Standard interface
|
||||||
|
double value() const;
|
||||||
|
|
||||||
|
// Testable
|
||||||
|
void print(string s) const;
|
||||||
|
bool equals(const gtsam::LieScalar& expected, double tol) const;
|
||||||
|
|
||||||
|
// Group
|
||||||
|
static gtsam::LieScalar identity();
|
||||||
|
gtsam::LieScalar inverse() const;
|
||||||
|
gtsam::LieScalar compose(const gtsam::LieScalar& p) const;
|
||||||
|
gtsam::LieScalar between(const gtsam::LieScalar& l2) const;
|
||||||
|
|
||||||
|
// Manifold
|
||||||
|
size_t dim() const;
|
||||||
|
gtsam::LieScalar retract(Vector v) const;
|
||||||
|
Vector localCoordinates(const gtsam::LieScalar& t2) const;
|
||||||
|
|
||||||
|
// Lie group
|
||||||
|
static gtsam::LieScalar Expmap(Vector v);
|
||||||
|
static Vector Logmap(const gtsam::LieScalar& p);
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <gtsam/base/deprecated/LieVector.h>
|
||||||
|
class LieVector {
|
||||||
|
// Standard constructors
|
||||||
|
LieVector();
|
||||||
|
LieVector(Vector v);
|
||||||
|
|
||||||
|
// Standard interface
|
||||||
|
Vector vector() const;
|
||||||
|
|
||||||
|
// Testable
|
||||||
|
void print(string s) const;
|
||||||
|
bool equals(const gtsam::LieVector& expected, double tol) const;
|
||||||
|
|
||||||
|
// Group
|
||||||
|
static gtsam::LieVector identity();
|
||||||
|
gtsam::LieVector inverse() const;
|
||||||
|
gtsam::LieVector compose(const gtsam::LieVector& p) const;
|
||||||
|
gtsam::LieVector between(const gtsam::LieVector& l2) const;
|
||||||
|
|
||||||
|
// Manifold
|
||||||
|
size_t dim() const;
|
||||||
|
gtsam::LieVector retract(Vector v) const;
|
||||||
|
Vector localCoordinates(const gtsam::LieVector& t2) const;
|
||||||
|
|
||||||
|
// Lie group
|
||||||
|
static gtsam::LieVector Expmap(Vector v);
|
||||||
|
static Vector Logmap(const gtsam::LieVector& p);
|
||||||
|
|
||||||
|
// enabling serialization functionality
|
||||||
|
void serialize() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include <gtsam/base/deprecated/LieMatrix.h>
|
||||||
|
class LieMatrix {
|
||||||
|
// Standard constructors
|
||||||
|
LieMatrix();
|
||||||
|
LieMatrix(Matrix v);
|
||||||
|
|
||||||
|
// Standard interface
|
||||||
|
Matrix matrix() const;
|
||||||
|
|
||||||
|
// Testable
|
||||||
|
void print(string s) const;
|
||||||
|
bool equals(const gtsam::LieMatrix& expected, double tol) const;
|
||||||
|
|
||||||
|
// Group
|
||||||
|
static gtsam::LieMatrix identity();
|
||||||
|
gtsam::LieMatrix inverse() const;
|
||||||
|
gtsam::LieMatrix compose(const gtsam::LieMatrix& p) const;
|
||||||
|
gtsam::LieMatrix between(const gtsam::LieMatrix& l2) const;
|
||||||
|
|
||||||
|
// Manifold
|
||||||
|
size_t dim() const;
|
||||||
|
gtsam::LieMatrix retract(Vector v) const;
|
||||||
|
Vector localCoordinates(const gtsam::LieMatrix & t2) const;
|
||||||
|
|
||||||
|
// Lie group
|
||||||
|
static gtsam::LieMatrix Expmap(Vector v);
|
||||||
|
static Vector Logmap(const gtsam::LieMatrix& p);
|
||||||
|
|
||||||
|
// enabling serialization functionality
|
||||||
|
void serialize() const;
|
||||||
|
};
|
||||||
|
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
// geometry
|
// geometry
|
||||||
//*************************************************************************
|
//*************************************************************************
|
||||||
|
|
|
@ -39,12 +39,6 @@ set (excluded_sources #"")
|
||||||
|
|
||||||
set (excluded_headers #"")
|
set (excluded_headers #"")
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/slam/serialization.h"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/LieMatrix.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/LieVector.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/LieScalar.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/deprecated/LieMatrix.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/deprecated/LieVector.h"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/base/deprecated/LieScalar.h"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if(GTSAM_USE_QUATERNIONS)
|
if(GTSAM_USE_QUATERNIONS)
|
||||||
|
@ -62,7 +56,6 @@ foreach(subdir ${gtsam_subdirs})
|
||||||
# Build convenience libraries
|
# Build convenience libraries
|
||||||
file(GLOB_RECURSE subdir_srcs "${subdir}/*.cpp" "${subdir}/*.h") # Include header files so they show up in Visual Studio
|
file(GLOB_RECURSE subdir_srcs "${subdir}/*.cpp" "${subdir}/*.h") # Include header files so they show up in Visual Studio
|
||||||
list(REMOVE_ITEM subdir_srcs ${excluded_sources})
|
list(REMOVE_ITEM subdir_srcs ${excluded_sources})
|
||||||
list(REMOVE_ITEM subdir_srcs ${excluded_headers})
|
|
||||||
file(GLOB subdir_test_files "${subdir}/tests/*")
|
file(GLOB subdir_test_files "${subdir}/tests/*")
|
||||||
list(REMOVE_ITEM subdir_srcs ${subdir_test_files}) # Remove test files from sources compiled into library
|
list(REMOVE_ITEM subdir_srcs ${subdir_test_files}) # Remove test files from sources compiled into library
|
||||||
gtsam_assign_source_folders("${subdir_srcs}") # Create MSVC structure
|
gtsam_assign_source_folders("${subdir_srcs}") # Create MSVC structure
|
||||||
|
|
|
@ -299,7 +299,7 @@ GTSAM_EXPORT std::pair<Matrix,Matrix> qr(const Matrix& A);
|
||||||
* @param A is the input matrix, and is the output
|
* @param A is the input matrix, and is the output
|
||||||
* @param clear_below_diagonal enables zeroing out below diagonal
|
* @param clear_below_diagonal enables zeroing out below diagonal
|
||||||
*/
|
*/
|
||||||
GTSAM_EXPORT void inplace_QR(Matrix& A);
|
void inplace_QR(Matrix& A);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imperative algorithm for in-place full elimination with
|
* Imperative algorithm for in-place full elimination with
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
|
* Atlanta, Georgia 30332-0415
|
||||||
|
* All Rights Reserved
|
||||||
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||||
|
|
||||||
|
* See LICENSE for the license information
|
||||||
|
|
||||||
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file testLieMatrix.cpp
|
||||||
|
* @author Richard Roberts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
#include <gtsam/base/deprecated/LieMatrix.h>
|
||||||
|
#include <gtsam/base/Testable.h>
|
||||||
|
#include <gtsam/base/Manifold.h>
|
||||||
|
|
||||||
|
using namespace gtsam;
|
||||||
|
|
||||||
|
GTSAM_CONCEPT_TESTABLE_INST(LieMatrix)
|
||||||
|
GTSAM_CONCEPT_LIE_INST(LieMatrix)
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( LieMatrix, construction ) {
|
||||||
|
Matrix m = (Matrix(2,2) << 1.0,2.0, 3.0,4.0).finished();
|
||||||
|
LieMatrix lie1(m), lie2(m);
|
||||||
|
|
||||||
|
EXPECT(traits<LieMatrix>::GetDimension(m) == 4);
|
||||||
|
EXPECT(assert_equal(m, lie1.matrix()));
|
||||||
|
EXPECT(assert_equal(lie1, lie2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( LieMatrix, other_constructors ) {
|
||||||
|
Matrix init = (Matrix(2,2) << 10.0,20.0, 30.0,40.0).finished();
|
||||||
|
LieMatrix exp(init);
|
||||||
|
double data[] = {10,30,20,40};
|
||||||
|
LieMatrix b(2,2,data);
|
||||||
|
EXPECT(assert_equal(exp, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST(LieMatrix, retract) {
|
||||||
|
LieMatrix init((Matrix(2,2) << 1.0,2.0,3.0,4.0).finished());
|
||||||
|
Vector update = (Vector(4) << 3.0, 4.0, 6.0, 7.0).finished();
|
||||||
|
|
||||||
|
LieMatrix expected((Matrix(2,2) << 4.0, 6.0, 9.0, 11.0).finished());
|
||||||
|
LieMatrix actual = traits<LieMatrix>::Retract(init,update);
|
||||||
|
|
||||||
|
EXPECT(assert_equal(expected, actual));
|
||||||
|
|
||||||
|
Vector expectedUpdate = update;
|
||||||
|
Vector actualUpdate = traits<LieMatrix>::Local(init,actual);
|
||||||
|
|
||||||
|
EXPECT(assert_equal(expectedUpdate, actualUpdate));
|
||||||
|
|
||||||
|
Vector expectedLogmap = (Vector(4) << 1, 2, 3, 4).finished();
|
||||||
|
Vector actualLogmap = traits<LieMatrix>::Logmap(LieMatrix((Matrix(2,2) << 1.0, 2.0, 3.0, 4.0).finished()));
|
||||||
|
EXPECT(assert_equal(expectedLogmap, actualLogmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
|
* Atlanta, Georgia 30332-0415
|
||||||
|
* All Rights Reserved
|
||||||
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||||
|
|
||||||
|
* See LICENSE for the license information
|
||||||
|
|
||||||
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file testLieScalar.cpp
|
||||||
|
* @author Kai Ni
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
#include <gtsam/base/deprecated/LieScalar.h>
|
||||||
|
#include <gtsam/base/Testable.h>
|
||||||
|
#include <gtsam/base/Manifold.h>
|
||||||
|
|
||||||
|
using namespace gtsam;
|
||||||
|
|
||||||
|
GTSAM_CONCEPT_TESTABLE_INST(LieScalar)
|
||||||
|
GTSAM_CONCEPT_LIE_INST(LieScalar)
|
||||||
|
|
||||||
|
const double tol=1e-9;
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST(LieScalar , Concept) {
|
||||||
|
BOOST_CONCEPT_ASSERT((IsGroup<LieScalar>));
|
||||||
|
BOOST_CONCEPT_ASSERT((IsManifold<LieScalar>));
|
||||||
|
BOOST_CONCEPT_ASSERT((IsLieGroup<LieScalar>));
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST(LieScalar , Invariants) {
|
||||||
|
LieScalar lie1(2), lie2(3);
|
||||||
|
CHECK(check_group_invariants(lie1, lie2));
|
||||||
|
CHECK(check_manifold_invariants(lie1, lie2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
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(traits<LieScalar>::dimension == 1);
|
||||||
|
EXPECT(assert_equal(lie1, lie2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( testLieScalar, localCoordinates ) {
|
||||||
|
LieScalar lie1(1.), lie2(3.);
|
||||||
|
|
||||||
|
Vector1 actual = traits<LieScalar>::Local(lie1, lie2);
|
||||||
|
EXPECT( assert_equal((Vector)(Vector(1) << 2).finished(), actual));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||||
|
/* ************************************************************************* */
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||||
|
* Atlanta, Georgia 30332-0415
|
||||||
|
* All Rights Reserved
|
||||||
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||||
|
|
||||||
|
* See LICENSE for the license information
|
||||||
|
|
||||||
|
* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file testLieVector.cpp
|
||||||
|
* @author Alex Cunningham
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
#include <gtsam/base/deprecated/LieVector.h>
|
||||||
|
#include <gtsam/base/Testable.h>
|
||||||
|
#include <gtsam/base/Manifold.h>
|
||||||
|
|
||||||
|
using namespace gtsam;
|
||||||
|
|
||||||
|
GTSAM_CONCEPT_TESTABLE_INST(LieVector)
|
||||||
|
GTSAM_CONCEPT_LIE_INST(LieVector)
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST(LieVector , Concept) {
|
||||||
|
BOOST_CONCEPT_ASSERT((IsGroup<LieVector>));
|
||||||
|
BOOST_CONCEPT_ASSERT((IsManifold<LieVector>));
|
||||||
|
BOOST_CONCEPT_ASSERT((IsLieGroup<LieVector>));
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST(LieVector , Invariants) {
|
||||||
|
Vector v = Vector3(1.0, 2.0, 3.0);
|
||||||
|
LieVector lie1(v), lie2(v);
|
||||||
|
check_manifold_invariants(lie1, lie2);
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST( testLieVector, construction ) {
|
||||||
|
Vector v = Vector3(1.0, 2.0, 3.0);
|
||||||
|
LieVector lie1(v), lie2(v);
|
||||||
|
|
||||||
|
EXPECT(lie1.dim() == 3);
|
||||||
|
EXPECT(assert_equal(v, lie1.vector()));
|
||||||
|
EXPECT(assert_equal(lie1, lie2));
|
||||||
|
}
|
||||||
|
|
||||||
|
//******************************************************************************
|
||||||
|
TEST( testLieVector, other_constructors ) {
|
||||||
|
Vector init = Vector2(10.0, 20.0);
|
||||||
|
LieVector exp(init);
|
||||||
|
double data[] = { 10, 20 };
|
||||||
|
LieVector b(2, data);
|
||||||
|
EXPECT(assert_equal(exp, b));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
int main() {
|
||||||
|
TestResult tr;
|
||||||
|
return TestRegistry::runAllTests(tr);
|
||||||
|
}
|
||||||
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -15,10 +15,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <CppUnitLite/TestHarness.h>
|
#include <CppUnitLite/TestHarness.h>
|
||||||
|
#include <gtsam/base/deprecated/LieScalar.h>
|
||||||
#include <gtsam/base/TestableAssertions.h>
|
#include <gtsam/base/TestableAssertions.h>
|
||||||
|
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
TEST( testTestableAssertions, optional ) {
|
||||||
|
typedef boost::optional<LieScalar> OptionalScalar;
|
||||||
|
LieScalar x(1.0);
|
||||||
|
OptionalScalar ox(x), dummy = boost::none;
|
||||||
|
EXPECT(assert_equal(ox, ox));
|
||||||
|
EXPECT(assert_equal(x, ox));
|
||||||
|
EXPECT(assert_equal(dummy, dummy));
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||||
|
|
Loading…
Reference in New Issue