43 template <
class VECTORLIKE1,
class MATLIKE1,
class USERPARAM,
class VECTORLIKE2,
44 class VECTORLIKE3,
class MATLIKE2>
46 const VECTORLIKE1& x_mean,
const MATLIKE1& x_cov,
48 const VECTORLIKE1&
x,
const USERPARAM& fixed_param, VECTORLIKE3&
y),
49 const USERPARAM& fixed_param, VECTORLIKE2& y_mean, MATLIKE2& y_cov,
50 const bool* elem_do_wrap2pi =
nullptr,
const double alpha = 1e-3,
51 const double K = 0,
const double beta = 2.0)
54 const size_t Nx = x_mean.size();
55 const double lambda =
alpha *
alpha * (Nx + K) - Nx;
56 const double c = Nx + lambda;
59 const double Wi = 0.5 /
c;
60 std::vector<double> W_mean(1 + 2 * Nx, Wi), W_cov(1 + 2 * Nx, Wi);
61 W_mean[0] = lambda /
c;
62 W_cov[0] = W_mean[0] + (1 -
alpha *
alpha + beta);
66 const bool valid = x_cov.chol(L);
68 throw std::runtime_error(
69 "transform_gaussian_unscented: Singular covariance matrix in " 77 VECTORLIKE1 X = x_mean;
78 functor(X, fixed_param, Y[0]);
82 for (
size_t i = 0; i < Nx; i++)
84 L.extractRowAsCol(i, delta);
87 functor(X, fixed_param, Y[
row++]);
90 functor(X, fixed_param, Y[
row++]);
95 Y, y_cov, y_mean, &W_mean, &W_cov, elem_do_wrap2pi);
110 template <
class VECTORLIKE1,
class MATLIKE1,
class USERPARAM,
class VECTORLIKE2,
111 class VECTORLIKE3,
class MATLIKE2>
113 const VECTORLIKE1& x_mean,
const MATLIKE1& x_cov,
115 const VECTORLIKE1&
x,
const USERPARAM& fixed_param, VECTORLIKE3&
y),
116 const USERPARAM& fixed_param, VECTORLIKE2& y_mean, MATLIKE2& y_cov,
117 const size_t num_samples = 1000,
123 samples_x, num_samples, x_cov, &x_mean);
125 for (
size_t i = 0; i < num_samples; i++)
126 functor(samples_x[i], fixed_param, samples_y[i]);
130 out_samples_y->clear();
131 samples_y.swap(*out_samples_y);
146 template <
class VECTORLIKE1,
class MATLIKE1,
class USERPARAM,
class VECTORLIKE2,
147 class VECTORLIKE3,
class MATLIKE2>
149 const VECTORLIKE1& x_mean,
const MATLIKE1& x_cov,
151 const VECTORLIKE1&
x,
const USERPARAM& fixed_param, VECTORLIKE3&
y),
152 const USERPARAM& fixed_param, VECTORLIKE2& y_mean, MATLIKE2& y_cov,
153 const VECTORLIKE1& x_increments)
157 functor(x_mean, fixed_param, y_mean);
159 Eigen::Matrix<double, VECTORLIKE3::RowsAtCompileTime,
160 VECTORLIKE1::RowsAtCompileTime>
163 x_mean, std::function<
void(
164 const VECTORLIKE1&
x,
const USERPARAM& fixed_param,
165 VECTORLIKE3&
y)>(functor),
166 x_increments, fixed_param, H);
167 H.multiply_HCHt(x_cov, y_cov);
GLclampf GLclampf GLclampf alpha
This file implements miscelaneous matrix and matrix/vector operations, and internal functions in mrpt...
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
void estimateJacobian(const VECTORLIKE &x, const std::function< void(const VECTORLIKE &x, const USERPARAM &y, VECTORLIKE3 &out)> &functor, const VECTORLIKE2 &increments, const USERPARAM &userParam, MATRIXLIKE &out_Jacobian)
Estimate the Jacobian of a multi-dimensional function around a point "x", using finite differences of...
This base provides a set of functions for maths stuff.
void covariancesAndMean(const VECTOR_OF_VECTORS &elements, MATRIXLIKE &covariances, VECTORLIKE &means, const bool *elem_do_wrap2pi=nullptr)
Computes covariances and mean of any vector of containers.
void drawGaussianMultivariateMany(VECTOR_OF_VECTORS &ret, size_t desiredSamples, const COVMATRIX &cov, const typename VECTOR_OF_VECTORS::value_type *mean=nullptr)
Generate a given number of multidimensional random samples according to a given covariance matrix...
void covariancesAndMeanWeighted(const VECTOR_OF_VECTORS &elements, MATRIXLIKE &covariances, VECTORLIKE &means, const VECTORLIKE2 *weights_mean, const VECTORLIKE3 *weights_cov, const bool *elem_do_wrap2pi=nullptr)
Computes covariances and mean of any vector of containers, given optional weights for the different s...
GLenum GLenum GLvoid * row
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.