18 using namespace Eigen;
29 covariance((2 * dof) + 1)
44 std::size_t dof = vector_description.
dof_size();
46 mean.resize((2 * dof) + 1);
47 covariance.resize((2 * dof) + 1);
59 Ref<VectorXd> weight_mean,
60 Ref<VectorXd> weight_covariance,
64 double lambda = std::pow(alpha, 2.0) * (n + kappa) - n;
66 for (
int j = 0; j < ((2 * n) + 1); ++j)
70 weight_mean(j) = lambda / (n + lambda);
71 weight_covariance(j) = lambda / (n + lambda) + (1 - std::pow(alpha, 2.0) + beta);
75 weight_mean(j) = 1 / (2 * (n + lambda));
76 weight_covariance(j) = weight_mean(j);
88 for (std::size_t i = 0; i < state.
components; i++)
90 JacobiSVD<MatrixXd> svd = state.
covariance(i).jacobiSvd(ComputeThinU);
92 MatrixXd A = svd.matrixU() * svd.singularValues().cwiseSqrt().asDiagonal();
97 perturbations << VectorXd::Zero(state.
dim_covariance), std::sqrt(c) * A, -std::sqrt(c) * A;
139 std::tie(valid_fun_data, fun_data, output_description) =
function(input_sigma_points);
146 MatrixXd prop_sigma_points = bfl::any::any_cast<MatrixXd&&>(std::move(fun_data));
156 for (std::size_t i = 0; i < input.
components; i++)
158 const Ref<MatrixXd> input_sigma_points_i = input_sigma_points.middleCols(base * i, base);
159 const Ref<MatrixXd> prop_sigma_points_i = prop_sigma_points.middleCols(base * i, base);
174 MatrixXd offsets_from_mean(output.
dim_covariance, input_sigma_points_i.cols());
185 output.
covariance(i).noalias() = offsets_from_mean * weight.
covariance.asDiagonal() * offsets_from_mean.transpose();
199 cross_covariance_i.noalias() = input_offsets_from_mean * weight.
covariance.asDiagonal() * offsets_from_mean.transpose();
202 return std::make_tuple(
true, output, cross_covariance);
217 state_model.
motion(state, tmp);
221 MatrixXd cross_covariance;
225 return std::make_pair(output, cross_covariance);
238 MatrixXd tmp(state.rows(), state.cols());
245 MatrixXd cross_covariance;
251 for(std::size_t i = 0; i < state.
components; i++)
254 return std::make_pair(output, cross_covariance);
267 bool valid_prediction;
270 std::tie(valid_prediction, prediction) = meas_model.
predictedMeasure(state);
276 MatrixXd cross_covariance;
280 return std::make_tuple(valid, output, cross_covariance);
293 bool valid_prediction;
296 std::tie(valid_prediction, prediction) = meas_model.
predictedMeasure(state);
302 MatrixXd cross_covariance;
310 for (std::size_t i = 0; i < state.
components; i++)
313 return std::make_tuple(valid, output, cross_covariance);