11 using namespace Eigen;
16 const double surv_x_inf,
17 const double surv_x_sup,
18 const double surv_y_inf,
19 const double surv_y_sup,
20 const unsigned int num_particle_x,
21 const unsigned int num_particle_y
23 surv_x_inf_(surv_x_inf),
24 surv_x_sup_(surv_x_sup),
25 surv_y_inf_(surv_y_inf),
26 surv_y_sup_(surv_y_sup),
27 num_particle_x_(num_particle_x),
28 num_particle_y_(num_particle_y)
36 const unsigned int num_particle_x,
37 const unsigned int num_particle_y
40 num_particle_x, num_particle_y)
46 int num_particle = particles.
state().cols();
47 if (num_particle != num_particle_x_ * num_particle_y_)
50 double delta_surv_x = surv_x_sup_ - surv_x_inf_;
51 double delta_surv_y = surv_y_sup_ - surv_y_inf_;
53 for (
int i = 0; i < num_particle_x_; ++i)
54 for (
int j = 0; j < num_particle_y_; ++j)
55 particles.
state().col(i*num_particle_y_ + j) <<
static_cast<double>((delta_surv_x / (num_particle_x_ - 1)) * i + surv_x_inf_),
57 static_cast<double>((delta_surv_y / (num_particle_y_ - 1)) * j + surv_y_inf_),
60 particles.
weight().setConstant(-std::log(num_particle));