6 for (vector<Particle>::const_iterator it=particles.begin(); it!=particles.end(); ++it){
12 Numeric interval=cweight/
n;
19 std::vector<int> indexes(
n);
22 for (vector<Particle>::const_iterator it=particles.begin(); it!=particles.end(); ++it, ++i){
24 while(cweight>target){
32 template <
class Numeric>
38 for (vector<Numeric>::const_iterator it=weights.begin(); it!=weights.end(); ++it){
44 Numeric interval=cweight/
n;
51 std::vector<int> indexes(
n);
54 for (vector<Numeric>::const_iterator it=weights.begin(); it!=weights.end(); ++it, ++i){
56 while(cweight>target){
82 template <
class State,
class Numeric,
class EvolutionModel>
84 for (std::vector<Particle>::const_iterator it=particles.begin(); it!=particles.end(); ++it)
85 *it=evolutionModel.evolve(*it);
90 for (std::vector<Particle>::const_iterator it=src.begin(); it!=src.end(); ++it)
91 dest.push_back(evolutionModel.evolve(*it));
94 template <
class State,
class Numeric,
class QualificationModel,
class EvolutionModel,
class LikelyhoodModel>
95 struct auxiliaryEvolver{
96 typedef particle<State, Numeric>
Particle;
101 indexResampler<Numeric> resampler;
103 void auxiliaryEvolver<State, Numeric, QualificationModel, EvolutionModel, LikelyhoodModel>::evolve
104 (std::vector<auxiliaryEvolver::Particle>&particles){
105 std::vector<Numeric> observationWeights(particles.size());
107 for (std::vector<Particle>::const_iterator it=particles.begin(); it!=particles.end(); ++it, i++){
108 observationWeights[i]=likelyhoodModel.
likelyhood(qualificationModel.
evolve(*it));
110 std::vector<unsigned int> indexes(indexResampler.resample(observationWeights));
111 for (std::vector<unsigned int>::const_iterator it=indexes.begin(); it!=indexes.end(); it++){
113 particle=evolutionModel.
evolve(particle);
114 particle.weight*=lykelyhoodModel.lykelyhood(particle)/observationWeights[*it];
118 void auxiliaryEvolver<State, Numeric, QualificationModel, EvolutionModel, LikelyhoodModel>::evolve
119 (std::vector<Particle>& dest,
const std::vector<Particle>& src){
121 std::vector<Numeric> observationWeights(particles.size());
123 for (std::vector<Particle>::const_iterator it=src.begin(); it!=src.end(); ++it, i++){
124 observationWeights[i]=likelyhoodModel.
likelyhood(qualificationModel.
evolve(*it));
126 std::vector<unsigned int> indexes(indexResampler.resample(observationWeights));
127 for (std::vector<unsigned int>::const_iterator it=indexes.begin(); it!=indexes.end(); it++){
129 dest.push_back(evolutionModel.
evolve(particle));
130 dest.back().weight*=likelyhoodModel.lykelyhood(particle)/observationWeights[*it];