26 using namespace gtsam;
29 auto model = noiseModel::Unit::Create(1);
34 TEST(Chebyshev, Chebyshev1) {
35 using Synth = Chebyshev1Basis::EvaluationFunctor;
49 using Synth = Chebyshev2Basis::EvaluationFunctor;
62 TEST(Chebyshev, Evaluation) {
63 Chebyshev1Basis::EvaluationFunctor
fx(
N, 0.5);
81 t << -0.7, -0.4, 0.1, 0.3, 0.7, 0.9;
83 x << -0.7, -0.4, 0.1, 0.3, 0.7, 0.9;
85 for (
size_t i = 0;
i <
m;
i++) {
111 Chebyshev1Basis::EvaluationFunctor
f(
N, 1.0);
113 double actual =
f(actual_c,
H);
117 double actual_variance_on_prediction = (
H * cov *
H.transpose())(0);
122 TEST(Chebyshev, Decomposition) {
127 for (
size_t i = 0;
i <
M;
i++) {
128 double x = ((double)
i /
M);
150 D = Chebyshev1Basis::DerivativeWeights(
N,
x);
155 D = Chebyshev1Basis::DerivativeWeights(
N,
x);
160 D = Chebyshev1Basis::DerivativeWeights(
N,
x);
169 return Chebyshev1Basis::EvaluationFunctor(
N,
x)(
Vector(
f));
172 TEST(Chebyshev1, Derivative2) {
173 const double x = 0.5;
174 auto D = Chebyshev1Basis::DerivativeWeights(
N,
x);
177 numericalDerivative21<double, double, double>(
proxy1,
x,
N);
196 D = Chebyshev2Basis::DerivativeWeights(
N,
x);
201 D = Chebyshev2Basis::DerivativeWeights(
N,
x);
206 D = Chebyshev2Basis::DerivativeWeights(
N,
x);
211 D = Chebyshev2Basis::DerivativeWeights(
N,
x, 0, 20);
218 return Chebyshev2Basis::EvaluationFunctor(
N,
x)(
Vector(
f));
222 const double x = 0.5;
223 auto D = Chebyshev2Basis::DerivativeWeights(
N,
x);
226 numericalDerivative21<double, double, double>(
proxy2,
x,
N);