120 double lambda = 10.0,
121 double initValue = 0.0) :
125 particles_.resize(nParticles, initValue);
128 void init(
double initValue = 0.0f)
130 particles_ = std::vector<double>(particles_.size(), initValue);
133 double filter(
double val)
135 std::vector<double> weights(particles_.size(), 1);
136 double sumWeights = 0;
137 for(
unsigned int i=0; i<particles_.size(); ++i)
140 particles_[i] += noise_ * RANDN;
143 double dist = fabs(particles_[i] - val);
145 double w = exp(-lambda_*dist);
150 sumWeights += weights[i];
156 for(
unsigned int i=0; i<weights.size(); ++i)
158 weights[i] /= sumWeights;
159 value += weights[i] * particles_[i];
163 particles_ = resample(particles_, weights,
false);
169 std::vector<double> particles_;