11 #ifndef SSMPACK_FILTER_RESAMPLER_BASE
12 #define SSMPACK_FILTER_RESAMPLER_BASE
25 template <
template <
class>
class Method,
class Criterion>
31 BaseResampler(Criterion criterion) : criterion_(std::move(criterion)) {}
33 template <
class Particles,
class Weights>
40 auto u =
static_cast<Method<Criterion> *
>(
this)
41 ->generateOrderedNumbers(w.n_rows);
43 auto ws = arma::cumsum(w);
44 auto u_it = u.begin();
46 Particles old_pars = pars;
48 pars.each_col([&u_it, &old_pars,
49 &ws](arma::Col<typename Particles::elem_type> &col) {
51 static_cast<arma::uvec>(arma::find(ws > *u_it++, 1,
"first"))(0));
54 w.fill(1.0 / w.n_rows);
61 #endif //SSMPACK_FILTER_RESAMPLER_IDENTITY
void operator()(Particles &pars, Weights &w)
BaseResampler(Criterion criterion)