root/tests/testSmp.cpp @ 31

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

prelozitelna verze

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);
20        eN.set_parameters(mu0,R);
21       
22        mat Smp = eN.sample(N);
23        cout << "True:" <<endl;
24        cout << "mu:" << mu0 ;
25        cout << "R:" << R ;
26        cout << "R:" << R.to_mat() ;
27       
28        vec Emu = Smp*ones(N) /N ;
29        cout << "Empirical:" <<endl;
30        cout << "mu:" << Emu;
31        cout << "R:" << (Smp*Smp.transpose())/N - Emu*Emu.transpose() <<endl;
32
33        //Exit program:
34        return 0;
35
36}
Note: See TracBrowser for help on using the browser.