commit
b967c60ccd
|
@ -88,7 +88,7 @@ if(NOT MSVC AND NOT XCODE_VERSION)
|
||||||
|
|
||||||
# Set the GTSAM_BUILD_TAG variable.
|
# Set the GTSAM_BUILD_TAG variable.
|
||||||
# If build type is Release, set to blank (""), else set to the build type.
|
# If build type is Release, set to blank (""), else set to the build type.
|
||||||
if("${CMAKE_BUILD_TYPE_UPPER}" STREQUAL "RELEASE")
|
if(${CMAKE_BUILD_TYPE_UPPER} STREQUAL "RELEASE")
|
||||||
set(GTSAM_BUILD_TAG "") # Don't create release mode tag on installed directory
|
set(GTSAM_BUILD_TAG "") # Don't create release mode tag on installed directory
|
||||||
else()
|
else()
|
||||||
set(GTSAM_BUILD_TAG "${CMAKE_BUILD_TYPE}")
|
set(GTSAM_BUILD_TAG "${CMAKE_BUILD_TYPE}")
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://travis-ci.com/borglab/gtsam/)
|
gcc/clang: [](https://travis-ci.com/borglab/gtsam/) MSVC: [](https://ci.appveyor.com/project/dellaert/gtsam)
|
||||||
|
|
||||||
# README - Georgia Tech Smoothing and Mapping library
|
# README - Georgia Tech Smoothing and Mapping library
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# version format
|
||||||
|
version: 4.0.2-{branch}-build{build}
|
||||||
|
|
||||||
|
os: Visual Studio 2019
|
||||||
|
|
||||||
|
clone_folder: c:\projects\gtsam
|
||||||
|
|
||||||
|
platform: x64
|
||||||
|
configuration: Release
|
||||||
|
|
||||||
|
environment:
|
||||||
|
CTEST_OUTPUT_ON_FAILURE: 1
|
||||||
|
BOOST_ROOT: C:/Libraries/boost_1_71_0
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- cd c:\projects\gtsam\build
|
||||||
|
# As of Dec 2019, not all unit tests build cleanly for MSVC, so we'll just
|
||||||
|
# check that parts of GTSAM build correctly:
|
||||||
|
#- cmake --build .
|
||||||
|
- cmake --build . --config Release --target gtsam
|
||||||
|
- cmake --build . --config Release --target gtsam_unstable
|
||||||
|
- cmake --build . --config Release --target wrap
|
||||||
|
#- cmake --build . --target check
|
||||||
|
- cmake --build . --config Release --target check.base
|
||||||
|
- cmake --build . --config Release --target check.base_unstable
|
||||||
|
- cmake --build . --config Release --target check.linear
|
||||||
|
|
||||||
|
before_build:
|
||||||
|
- cd c:\projects\gtsam
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
# Disable examples to avoid AppVeyor timeout
|
||||||
|
- cmake -G "Visual Studio 16 2019" .. -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF
|
|
@ -81,6 +81,11 @@ if(MSVC)
|
||||||
WINDOWS_LEAN_AND_MEAN
|
WINDOWS_LEAN_AND_MEAN
|
||||||
NOMINMAX
|
NOMINMAX
|
||||||
)
|
)
|
||||||
|
# Avoid literally hundreds to thousands of warnings:
|
||||||
|
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC
|
||||||
|
/wd4267 # warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
|
||||||
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Other (non-preprocessor macros) compiler flags:
|
# Other (non-preprocessor macros) compiler flags:
|
||||||
|
|
|
@ -47,3 +47,17 @@ if(GTSAM_BUILD_METIS_EXECUTABLES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
|
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE)
|
||||||
|
# Export macros assumed in metis public headers to clients of the library.
|
||||||
|
# This was added to solve MSVC build errors.
|
||||||
|
if (TARGET metis AND GKlib_COPTIONS)
|
||||||
|
# Remove (possibly) duplicated symbols:
|
||||||
|
string(REPLACE -DLINUX "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
string(REPLACE -DWIN32 "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
string(REPLACE -DNDEBUG2 "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
string(REPLACE -DNDEBUG "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
string(REPLACE -pedantic "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
string(REPLACE -std=c99 "" GKlib_COPTIONS ${GKlib_COPTIONS})
|
||||||
|
separate_arguments(GKlib_COPTIONS)
|
||||||
|
# Declare those flags as to-be-imported in "client libraries", i.e. "gtsam"
|
||||||
|
target_compile_options(metis INTERFACE ${GKlib_COPTIONS})
|
||||||
|
endif()
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace gtsam {
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
namespace so3 {
|
namespace so3 {
|
||||||
|
|
||||||
Matrix99 Dcompose(const SO3& Q) {
|
GTSAM_EXPORT Matrix99 Dcompose(const SO3& Q) {
|
||||||
Matrix99 H;
|
Matrix99 H;
|
||||||
auto R = Q.matrix();
|
auto R = Q.matrix();
|
||||||
H << I_3x3 * R(0, 0), I_3x3 * R(1, 0), I_3x3 * R(2, 0), //
|
H << I_3x3 * R(0, 0), I_3x3 * R(1, 0), I_3x3 * R(2, 0), //
|
||||||
|
@ -41,7 +41,7 @@ Matrix99 Dcompose(const SO3& Q) {
|
||||||
return H;
|
return H;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix3 compose(const Matrix3& M, const SO3& R, OptionalJacobian<9, 9> H) {
|
GTSAM_EXPORT Matrix3 compose(const Matrix3& M, const SO3& R, OptionalJacobian<9, 9> H) {
|
||||||
Matrix3 MR = M * R.matrix();
|
Matrix3 MR = M * R.matrix();
|
||||||
if (H) *H = Dcompose(R);
|
if (H) *H = Dcompose(R);
|
||||||
return MR;
|
return MR;
|
||||||
|
@ -134,12 +134,14 @@ Vector3 DexpFunctor::applyInvDexp(const Vector3& v, OptionalJacobian<3, 3> H1,
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::AxisAngle(const Vector3& axis, double theta) {
|
SO3 SO3::AxisAngle(const Vector3& axis, double theta) {
|
||||||
return so3::ExpmapFunctor(axis, theta).expmap();
|
return so3::ExpmapFunctor(axis, theta).expmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ClosestTo(const Matrix3& M) {
|
SO3 SO3::ClosestTo(const Matrix3& M) {
|
||||||
Eigen::JacobiSVD<Matrix3> svd(M, Eigen::ComputeFullU | Eigen::ComputeFullV);
|
Eigen::JacobiSVD<Matrix3> svd(M, Eigen::ComputeFullU | Eigen::ComputeFullV);
|
||||||
const auto& U = svd.matrixU();
|
const auto& U = svd.matrixU();
|
||||||
|
@ -150,6 +152,7 @@ SO3 SO3::ClosestTo(const Matrix3& M) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations) {
|
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations) {
|
||||||
// See Hartley13ijcv:
|
// See Hartley13ijcv:
|
||||||
// Cost function C(R) = \sum sqr(|R-R_i|_F)
|
// Cost function C(R) = \sum sqr(|R-R_i|_F)
|
||||||
|
@ -163,6 +166,7 @@ SO3 SO3::ChordalMean(const std::vector<SO3>& rotations) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::Hat(const Vector3& xi) {
|
Matrix3 SO3::Hat(const Vector3& xi) {
|
||||||
// skew symmetric matrix X = xi^
|
// skew symmetric matrix X = xi^
|
||||||
Matrix3 Y = Z_3x3;
|
Matrix3 Y = Z_3x3;
|
||||||
|
@ -174,6 +178,7 @@ Matrix3 SO3::Hat(const Vector3& xi) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::Vee(const Matrix3& X) {
|
Vector3 SO3::Vee(const Matrix3& X) {
|
||||||
Vector3 xi;
|
Vector3 xi;
|
||||||
xi(0) = -X(1, 2);
|
xi(0) = -X(1, 2);
|
||||||
|
@ -184,12 +189,14 @@ Vector3 SO3::Vee(const Matrix3& X) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::AdjointMap() const {
|
Matrix3 SO3::AdjointMap() const {
|
||||||
return matrix_;
|
return matrix_;
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H) {
|
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H) {
|
||||||
if (H) {
|
if (H) {
|
||||||
so3::DexpFunctor impl(omega);
|
so3::DexpFunctor impl(omega);
|
||||||
|
@ -201,6 +208,7 @@ SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::ExpmapDerivative(const Vector3& omega) {
|
Matrix3 SO3::ExpmapDerivative(const Vector3& omega) {
|
||||||
return so3::DexpFunctor(omega).dexp();
|
return so3::DexpFunctor(omega).dexp();
|
||||||
}
|
}
|
||||||
|
@ -217,6 +225,7 @@ Matrix3 SO3::ExpmapDerivative(const Vector3& omega) {
|
||||||
omega)
|
omega)
|
||||||
*/
|
*/
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::LogmapDerivative(const Vector3& omega) {
|
Matrix3 SO3::LogmapDerivative(const Vector3& omega) {
|
||||||
using std::cos;
|
using std::cos;
|
||||||
using std::sin;
|
using std::sin;
|
||||||
|
@ -234,6 +243,7 @@ Matrix3 SO3::LogmapDerivative(const Vector3& omega) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::Logmap(const SO3& Q, ChartJacobian H) {
|
Vector3 SO3::Logmap(const SO3& Q, ChartJacobian H) {
|
||||||
using std::sin;
|
using std::sin;
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
|
@ -281,11 +291,13 @@ Vector3 SO3::Logmap(const SO3& Q, ChartJacobian H) {
|
||||||
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
|
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H) {
|
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H) {
|
||||||
return Expmap(omega, H);
|
return Expmap(omega, H);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H) {
|
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H) {
|
||||||
return Logmap(R, H);
|
return Logmap(R, H);
|
||||||
}
|
}
|
||||||
|
@ -307,6 +319,7 @@ static const Matrix93 P3 =
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const {
|
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const {
|
||||||
const Matrix3& R = matrix_;
|
const Matrix3& R = matrix_;
|
||||||
if (H) {
|
if (H) {
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include <gtsam/base/Lie.h>
|
#include <gtsam/base/Lie.h>
|
||||||
#include <gtsam/base/Matrix.h>
|
#include <gtsam/base/Matrix.h>
|
||||||
|
#include <gtsam/dllexport.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -36,18 +37,23 @@ using SO3 = SO<3>;
|
||||||
// They are *defined* in SO3.cpp.
|
// They are *defined* in SO3.cpp.
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::AxisAngle(const Vector3& axis, double theta);
|
SO3 SO3::AxisAngle(const Vector3& axis, double theta);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ClosestTo(const Matrix3& M);
|
SO3 SO3::ClosestTo(const Matrix3& M);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations);
|
SO3 SO3::ChordalMean(const std::vector<SO3>& rotations);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::Hat(const Vector3& xi); ///< make skew symmetric matrix
|
Matrix3 SO3::Hat(const Vector3& xi); ///< make skew symmetric matrix
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::Vee(const Matrix3& X); ///< inverse of Hat
|
Vector3 SO3::Vee(const Matrix3& X); ///< inverse of Hat
|
||||||
|
|
||||||
/// Adjoint map
|
/// Adjoint map
|
||||||
|
@ -59,10 +65,12 @@ Matrix3 SO3::AdjointMap() const;
|
||||||
* \f$ [R_x,R_y,R_z] \f$ using Rodrigues' formula
|
* \f$ [R_x,R_y,R_z] \f$ using Rodrigues' formula
|
||||||
*/
|
*/
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H);
|
SO3 SO3::Expmap(const Vector3& omega, ChartJacobian H);
|
||||||
|
|
||||||
/// Derivative of Expmap
|
/// Derivative of Expmap
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::ExpmapDerivative(const Vector3& omega);
|
Matrix3 SO3::ExpmapDerivative(const Vector3& omega);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,20 +78,25 @@ Matrix3 SO3::ExpmapDerivative(const Vector3& omega);
|
||||||
* \f$ [R_x,R_y,R_z] \f$ of this rotation
|
* \f$ [R_x,R_y,R_z] \f$ of this rotation
|
||||||
*/
|
*/
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::Logmap(const SO3& R, ChartJacobian H);
|
Vector3 SO3::Logmap(const SO3& R, ChartJacobian H);
|
||||||
|
|
||||||
/// Derivative of Logmap
|
/// Derivative of Logmap
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix3 SO3::LogmapDerivative(const Vector3& omega);
|
Matrix3 SO3::LogmapDerivative(const Vector3& omega);
|
||||||
|
|
||||||
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
|
// Chart at origin for SO3 is *not* Cayley but actual Expmap/Logmap
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H);
|
SO3 SO3::ChartAtOrigin::Retract(const Vector3& omega, ChartJacobian H);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H);
|
Vector3 SO3::ChartAtOrigin::Local(const SO3& R, ChartJacobian H);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const;
|
Vector9 SO3::vec(OptionalJacobian<9, 3> H) const;
|
||||||
|
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
|
@ -107,11 +120,11 @@ namespace so3 {
|
||||||
* Compose general matrix with an SO(3) element.
|
* Compose general matrix with an SO(3) element.
|
||||||
* We only provide the 9*9 derivative in the first argument M.
|
* We only provide the 9*9 derivative in the first argument M.
|
||||||
*/
|
*/
|
||||||
Matrix3 compose(const Matrix3& M, const SO3& R,
|
GTSAM_EXPORT Matrix3 compose(const Matrix3& M, const SO3& R,
|
||||||
OptionalJacobian<9, 9> H = boost::none);
|
OptionalJacobian<9, 9> H = boost::none);
|
||||||
|
|
||||||
/// (constant) Jacobian of compose wrpt M
|
/// (constant) Jacobian of compose wrpt M
|
||||||
Matrix99 Dcompose(const SO3& R);
|
GTSAM_EXPORT Matrix99 Dcompose(const SO3& R);
|
||||||
|
|
||||||
// Below are two functors that allow for saving computation when exponential map
|
// Below are two functors that allow for saving computation when exponential map
|
||||||
// and its derivatives are needed at the same location in so<3>. The second
|
// and its derivatives are needed at the same location in so<3>. The second
|
||||||
|
|
|
@ -50,6 +50,7 @@ namespace gtsam {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix4 SO4::Hat(const Vector6& xi) {
|
Matrix4 SO4::Hat(const Vector6& xi) {
|
||||||
// skew symmetric matrix X = xi^
|
// skew symmetric matrix X = xi^
|
||||||
// Unlike Luca, makes upper-left the SO(3) subgroup.
|
// Unlike Luca, makes upper-left the SO(3) subgroup.
|
||||||
|
@ -65,6 +66,7 @@ Matrix4 SO4::Hat(const Vector6& xi) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector6 SO4::Vee(const Matrix4& X) {
|
Vector6 SO4::Vee(const Matrix4& X) {
|
||||||
Vector6 xi;
|
Vector6 xi;
|
||||||
xi(5) = -X(0, 1);
|
xi(5) = -X(0, 1);
|
||||||
|
@ -81,6 +83,7 @@ Vector6 SO4::Vee(const Matrix4& X) {
|
||||||
* "SOME REMARKS ON THE EXPONENTIAL MAP ON THE GROUPS SO(n) AND SE(n)" by
|
* "SOME REMARKS ON THE EXPONENTIAL MAP ON THE GROUPS SO(n) AND SE(n)" by
|
||||||
* Ramona-Andreaa Rohan */
|
* Ramona-Andreaa Rohan */
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4 SO4::Expmap(const Vector6& xi, ChartJacobian H) {
|
SO4 SO4::Expmap(const Vector6& xi, ChartJacobian H) {
|
||||||
using namespace std;
|
using namespace std;
|
||||||
if (H) throw std::runtime_error("SO4::Expmap Jacobian");
|
if (H) throw std::runtime_error("SO4::Expmap Jacobian");
|
||||||
|
@ -151,6 +154,7 @@ static const Eigen::Matrix<double, 16, 6> P4 =
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix6 SO4::AdjointMap() const {
|
Matrix6 SO4::AdjointMap() const {
|
||||||
// Elaborate way of calculating the AdjointMap
|
// Elaborate way of calculating the AdjointMap
|
||||||
// TODO(frank): find a closed form solution. In SO(3) is just R :-/
|
// TODO(frank): find a closed form solution. In SO(3) is just R :-/
|
||||||
|
@ -166,6 +170,7 @@ Matrix6 SO4::AdjointMap() const {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const {
|
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const {
|
||||||
const Matrix& Q = matrix_;
|
const Matrix& Q = matrix_;
|
||||||
if (H) {
|
if (H) {
|
||||||
|
@ -178,6 +183,7 @@ SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const {
|
||||||
|
|
||||||
///******************************************************************************
|
///******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4 SO4::ChartAtOrigin::Retract(const Vector6& xi, ChartJacobian H) {
|
SO4 SO4::ChartAtOrigin::Retract(const Vector6& xi, ChartJacobian H) {
|
||||||
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
|
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
|
||||||
gttic(SO4_Retract);
|
gttic(SO4_Retract);
|
||||||
|
@ -187,6 +193,7 @@ SO4 SO4::ChartAtOrigin::Retract(const Vector6& xi, ChartJacobian H) {
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector6 SO4::ChartAtOrigin::Local(const SO4& Q, ChartJacobian H) {
|
Vector6 SO4::ChartAtOrigin::Local(const SO4& Q, ChartJacobian H) {
|
||||||
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
|
if (H) throw std::runtime_error("SO4::ChartAtOrigin::Retract Jacobian");
|
||||||
const Matrix4& R = Q.matrix();
|
const Matrix4& R = Q.matrix();
|
||||||
|
@ -195,7 +202,7 @@ Vector6 SO4::ChartAtOrigin::Local(const SO4& Q, ChartJacobian H) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
|
GTSAM_EXPORT Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
|
||||||
const Matrix4& R = Q.matrix();
|
const Matrix4& R = Q.matrix();
|
||||||
const Matrix3 M = R.topLeftCorner<3, 3>();
|
const Matrix3 M = R.topLeftCorner<3, 3>();
|
||||||
if (H) {
|
if (H) {
|
||||||
|
@ -209,7 +216,7 @@ Matrix3 topLeft(const SO4& Q, OptionalJacobian<9, 6> H) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
Matrix43 stiefel(const SO4& Q, OptionalJacobian<12, 6> H) {
|
GTSAM_EXPORT Matrix43 stiefel(const SO4& Q, OptionalJacobian<12, 6> H) {
|
||||||
const Matrix4& R = Q.matrix();
|
const Matrix4& R = Q.matrix();
|
||||||
const Matrix43 M = R.leftCols<3>();
|
const Matrix43 M = R.leftCols<3>();
|
||||||
if (H) {
|
if (H) {
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <gtsam/base/Lie.h>
|
#include <gtsam/base/Lie.h>
|
||||||
#include <gtsam/base/Manifold.h>
|
#include <gtsam/base/Manifold.h>
|
||||||
#include <gtsam/base/Matrix.h>
|
#include <gtsam/base/Matrix.h>
|
||||||
|
#include <gtsam/dllexport.h>
|
||||||
|
|
||||||
#include <boost/random/mersenne_twister.hpp>
|
#include <boost/random/mersenne_twister.hpp>
|
||||||
|
|
||||||
|
@ -41,36 +42,43 @@ using SO4 = SO<4>;
|
||||||
// They are *defined* in SO4.cpp.
|
// They are *defined* in SO4.cpp.
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix4 SO4::Hat(const TangentVector &xi);
|
Matrix4 SO4::Hat(const TangentVector &xi);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector6 SO4::Vee(const Matrix4 &X);
|
Vector6 SO4::Vee(const Matrix4 &X);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4 SO4::Expmap(const Vector6 &xi, ChartJacobian H);
|
SO4 SO4::Expmap(const Vector6 &xi, ChartJacobian H);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix6 SO4::AdjointMap() const;
|
Matrix6 SO4::AdjointMap() const;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const;
|
SO4::VectorN2 SO4::vec(OptionalJacobian<16, 6> H) const;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
SO4 SO4::ChartAtOrigin::Retract(const Vector6 &omega, ChartJacobian H);
|
SO4 SO4::ChartAtOrigin::Retract(const Vector6 &omega, ChartJacobian H);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector6 SO4::ChartAtOrigin::Local(const SO4 &Q, ChartJacobian H);
|
Vector6 SO4::ChartAtOrigin::Local(const SO4 &Q, ChartJacobian H);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project to top-left 3*3 matrix. Note this is *not* in general \in SO(3).
|
* Project to top-left 3*3 matrix. Note this is *not* in general \in SO(3).
|
||||||
*/
|
*/
|
||||||
Matrix3 topLeft(const SO4 &Q, OptionalJacobian<9, 6> H = boost::none);
|
GTSAM_EXPORT Matrix3 topLeft(const SO4 &Q, OptionalJacobian<9, 6> H = boost::none);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project to Stiefel manifold of 4*3 orthonormal 3-frames in R^4, i.e., pi(Q)
|
* Project to Stiefel manifold of 4*3 orthonormal 3-frames in R^4, i.e., pi(Q)
|
||||||
* -> S \in St(3,4).
|
* -> S \in St(3,4).
|
||||||
*/
|
*/
|
||||||
Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none);
|
GTSAM_EXPORT Matrix43 stiefel(const SO4 &Q, OptionalJacobian<12, 6> H = boost::none);
|
||||||
|
|
||||||
/** Serialization function */
|
/** Serialization function */
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix SOn::Hat(const Vector& xi) {
|
Matrix SOn::Hat(const Vector& xi) {
|
||||||
size_t n = AmbientDim(xi.size());
|
size_t n = AmbientDim(xi.size());
|
||||||
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");
|
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");
|
||||||
|
@ -49,6 +50,7 @@ Matrix SOn::Hat(const Vector& xi) {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector SOn::Vee(const Matrix& X) {
|
Vector SOn::Vee(const Matrix& X) {
|
||||||
const size_t n = X.rows();
|
const size_t n = X.rows();
|
||||||
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");
|
if (n < 2) throw std::invalid_argument("SO<N>::Hat: n<2 not supported");
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <gtsam/base/Lie.h>
|
#include <gtsam/base/Lie.h>
|
||||||
#include <gtsam/base/Manifold.h>
|
#include <gtsam/base/Manifold.h>
|
||||||
|
#include <gtsam/dllexport.h>
|
||||||
|
|
||||||
#include <Eigen/Core>
|
#include <Eigen/Core>
|
||||||
#include <boost/random.hpp>
|
#include <boost/random.hpp>
|
||||||
|
@ -297,9 +298,11 @@ using SOn = SO<Eigen::Dynamic>;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Matrix SOn::Hat(const Vector& xi);
|
Matrix SOn::Hat(const Vector& xi);
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
GTSAM_EXPORT
|
||||||
Vector SOn::Vee(const Matrix& X);
|
Vector SOn::Vee(const Matrix& X);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -123,7 +123,7 @@ boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
std::ostream &operator<<(std::ostream &os, const LabeledSymbol &symbol) {
|
GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const LabeledSymbol &symbol) {
|
||||||
os << StreamedKey(symbol);
|
os << StreamedKey(symbol);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ public:
|
||||||
LabeledSymbol newLabel(unsigned char label) const { return LabeledSymbol(c_, label, j_); }
|
LabeledSymbol newLabel(unsigned char label) const { return LabeledSymbol(c_, label, j_); }
|
||||||
|
|
||||||
/// Output stream operator that can be used with key_formatter (see Key.h).
|
/// Output stream operator that can be used with key_formatter (see Key.h).
|
||||||
friend std::ostream &operator<<(std::ostream &, const LabeledSymbol &);
|
friend GTSAM_EXPORT std::ostream &operator<<(std::ostream &, const LabeledSymbol &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ boost::function<bool(Key)> Symbol::ChrTest(unsigned char c) {
|
||||||
return bind(&Symbol::chr, bind(make, _1)) == c;
|
return bind(&Symbol::chr, bind(make, _1)) == c;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const Symbol &symbol) {
|
GTSAM_EXPORT std::ostream &operator<<(std::ostream &os, const Symbol &symbol) {
|
||||||
os << StreamedKey(symbol);
|
os << StreamedKey(symbol);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ public:
|
||||||
static boost::function<bool(Key)> ChrTest(unsigned char c);
|
static boost::function<bool(Key)> ChrTest(unsigned char c);
|
||||||
|
|
||||||
/// Output stream operator that can be used with key_formatter (see Key.h).
|
/// Output stream operator that can be used with key_formatter (see Key.h).
|
||||||
friend std::ostream &operator<<(std::ostream &, const Symbol &);
|
GTSAM_EXPORT friend std::ostream &operator<<(std::ostream &, const Symbol &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -49,16 +49,16 @@ struct GTSAM_EXPORT SlotEntry {
|
||||||
class Scatter : public FastVector<SlotEntry> {
|
class Scatter : public FastVector<SlotEntry> {
|
||||||
public:
|
public:
|
||||||
/// Default Constructor
|
/// Default Constructor
|
||||||
Scatter() {}
|
GTSAM_EXPORT Scatter() {}
|
||||||
|
|
||||||
/// Construct from gaussian factor graph, without ordering
|
/// Construct from gaussian factor graph, without ordering
|
||||||
explicit Scatter(const GaussianFactorGraph& gfg);
|
GTSAM_EXPORT explicit Scatter(const GaussianFactorGraph& gfg);
|
||||||
|
|
||||||
/// Construct from gaussian factor graph, with (partial or complete) ordering
|
/// Construct from gaussian factor graph, with (partial or complete) ordering
|
||||||
explicit Scatter(const GaussianFactorGraph& gfg, const Ordering& ordering);
|
GTSAM_EXPORT explicit Scatter(const GaussianFactorGraph& gfg, const Ordering& ordering);
|
||||||
|
|
||||||
/// Add a key/dim pair
|
/// Add a key/dim pair
|
||||||
void add(Key key, size_t dim);
|
GTSAM_EXPORT void add(Key key, size_t dim);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Find the SlotEntry with the right key (linear time worst case)
|
/// Find the SlotEntry with the right key (linear time worst case)
|
||||||
|
|
|
@ -129,7 +129,7 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
ostream& operator<<(ostream& os, const VectorValues& v) {
|
GTSAM_EXPORT ostream& operator<<(ostream& os, const VectorValues& v) {
|
||||||
// Change print depending on whether we are using TBB
|
// Change print depending on whether we are using TBB
|
||||||
#ifdef GTSAM_USE_TBB
|
#ifdef GTSAM_USE_TBB
|
||||||
map<Key, Vector> sorted;
|
map<Key, Vector> sorted;
|
||||||
|
|
|
@ -230,7 +230,7 @@ namespace gtsam {
|
||||||
const_iterator find(Key j) const { return values_.find(j); }
|
const_iterator find(Key j) const { return values_.find(j); }
|
||||||
|
|
||||||
/// overload operator << to print to stringstream
|
/// overload operator << to print to stringstream
|
||||||
friend std::ostream& operator<<(std::ostream&, const VectorValues&);
|
GTSAM_EXPORT friend std::ostream& operator<<(std::ostream&, const VectorValues&);
|
||||||
|
|
||||||
/** print required by Testable for unit testing */
|
/** print required by Testable for unit testing */
|
||||||
void print(const std::string& str = "VectorValues",
|
void print(const std::string& str = "VectorValues",
|
||||||
|
|
|
@ -348,7 +348,9 @@ namespace gtsam {
|
||||||
throw ValuesKeyDoesNotExist("at", j);
|
throw ValuesKeyDoesNotExist("at", j);
|
||||||
|
|
||||||
// Check the type and throw exception if incorrect
|
// Check the type and throw exception if incorrect
|
||||||
return internal::handle<ValueType>()(j,item->second);
|
// h() split in two lines to avoid internal compiler error (MSVC2017)
|
||||||
|
auto h = internal::handle<ValueType>();
|
||||||
|
return h(j,item->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <vector>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
#include <boost/shared_array.hpp>
|
#include <boost/shared_array.hpp>
|
||||||
#include <boost/timer.hpp>
|
#include <boost/timer.hpp>
|
||||||
|
@ -40,14 +41,14 @@ namespace gtsam { namespace partition {
|
||||||
const sharedInts& adjncy, const sharedInts& adjwgt, bool verbose) {
|
const sharedInts& adjncy, const sharedInts& adjwgt, bool verbose) {
|
||||||
|
|
||||||
// control parameters
|
// control parameters
|
||||||
idx_t vwgt[n]; // the weights of the vertices
|
std::vector<idx_t> vwgt; // the weights of the vertices
|
||||||
idx_t options[METIS_NOPTIONS];
|
idx_t options[METIS_NOPTIONS];
|
||||||
METIS_SetDefaultOptions(options); // use defaults
|
METIS_SetDefaultOptions(options); // use defaults
|
||||||
idx_t sepsize; // the size of the separator, output
|
idx_t sepsize; // the size of the separator, output
|
||||||
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
|
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
|
||||||
|
|
||||||
// set uniform weights on the vertices
|
// set uniform weights on the vertices
|
||||||
std::fill(vwgt, vwgt+n, 1);
|
vwgt.assign(n, 1);
|
||||||
|
|
||||||
// TODO: Fix at later time
|
// TODO: Fix at later time
|
||||||
//boost::timer::cpu_timer TOTALTmr;
|
//boost::timer::cpu_timer TOTALTmr;
|
||||||
|
@ -61,7 +62,7 @@ namespace gtsam { namespace partition {
|
||||||
|
|
||||||
// call metis parition routine
|
// call metis parition routine
|
||||||
METIS_ComputeVertexSeparator(&n, xadj.get(), adjncy.get(),
|
METIS_ComputeVertexSeparator(&n, xadj.get(), adjncy.get(),
|
||||||
vwgt, options, &sepsize, part_.get());
|
&vwgt[0], options, &sepsize, part_.get());
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
//boost::cpu_times const elapsed_times(timer.elapsed());
|
//boost::cpu_times const elapsed_times(timer.elapsed());
|
||||||
|
@ -127,14 +128,14 @@ namespace gtsam { namespace partition {
|
||||||
const sharedInts& adjwgt, bool verbose) {
|
const sharedInts& adjwgt, bool verbose) {
|
||||||
|
|
||||||
// control parameters
|
// control parameters
|
||||||
idx_t vwgt[n]; // the weights of the vertices
|
std::vector<idx_t> vwgt; // the weights of the vertices
|
||||||
idx_t options[METIS_NOPTIONS];
|
idx_t options[METIS_NOPTIONS];
|
||||||
METIS_SetDefaultOptions(options); // use defaults
|
METIS_SetDefaultOptions(options); // use defaults
|
||||||
idx_t edgecut; // the number of edge cuts, output
|
idx_t edgecut; // the number of edge cuts, output
|
||||||
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
|
sharedInts part_(new idx_t[n]); // the partition of each vertex, output
|
||||||
|
|
||||||
// set uniform weights on the vertices
|
// set uniform weights on the vertices
|
||||||
std::fill(vwgt, vwgt+n, 1);
|
vwgt.assign(n, 1);
|
||||||
|
|
||||||
//TODO: Fix later
|
//TODO: Fix later
|
||||||
//boost::timer TOTALTmr;
|
//boost::timer TOTALTmr;
|
||||||
|
@ -150,7 +151,7 @@ namespace gtsam { namespace partition {
|
||||||
//int wgtflag = 1; // only edge weights
|
//int wgtflag = 1; // only edge weights
|
||||||
//int numflag = 0; // c style numbering starting from 0
|
//int numflag = 0; // c style numbering starting from 0
|
||||||
//int nparts = 2; // partition the graph to 2 submaps
|
//int nparts = 2; // partition the graph to 2 submaps
|
||||||
modefied_EdgeComputeSeparator(&n, xadj.get(), adjncy.get(), vwgt, adjwgt.get(),
|
modefied_EdgeComputeSeparator(&n, xadj.get(), adjncy.get(), &vwgt[0], adjwgt.get(),
|
||||||
options, &edgecut, part_.get());
|
options, &edgecut, part_.get());
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue