Go to the documentation of this file.
   37 using namespace std::placeholders;
 
   38 using namespace gtsam;
 
   56     expectedH = numericalDerivative11<Point3, Unit3>(
point3_, 
s);
 
   68   Rot3 R = Rot3::Yaw(0.5);
 
  125   std::function<double(
const Unit3&, 
const Unit3&)> 
f =
 
  126       std::bind(&
Unit3::dot, std::placeholders::_1, std::placeholders::_2,  
 
  156     expected = numericalDerivative11<Vector2,Unit3>(
 
  162     expected = numericalDerivative11<Vector2,Unit3>(
 
  163         std::bind(&
Unit3::error, &
p, std::placeholders::_1, 
nullptr), r);
 
  183     expected = numericalDerivative21<Vector2, Unit3, Unit3>(
 
  184         std::bind(&Unit3::errorVector, std::placeholders::_1,
 
  185                   std::placeholders::_2, 
nullptr, 
nullptr),
 
  187     p.errorVector(
q, actual, {});
 
  191     expected = numericalDerivative21<Vector2, Unit3, Unit3>(
 
  192         std::bind(&Unit3::errorVector, std::placeholders::_1,
 
  193                   std::placeholders::_2, 
nullptr, 
nullptr),
 
  195     p.errorVector(r, actual, {});
 
  199     expected = numericalDerivative22<Vector2, Unit3, Unit3>(
 
  200         std::bind(&Unit3::errorVector, std::placeholders::_1,
 
  201                   std::placeholders::_2, 
nullptr, 
nullptr),
 
  203     p.errorVector(
q, {}, actual);
 
  207     expected = numericalDerivative22<Vector2, Unit3, Unit3>(
 
  208         std::bind(&Unit3::errorVector, std::placeholders::_1,
 
  209                   std::placeholders::_2, 
nullptr, 
nullptr),
 
  211     p.errorVector(r, {}, actual);
 
  227     expected = numericalGradient<Unit3>(
 
  229     p.distance(
q, actual);
 
  233     expected = numericalGradient<Unit3>(
 
  235     p.distance(r, actual);
 
  243   Vector actual = 
p.localCoordinates(
p);
 
  296     Unit3 p(0, 1, 0), 
q(0 - twist, -1 + twist, 0);
 
  302     Unit3 p(0, 1, 0), 
q(0 + twist, -1 - twist, 0);
 
  312   Matrix32 
B = 
p.basis(
H);
 
  314   B_vec << 
B.col(0), 
B.col(1);
 
  322   expected << 0.0, -0.994169047, 0.97618706, -0.0233922129, 0.216930458, 0.105264958;
 
  325   Matrix62 expectedH = numericalDerivative11<Vector6, Unit3>(
 
  326       std::bind(
BasisTest, std::placeholders::_1, 
nullptr), 
p);
 
  347   std::mt19937 
rng(42);
 
  348   for (
int i = 0; 
i < num_tests; 
i++) {
 
  354     Matrix62 expectedH = numericalDerivative11<Vector6, Unit3>(
 
  355         std::bind(
BasisTest, std::placeholders::_1, 
nullptr), 
p);
 
  411   std::mt19937 
rng(42);
 
  413   Point3 expectedMean(0,0,0), actualMean(0,0,0);
 
  414   for (
size_t i = 0; 
i < 100; 
i++)
 
  415     actualMean = actualMean + Unit3::Random(
rng).point3();
 
  416   actualMean = actualMean / 100;
 
  423   std::mt19937 
rng(42);
 
  424   size_t numIterations = 10000;
 
  426   for (
size_t i = 0; 
i < numIterations; 
i++) {
 
  428     const Unit3 s1 = Unit3::Random(
rng);
 
  429     const Unit3 s2 = Unit3::Random(
rng);
 
  446   Matrix expectedH = numericalDerivative11<Unit3, Point3>(
 
  447       std::bind(Unit3::FromPoint3, std::placeholders::_1, 
nullptr), 
point);
 
  453   std::vector<Unit3> 
data;
 
  462   for (
size_t i = 0; 
i < 
data.size(); 
i++) {
 
  468   for (
size_t i = 0; 
i < 
data.size() - 1; 
i++) {
 
  475   for (
size_t i = 0; 
i < 
data.size(); 
i++) {
 
  482   for (
size_t i = 0; 
i < 
data.size(); 
i++) {
 
  487   for (
size_t i = 0; 
i < 
data.size() - 1; 
i++) {
 
  502 #if GTSAM_ENABLE_BOOST_SERIALIZATION 
  503 TEST(actualH, Serialization) {
 
  505   EXPECT(serializationTestHelpers::equalsObj(
p));
 
  506   EXPECT(serializationTestHelpers::equalsXML(
p));
 
  507   EXPECT(serializationTestHelpers::equalsBinary(
p));
 
  514   srand(
time(
nullptr));
 
  
static int runAllTests(TestResult &result)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate set rrange[*:*] noreverse nowriteback set trange[*:*] noreverse nowriteback set urange[*:*] noreverse nowriteback set vrange[*:*] noreverse nowriteback set xlabel matrix size set x2label set timefmt d m y n H
virtual const Values & optimize()
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Point2 unrotate(const Point2 &p, OptionalJacobian< 2, 1 > H1={}, OptionalJacobian< 2, 2 > H2={}) const
#define GTSAM_CONCEPT_TESTABLE_INST(T)
Concept check for values that can be used in unit tests.
#define EXPECT(condition)
Point3 point3_(const Unit3 &p)
internal::FixedSizeMatrix< Y, X >::type numericalDerivative11(std::function< Y(const X &)> h, const X &x, double delta=1e-5)
New-style numerical derivatives using manifold_traits.
static const Point3 point3(0.08, 0.08, 0.0)
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative22(std::function< Y(const X1 &, const X2 &)> h, const X1 &x1, const X2 &x2, double delta=1e-5)
static Unit3 rotate_(const Rot3 &R, const Unit3 &p)
def retract(a, np.ndarray xi)
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
3D rotation represented as a rotation matrix or quaternion
Scalar EIGEN_BLAS_FUNC() dot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Vector6 BasisTest(const Unit3 &p, OptionalJacobian< 6, 2 > H)
Some functions to compute numerical derivatives.
EIGEN_DEVICE_FUNC const Scalar & q
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
noiseModel::Base::shared_ptr SharedNoiseModel
Unit3 retract(const Vector2 &v, OptionalJacobian< 2, 2 > H={}) const
The retract function.
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Point2 rotate(const Point2 &p, OptionalJacobian< 2, 1 > H1={}, OptionalJacobian< 2, 2 > H2={}) const
Factor Graph consisting of non-linear factors.
static Unit3 unrotate_(const Rot3 &R, const Unit3 &p)
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative21(const std::function< Y(const X1 &, const X2 &)> &h, const X1 &x1, const X2 &x2, double delta=1e-5)
void insert(Key j, const Value &val)
static const Eigen::MatrixBase< Vector2 >::ConstantReturnType Z_2x1
Array< int, Dynamic, 1 > v
int RealScalar int RealScalar int RealScalar RealScalar * ps
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
#define GTSAM_CONCEPT_MANIFOLD_INST(T)
**
P unrotate(const T &r, const P &pt)
Double_ distance(const OrientedPlane3_ &p)
Represents a 3D point on a unit sphere.
Vector3 unitVector(OptionalJacobian< 3, 2 > H={}) const
Return unit-norm Vector.
NonlinearFactorGraph graph
Jet< T, N > sqrt(const Jet< T, N > &f)
P rotate(const T &r, const P &pt)
Rot2 R(Rot2::fromAngle(0.1))
Vector2 localCoordinates(const Unit3 &s) const
The local coordinates function.
void addExpressionFactor(const SharedNoiseModel &R, const T &z, const Expression< T > &h)
gtsam
Author(s): 
autogenerated on Wed May 28 2025 03:07:56