31 using namespace gtsam;
35 static const size_t N = 5;
39 static const double tol = 1
e-15;
53 static const size_t N = 5;
58 static const double tol = 1
e-15;
74 Chebyshev2::EvaluationFunctor
fx(
N, 0.5);
83 Chebyshev2::EvaluationFunctor
fx(3, 1.5, 0, 2);
92 Chebyshev2::EvaluationFunctor
fx(5, 0.5);
101 double t = 30,
a = 0,
b = 100;
112 Chebyshev2::VectorEvaluationFunctor
fx(2,
N,
t,
a,
b);
117 std::bind(&Chebyshev2::VectorEvaluationFunctor::operator(),
fx,
118 std::placeholders::_1,
nullptr);
120 numericalDerivative11<Vector2, Matrix, 2 * N>(
f,
X);
128 double t = 30,
a = 0,
b = 100;
132 X.row(1) = Vector::Zero(
N);
133 X.row(2) = 0.1 * Vector::Ones(
N);
139 Chebyshev2::ManifoldEvaluationFunctor<Pose2>
fx(
N,
t,
a,
b);
146 std::bind(&Chebyshev2::ManifoldEvaluationFunctor<Pose2>::operator(),
fx,
147 std::placeholders::_1,
nullptr);
149 numericalDerivative11<Pose2, Matrix, 3 * N>(
f,
X);
153 #ifdef GTSAM_POSE3_EXPMAP
158 double a = 10,
b = 100;
170 Chebyshev2::ManifoldEvaluationFunctor<Pose3>
fx(
N,
t,
a,
b);
177 std::bind(&Chebyshev2::ManifoldEvaluationFunctor<Pose3>::operator(),
fx,
178 std::placeholders::_1,
nullptr);
180 numericalDerivative11<Pose3, Matrix, 6 * N>(
f,
X);
189 for (
size_t i = 0;
i < 16;
i++) {
190 double x = (1.0 / 16) *
i - 0.99,
y =
x;
209 expected << 1.5000, -2.0000, 0.5000,
210 0.5000, -0.0000, -0.5000,
211 -0.5000, 2.0000, -1.5000;
225 expected << 8.5000, -10.4721, 2.8944, -1.5279, 1.1056, -0.5000,
226 2.6180, -1.1708, -2.0000, 0.8944, -0.6180, 0.2764,
227 -0.7236, 2.0000, -0.1708, -1.6180, 0.8944, -0.3820,
228 0.3820, -0.8944, 1.6180, 0.1708, -2.0000, 0.7236,
229 -0.2764, 0.6180, -0.8944, 2.0000, 1.1708, -2.6180,
230 0.5000, -1.1056, 1.5279, -2.8944, 10.4721, -8.5000;
242 return 3.0 *
pow(
x, 3) - 2.0 *
pow(
x, 2) + 5.0 *
x - 11;
248 return 9.0 *
pow(
x, 2) - 4.0 *
x + 5.0;
255 double x1 = 0.7,
x2 = -0.376;
264 double a = 0,
b = 10,
x1 = 7,
x2 = 4.12;
271 double expected2 =
f(
x2);
285 for (
size_t j = 0;
j <
N; ++
j) {
293 std::vector<double> testPoints = { 0.7, -0.376, 0.0 };
294 for (
double x : testPoints) {
307 double x1 = 5,
x2 = 4.12,
a = 0,
b = 10;
333 double a = -3,
b = 8,
x2 = 5.05;
368 const double x = 0.2;
369 Matrix numeric_dTdx = numericalDerivative11<double, double>(
proxy3,
x);
374 Chebyshev2::EvaluationFunctor
fx(6,
x);
378 Chebyshev2::DerivativeFunctor dfdx(6,
x);
392 const double x = 0.2;
393 Matrix numeric_dTdx = numericalDerivative11<double, double>(
proxy4,
x);
398 Chebyshev2::EvaluationFunctor
fx(6,
x, 0, 3);
402 Chebyshev2::DerivativeFunctor dfdx(6,
x, 0, 3);
409 const size_t N = 3,
M = 2;
410 const double x = 0.2;
411 using VecD = Chebyshev2::VectorDerivativeFunctor;
412 VecD
fx(
M,
N,
x, 0, 3);
418 Matrix expectedH = numericalDerivative11<Vector2, Matrix, M* N>(
419 std::bind(&VecD::operator(),
fx, std::placeholders::_1,
nullptr),
X);
426 const size_t N = 4,
M = 1,
T = 15;
427 using VecD = Chebyshev2::VectorDerivativeFunctor;
433 for (
size_t i = 0;
i <
N; ++
i) {
439 for (
size_t i = 0;
i <
N; ++
i) {
440 VecD
d(
M,
N, points(
i), 0,
T);
447 VecD vecd(
M,
N, points(0), 0,
T);
449 Matrix expectedH = numericalDerivative11<Vector1, Matrix, M* N>(
450 std::bind(&VecD::operator(), vecd, std::placeholders::_1,
nullptr),
X);
457 const size_t N = 6,
M = 2;
458 const double x = 0.2;
459 using CompFunc = Chebyshev2::ComponentDerivativeFunctor;
466 Matrix expectedH = numericalDerivative11<double, Matrix, M* N>(
467 std::bind(&CompFunc::operator(),
fx, std::placeholders::_1,
nullptr),
X);
474 const double a = 0,
b = 10;
485 for (
size_t i = 0;
i <
N; ++
i)
ramp(
i) = points(
i) -
a;
501 F_est.array() +=
f(
a);
519 0.457142857142857, 0.520634920634921, 0.457142857142857,
520 0.253968253968254, 0.0285714285714286)
529 double expectedF =
f(1) -
f(-1);
530 double actualW = actual * fp;
550 0.352242423718159, 0.437208405798326, 0.437208405798326,
551 0.352242423718159, 0.190141007218208, 0.0204081632653061)
560 const double a = 0,
b = 10;
563 auto ones = Vector::Ones(
N);
572 const double a = 0,
b = 3;
575 auto ones = Vector::Ones(
N);