The basis module provides tools for representing continuous functions as
linear combinations of basis functions or as values at interpolation points.
It is useful for smooth function approximation, trajectory modeling, and
building factors that constrain functions (or their derivatives) at specific
points.
At a high level, you choose a basis (Fourier or Chebyshev), decide whether you want a coefficient-based representation or a pseudo-spectral one (values at Chebyshev points), and then use the provided factors or fitting utilities to solve for parameters in GTSAM. For cardinal splines, choose between dense linear basis weights and a cumulative Lie-group trajectory.
Getting Oriented¶
Coefficient-based bases:
Chebyshev1Basis,Chebyshev2Basis, andFourierBasistreat the parameters as coefficients on basis functions.Pseudo-spectral basis:
Chebyshev2treats the parameters as values at Chebyshev points and uses barycentric interpolation.Factors: A family of unary factors enforce function values or derivatives at specific points, including vector- and manifold-valued variants.
Fitting:
FitBasisperforms least-squares regression from samples.Cardinal splines:
CardinalSplineBasisevaluates scalar or vector coefficients, whileCumulativeSplineTrajectory<T>handles pose and rotation control points.
Core Concepts¶
Basis: CRTP base class providing evaluation and derivative functors, Jacobians, and common helpers.
Polynomial Bases¶
Chebyshev1Basis: First-kind Chebyshev basis on (coefficient-based).
Chebyshev2Basis: Second-kind Chebyshev basis on (coefficient-based).
FourierBasis: Real Fourier series basis for periodic functions.
Cardinal and Cumulative Splines¶
CumulativeSplineTrajectory: Smooth trajectories whose controls are poses, rotations, or other Lie-group values. See the Pose2 example.
CardinalSplineBasis: Dense cubic weights for scalar or vector coefficients at a known coordinate. See the scalar example.
KernelBase: Interface for the compactly supported smooth switch used by cumulative trajectories.PiecewisePolynomial: Exact piecewise-polynomial values and derivatives used to implement kernels.Irwin–Hall kernels: Ready-made kernels, including the cubic
IrwinHallCDF2default.
Pseudo-Spectral Basis¶
Chebyshev2: Chebyshev points, barycentric interpolation, differentiation/integration matrices, and quadrature weights.
Factors for Basis Evaluation¶
These factors connect basis parameters to measurements of values or derivatives.
EvaluationFactor: Scalar value at a point.
VectorEvaluationFactor: Vector value at a point.
VectorComponentFactor: Single component of a vector value.
ManifoldEvaluationFactor: Manifold-valued measurement (e.g.,
Rot3,Pose3).
Factors for Derivative Constraints¶
DerivativeFactor: Scalar derivative at a point.
VectorDerivativeFactor: Vector derivative at a point.
ComponentDerivativeFactor: Single component of a vector derivative.
Fitting from Data¶
FitBasis: Build a least-squares problem from samples and solve for basis parameters.