Revision 22, 0.7 kB
(checked in by smidl, 17 years ago)
|
upravy Kalmana
|
Line | |
---|
1 | #include <itpp/itbase.h> |
---|
2 | #include <stat/libEF.h> |
---|
3 | |
---|
4 | using namespace itpp; |
---|
5 | |
---|
6 | //These lines are needed for use of cout and endl |
---|
7 | using std::cout; |
---|
8 | using std::endl; |
---|
9 | |
---|
10 | int 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 | } |
---|