root/tests/testResample.cpp @ 254

Revision 254, 0.7 kB (checked in by smidl, 15 years ago)

create namespace bdm

Line 
1#include <itpp/itbase.h>
2#include <estim/libPF.h>
3#include <math/libDC.h>
4#include <stat/libEF.h>
5
6using namespace bdm;
7
8//These lines are needed for use of cout and endl
9using std::cout;
10using std::endl;
11
12int main() {
13
14        RV x("1");
15        RV xm=x; xm.t(-1);const
16        RV y("2");
17       
18        mat A = "1";
19        vec vR = "1";
20        ldmat R(vR);
21               
22        eEmp emp(x,10);
23        euni eun(x);
24        eun.set_parameters("0","1");
25        emp.set_parameters(ones(10),&eun);
26        vec &v=emp._w();
27        Array<vec> &S=emp._samples();
28       
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);
31       
32        cout << "p:" << S << endl;
33        cout << "w:" << v << endl;
34       
35        ivec ind = emp.resample();
36       
37        cout << ind << endl;
38       
39        //Exit program:
40        return 0;
41
42}
Note: See TracBrowser for help on using the browser.