21#include <gtsam/dllexport.h>
95 matrix.topRightCorner<2, 1>());
111 matrix.topRightCorner<3, 1>());
129 double inverseScale = matrix(2, 2);
130 if (!std::isfinite(inverseScale)) inverseScale = 1.0;
131 inverseScale = std::abs(inverseScale);
132 if (inverseScale <= std::numeric_limits<double>::epsilon()) {
136 matrix.topRightCorner<2, 1>(), 1.0 / inverseScale);
154 double inverseScale = matrix(3, 3);
155 if (!std::isfinite(inverseScale)) inverseScale = 1.0;
156 inverseScale = std::abs(inverseScale);
157 if (inverseScale <= std::numeric_limits<double>::epsilon()) {
161 matrix.topRightCorner<3, 1>(), 1.0 / inverseScale);
177 const Eigen::JacobiSVD<Matrix4>
svd(
178 matrix, Eigen::ComputeFullU | Eigen::ComputeFullV);
179 const auto singularValues =
svd.singularValues();
180 const double determinantMagnitude = singularValues.prod();
181 if (!std::isfinite(determinantMagnitude) || determinantMagnitude <= 1e-12) {
199 using LieAlgebra =
typename T::LieAlgebra;
200 static constexpr int N = LieAlgebra::RowsAtCompileTime;
201 static_assert(N != Eigen::Dynamic && N > 0,
202 "FastSync requires a positive compile-time matrix dimension");
203 static_assert(LieAlgebra::ColsAtCompileTime == N,
204 "FastSync requires a square matrix representation");
206 using MatrixN = Eigen::Matrix<double, N, N>;
207 using VectorN = Eigen::Matrix<double, N, 1>;
248 size_t priorCount_ = 0;
Base class and basic functions for Matrix Lie groups.
A thin wrapper around std::map that uses boost's fast_pool_allocator.
Implementation of Similarity2 transform.
3D Pose manifold SO(3) x R^3 and group SE(3)
Projective Special Linear Group (SL(4, R)) factor.
3D rotation represented as a rotation matrix or quaternion
Implementation of Similarity3 transform.
Linear Factor Graph where all factors are Gaussians.
A non-templated config holding any types of Manifold-group elements.
Factor Graph consisting of non-linear factors.
Template implementation for fixed-size FAST-Sync.
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Values fastSync(const NonlinearFactorGraph &graph, Ordering::OrderingType orderingType)
Initialize a synchronization graph using FAST-Sync.
Definition FastSync-inl.h:204
void svd(const Matrix &A, Matrix &U, Vector &S, Matrix &V)
SVD computes economy SVD A=U*S*V'.
Definition Matrix.cpp:557
noiseModel::Base::shared_ptr SharedNoiseModel
Aliases.
Definition NoiseModel.h:846
std::uint64_t Key
Integer nonlinear key type.
Definition types.h:43
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
A 2D pose (Point2,Rot2).
Definition Pose2.h:39
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Rotation matrix NOTE: the angle theta is in radians unless explicitly stated.
Definition Rot2.h:40
static Rot2 ClosestTo(const Matrix2 &M)
Find closest valid rotation matrix, given a 2x2 matrix.
Definition Rot2.cpp:140
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
static Rot3 ClosestTo(const Matrix3 &M)
Static, named constructor that finds Rot3 element closest to M in Frobenius norm.
Definition Rot3.h:287
2D similarity transform
Definition Similarity2.h:34
3D similarity transform
Definition Similarity3.h:36
static SL4 Identity()
identity for group operation
Definition SL4.h:66
OrderingType
Type of ordering to use.
Definition Ordering.h:40
A GaussianConditional functions as the node in a Bayes network.
Definition GaussianConditional.h:43
A Linear Factor Graph is a factor graph where all factors are Gaussian, i.e.
Definition GaussianFactorGraph.h:77
Definition NonlinearFactorGraph.h:57
A non-templated config holding any types of Manifold-group elements.
Definition Values.h:65
Projection customization point used by fastSync().
Definition FastSync.h:54
static Rot2 project(const Matrix2 &matrix)
Return the closest proper planar rotation to matrix.
Definition FastSync.h:66
static Rot3 project(const Matrix3 &matrix)
Return the closest proper three-dimensional rotation to matrix.
Definition FastSync.h:80
static Pose2 project(const Matrix3 &matrix)
Round the rotation block and retain the recovered planar translation.
Definition FastSync.h:93
static Pose3 project(const Matrix4 &matrix)
Round the rotation block and retain the recovered 3D translation.
Definition FastSync.h:109
static Similarity2 project(const Matrix3 &matrix)
Round rotation and recover translation and positive planar scale.
Definition FastSync.h:128
static Similarity3 project(const Matrix4 &matrix)
Round rotation and recover translation and positive 3D scale.
Definition FastSync.h:153
static SL4 project(const Matrix4 &matrix)
Normalize a nonsingular ambient matrix to SL(4), or return identity.
Definition FastSync.h:176
Values solve(Ordering::OrderingType orderingType=Ordering::METIS) const
Solve the relaxed ambient matrix problem and return one matrix per key.
Definition FastSync-inl.h:130
Values projectAndAlign(const Values &relaxed) const
Project relaxed matrices to T and align them to the optional matching prior stored by the constructor...
Definition FastSync-inl.h:177
FastSync(const NonlinearFactorGraph &graph)
Extract matching factors, validate their noise models, and build the reduced Gaussian graph.
Definition FastSync-inl.h:43