basis module tests pass
parent
55ad1841bd
commit
6e6c64749d
|
|
@ -92,7 +92,7 @@ Matrix kroneckerProductIdentity(const Weights& w) {
|
||||||
|
|
||||||
/// CRTP Base class for function bases
|
/// CRTP Base class for function bases
|
||||||
template <typename DERIVED>
|
template <typename DERIVED>
|
||||||
class GTSAM_EXPORT Basis {
|
class Basis {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Calculate weights for all x in vector X.
|
* Calculate weights for all x in vector X.
|
||||||
|
|
@ -497,11 +497,6 @@ class GTSAM_EXPORT Basis {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Vector version for MATLAB :-(
|
|
||||||
static double Derivative(double x, const Vector& p, //
|
|
||||||
OptionalJacobian</*1xN*/ -1, -1> H = boost::none) {
|
|
||||||
return DerivativeFunctor(x)(p.transpose(), H);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gtsam
|
} // namespace gtsam
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace gtsam {
|
||||||
* @tparam BASIS The basis class to use e.g. Chebyshev2
|
* @tparam BASIS The basis class to use e.g. Chebyshev2
|
||||||
*/
|
*/
|
||||||
template <class BASIS>
|
template <class BASIS>
|
||||||
class GTSAM_EXPORT EvaluationFactor : public FunctorizedFactor<double, Vector> {
|
class EvaluationFactor : public FunctorizedFactor<double, Vector> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<double, Vector>;
|
using Base = FunctorizedFactor<double, Vector>;
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ class GTSAM_EXPORT EvaluationFactor : public FunctorizedFactor<double, Vector> {
|
||||||
* @param M: Size of the evaluated state vector.
|
* @param M: Size of the evaluated state vector.
|
||||||
*/
|
*/
|
||||||
template <class BASIS, int M>
|
template <class BASIS, int M>
|
||||||
class GTSAM_EXPORT VectorEvaluationFactor
|
class VectorEvaluationFactor
|
||||||
: public FunctorizedFactor<Vector, ParameterMatrix<M>> {
|
: public FunctorizedFactor<Vector, ParameterMatrix<M>> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<Vector, ParameterMatrix<M>>;
|
using Base = FunctorizedFactor<Vector, ParameterMatrix<M>>;
|
||||||
|
|
@ -148,7 +148,7 @@ class GTSAM_EXPORT VectorEvaluationFactor
|
||||||
* where N is the degree and i is the component index.
|
* where N is the degree and i is the component index.
|
||||||
*/
|
*/
|
||||||
template <class BASIS, size_t P>
|
template <class BASIS, size_t P>
|
||||||
class GTSAM_EXPORT VectorComponentFactor
|
class VectorComponentFactor
|
||||||
: public FunctorizedFactor<double, ParameterMatrix<P>> {
|
: public FunctorizedFactor<double, ParameterMatrix<P>> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<double, ParameterMatrix<P>>;
|
using Base = FunctorizedFactor<double, ParameterMatrix<P>>;
|
||||||
|
|
@ -217,7 +217,7 @@ class GTSAM_EXPORT VectorComponentFactor
|
||||||
* where `x` is the value (e.g. timestep) at which the rotation was evaluated.
|
* where `x` is the value (e.g. timestep) at which the rotation was evaluated.
|
||||||
*/
|
*/
|
||||||
template <class BASIS, typename T>
|
template <class BASIS, typename T>
|
||||||
class GTSAM_EXPORT ManifoldEvaluationFactor
|
class ManifoldEvaluationFactor
|
||||||
: public FunctorizedFactor<T, ParameterMatrix<traits<T>::dimension>> {
|
: public FunctorizedFactor<T, ParameterMatrix<traits<T>::dimension>> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<T, ParameterMatrix<traits<T>::dimension>>;
|
using Base = FunctorizedFactor<T, ParameterMatrix<traits<T>::dimension>>;
|
||||||
|
|
@ -269,7 +269,7 @@ class GTSAM_EXPORT ManifoldEvaluationFactor
|
||||||
* @param BASIS: The basis class to use e.g. Chebyshev2
|
* @param BASIS: The basis class to use e.g. Chebyshev2
|
||||||
*/
|
*/
|
||||||
template <class BASIS>
|
template <class BASIS>
|
||||||
class GTSAM_EXPORT DerivativeFactor
|
class DerivativeFactor
|
||||||
: public FunctorizedFactor<double, typename BASIS::Parameters> {
|
: public FunctorizedFactor<double, typename BASIS::Parameters> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<double, typename BASIS::Parameters>;
|
using Base = FunctorizedFactor<double, typename BASIS::Parameters>;
|
||||||
|
|
@ -318,7 +318,7 @@ class GTSAM_EXPORT DerivativeFactor
|
||||||
* @param M: Size of the evaluated state vector derivative.
|
* @param M: Size of the evaluated state vector derivative.
|
||||||
*/
|
*/
|
||||||
template <class BASIS, int M>
|
template <class BASIS, int M>
|
||||||
class GTSAM_EXPORT VectorDerivativeFactor
|
class VectorDerivativeFactor
|
||||||
: public FunctorizedFactor<Vector, ParameterMatrix<M>> {
|
: public FunctorizedFactor<Vector, ParameterMatrix<M>> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<Vector, ParameterMatrix<M>>;
|
using Base = FunctorizedFactor<Vector, ParameterMatrix<M>>;
|
||||||
|
|
@ -371,7 +371,7 @@ class GTSAM_EXPORT VectorDerivativeFactor
|
||||||
* @param P: Size of the control component derivative.
|
* @param P: Size of the control component derivative.
|
||||||
*/
|
*/
|
||||||
template <class BASIS, int P>
|
template <class BASIS, int P>
|
||||||
class GTSAM_EXPORT ComponentDerivativeFactor
|
class ComponentDerivativeFactor
|
||||||
: public FunctorizedFactor<double, ParameterMatrix<P>> {
|
: public FunctorizedFactor<double, ParameterMatrix<P>> {
|
||||||
private:
|
private:
|
||||||
using Base = FunctorizedFactor<double, ParameterMatrix<P>>;
|
using Base = FunctorizedFactor<double, ParameterMatrix<P>>;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ namespace gtsam {
|
||||||
* These are typically denoted with the symbol T_n, where n is the degree.
|
* These are typically denoted with the symbol T_n, where n is the degree.
|
||||||
* The parameter N is the number of coefficients, i.e., N = n+1.
|
* The parameter N is the number of coefficients, i.e., N = n+1.
|
||||||
*/
|
*/
|
||||||
struct Chebyshev1Basis : Basis<Chebyshev1Basis> {
|
struct GTSAM_EXPORT Chebyshev1Basis : Basis<Chebyshev1Basis> {
|
||||||
using Parameters = Eigen::Matrix<double, -1, 1 /*Nx1*/>;
|
using Parameters = Eigen::Matrix<double, -1, 1 /*Nx1*/>;
|
||||||
|
|
||||||
Parameters parameters_;
|
Parameters parameters_;
|
||||||
|
|
@ -79,7 +79,7 @@ struct Chebyshev1Basis : Basis<Chebyshev1Basis> {
|
||||||
* functions. In this sense, they are like the sines and cosines of the Fourier
|
* functions. In this sense, they are like the sines and cosines of the Fourier
|
||||||
* basis.
|
* basis.
|
||||||
*/
|
*/
|
||||||
struct Chebyshev2Basis : Basis<Chebyshev2Basis> {
|
struct GTSAM_EXPORT Chebyshev2Basis : Basis<Chebyshev2Basis> {
|
||||||
using Parameters = Eigen::Matrix<double, -1, 1 /*Nx1*/>;
|
using Parameters = Eigen::Matrix<double, -1, 1 /*Nx1*/>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
/// Fourier basis
|
/// Fourier basis
|
||||||
class GTSAM_EXPORT FourierBasis : public Basis<FourierBasis> {
|
class FourierBasis : public Basis<FourierBasis> {
|
||||||
public:
|
public:
|
||||||
using Parameters = Eigen::Matrix<double, /*Nx1*/ -1, 1>;
|
using Parameters = Eigen::Matrix<double, /*Nx1*/ -1, 1>;
|
||||||
using DiffMatrix = Eigen::Matrix<double, /*NxN*/ -1, -1>;
|
using DiffMatrix = Eigen::Matrix<double, /*NxN*/ -1, -1>;
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,6 @@ class Chebyshev2 {
|
||||||
static Matrix DerivativeWeights(size_t N, double x, double a, double b);
|
static Matrix DerivativeWeights(size_t N, double x, double a, double b);
|
||||||
static Matrix IntegrationWeights(size_t N, double a, double b);
|
static Matrix IntegrationWeights(size_t N, double a, double b);
|
||||||
static Matrix DifferentiationMatrix(size_t N, double a, double b);
|
static Matrix DifferentiationMatrix(size_t N, double a, double b);
|
||||||
|
|
||||||
// TODO Needs OptionalJacobian
|
|
||||||
// static double Derivative(double x, Vector f);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <gtsam/basis/ParameterMatrix.h>
|
#include <gtsam/basis/ParameterMatrix.h>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue