root/tests/testSmp.cpp @ 24

Revision 22, 0.7 kB (checked in by smidl, 16 years ago)

upravy Kalmana

Line 
1#include <itpp/itbase.h>
2#include <stat/libEF.h>
3
4using namespace itpp;
5
6//These lines are needed for use of cout and endl
7using std::cout;
8using std::endl;
9
10int main() {
11
12        //RNG_randomize();
13
14        RV rv("1","{x }","2","0","0");
15        int N = 10000; //number of samples
16        vec mu0 = "1.5 1.7";
17        mat V0("1.2 0.3; 0.3 5");
18        ldmat R = ldmat(V0);
19        enorm<ldmat> eN(rv,mu0,R);
20       
21        mat Smp = eN.sample(N);
22        cout << "True:" <<endl;
23        cout << "mu:" << mu0 ;
24        cout << "R:" << R ;
25        cout << "R:" << R.to_mat() ;
26       
27        vec Emu = Smp*ones(N) /N ;
28        cout << "Empirical:" <<endl;
29        cout << "mu:" << Emu;
30        cout << "R:" << (Smp*Smp.transpose())/N - Emu*Emu.transpose() <<endl;
31
32        //Exit program:
33        return 0;
34
35}
Note: See TracBrowser for help on using the browser.