Go to the documentation of this file.
25 #if defined(__GNUC__) && !defined(__clang__)
26 #pragma GCC diagnostic warning "-Wstringop-overread"
27 #pragma GCC diagnostic warning "-Warray-bounds"
30 using namespace gtsam;
32 auto model = noiseModel::Unit::Create(1);
38 (Vector7() << 1.5661, 1.2717, 1.2717, -0.0000, 0.5887, -0.0943, 0.0943)
47 FourierBasis::EvaluationFunctor
fx(3, 0);
57 FourierBasis::EvaluationFunctor
fx(3, 0);
61 Matrix13 expectedH(1, 1, 0);
80 for (
size_t i = 0;
i < 16;
i++) {
81 const double x =
i *
M_PI / 8;
100 auto linearizedJacobianFactor =
101 std::dynamic_pointer_cast<JacobianFactor>(linearizedFactor);
102 CHECK(linearizedJacobianFactor);
118 for (
size_t i = 0;
i < 16;
i++) {
141 Matrix actual = FourierBasis::WeightMatrix(3,
X);
149 for (
size_t i = 0;
i < 16;
i++) {
171 const double x = 0.2;
172 Matrix numeric_dTdx = numericalDerivative11<double, double>(
proxy,
x);
175 Matrix D7 = FourierBasis::DifferentiationMatrix(7);
177 FourierBasis::EvaluationFunctor
fx(7,
x);
181 FourierBasis::DerivativeFunctor dfdx(7,
x);
187 using DotShape =
typename FourierBasis::VectorDerivativeFunctor;
191 double h = 2 *
M_PI / 16;
192 Vector2 dotShape(0.5556, -0.8315);
193 DotShape dotShapeFunction(2,
N,
h / 2);
194 Matrix theta = (Matrix32() << 0, 0, 0.7071, 0.7071, 0.7071, -0.7071)
221 const Matrix W = FourierBasis::WeightMatrix(
N,
X);
225 using Eval = FourierBasis::EvaluationFunctor;
231 const Matrix invW =
W.inverse();
234 for (
size_t i = 0;
i < 16;
i++) {
235 const double x =
i *
M_PI / 8;
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
std::shared_ptr< This > shared_ptr
shared_ptr to this class
#define EXPECT_CORRECT_FACTOR_JACOBIANS(factor, values, numerical_derivative_step, tolerance)
Check the Jacobians produced by a factor against finite differences.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Concept check for values that can be used in unit tests.
Jet< T, N > sin(const Jet< T, N > &f)
#define EXPECT(condition)
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 x
Factor for enforcing the scalar value of the polynomial BASIS representation at x is the same as the ...
const Vector k3Coefficients
std::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
const Vector7 k7Coefficients
Jet< T, N > cos(const Jet< T, N > &f)
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
std::shared_ptr< GaussianFactor > linearize(const Values &x) const override
TEST(Basis, BasisEvaluationFunctor)
std::map< double, double > Sequence
Our sequence representation is a map of {x: y} values where y = f(x)
const HybridGaussianFactorGraph & lfg
Evaluate derivatives of a nonlinear factor numerically.
void insert(Key j, const Vector &value)
#define EXPECT_DOUBLES_EQUAL(expected, actual, threshold)
const gtsam::Symbol key('X', 0)
Fit a Basis using least-squares.
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
static double TestFunction(double x)
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
NonlinearFactorGraph graph
std::uint64_t Key
Integer nonlinear key type.
Fourier decomposition, see e.g. http://mathworld.wolfram.com/FourierSeries.html.
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
Parameters parameters() const
Return Fourier coefficients.
gtsam
Author(s):
autogenerated on Sun Feb 16 2025 04:06:16