33 #define _USE_MATH_DEFINES 40 template <
typename FLT_TYPE =
float>
46 a_ = 1.0 / sqrtf(2.0 * M_PI * sigma * sigma);
47 sq2_ = sigma * sigma * 2.0;
51 return a_ * expf(-x * x /
sq2_);
59 template <
typename FLT_TYPE =
float,
size_t DIMENSION = 6>
63 using Matrix = Eigen::Matrix<FLT_TYPE, DIMENSION, DIMENSION>;
64 using Vector = Eigen::Matrix<FLT_TYPE, DIMENSION, 1>;
68 a_ = 1.0 / (
pow(2.0 * M_PI, 0.5 * DIMENSION) *
sqrt(sigma.determinant()));
69 sigma_inv_ = sigma.inverse();
73 return a_ * expf(-0.5 * x.transpose() * sigma_inv_ * x);
82 #endif // MCL_3DL_ND_H
FLT_TYPE operator()(const Vector x) const
FLT_TYPE operator()(const FLT_TYPE x) const
NormalLikelihoodNd(const Matrix sigma)
NormalLikelihood(const FLT_TYPE sigma)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
Eigen::Matrix< FLT_TYPE, DIMENSION, DIMENSION > Matrix
Eigen::Matrix< FLT_TYPE, DIMENSION, 1 > Vector