root/tests/testPF.cpp
@
283
Revision 283, 0.6 kB (checked in by smidl, 15 years ago) | |
---|---|
|
Rev | Line | |
---|---|---|
[262] | 1 | |
[19] | 2 | #include <estim/libPF.h> |
3 | #include <math/libDC.h> | |
4 | #include <stat/libEF.h> | |
[8] | 5 | |
[254] | 6 | using namespace bdm; |
[8] | 7 | |
8 | //These lines are needed for use of cout and endl | |
9 | using std::cout; | |
10 | using std::endl; | |
11 | ||
12 | int main() { | |
13 | ||
14 | RV x("1"); | |
[32] | 15 | RV xm=x; xm.t(-1);const |
[8] | 16 | RV y("2"); |
17 | ||
18 | mat A = "1"; | |
[19] | 19 | vec vR = "1"; |
20 | ldmat R(vR); | |
[32] | 21 | |
[270] | 22 | eEmp emp; |
23 | euni eun; | |
[32] | 24 | eun.set_parameters("0","1"); |
[283] | 25 | emp.set_statistics(ones(10),&eun); |
[32] | 26 | vec &v=emp._w(); |
27 | Array<vec> &S=emp._samples(); | |
[8] | 28 | |
[32] | 29 | for (int i=0;i<10;i++){ v(i) = exp(-0.5*sum(pow(S(i)-1,2.0))*10);} |
30 | v/=sum(v); | |
[11] | 31 | |
[32] | 32 | cout << "p:" << S << endl; |
33 | cout << "w:" << v << endl; | |
[11] | 34 | |
[32] | 35 | ivec ind = emp.resample(); |
[11] | 36 | |
37 | cout << ind << endl; | |
[8] | 38 | |
39 | //Exit program: | |
40 | return 0; | |
41 | ||
42 | } |
Note: See TracBrowser
for help on using the browser.