#include "filter.h" using namespace std; template void Filter::predict() { for (int i=0; i=) in the cdf // TODO check that this works with the cdf double choice = (rand()/RAND_MAX )*cdf[cdf.size()-1]; int low, middle, high; low = 0; high = cdf.size(); while (high>(low+1)) { middle = (high+low)/2; if (choice > cdf[middle]) low = middle; else high = middle; } //FIXME model magic should happen here next[i] = cur[low]; } } template void Filter::makeCdf() { for (int i=0; i void Filter::updateSamples() { observe(); /* * pick some of the old samples and map them to new samples * using a model * picking is weighted */ predict(); makeCdf(); }