Revision 37, 1.2 kB
(checked in by smidl, 17 years ago)
|
Matrix in Cholesky decomposition, Square-root Kalman and many bug fixes
|
Line | |
---|
1 | #include <itpp/itbase.h> |
---|
2 | #include "../bdm/stat/libBM.h" |
---|
3 | #include "../bdm/math/libDC.h" |
---|
4 | #include "../bdm/math/chmat.h" |
---|
5 | |
---|
6 | using namespace itpp; |
---|
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 th = RV ( "1 2","{a b }","1 1","0 0"); |
---|
15 | RV r = RV ( "3 4" ); |
---|
16 | |
---|
17 | cout << th << r << endl; |
---|
18 | |
---|
19 | ldmat ld = ldmat("1 0;0.5 1","1.1 1.3"); |
---|
20 | vec v = "1 -0.1"; |
---|
21 | |
---|
22 | cout << "Test to_mat"<<endl; |
---|
23 | // cout << ld << endl; |
---|
24 | cout << ld.to_mat()<<endl; |
---|
25 | |
---|
26 | cout << "Test opupdt" <<endl; |
---|
27 | ldmat ldup = ld; |
---|
28 | ldup.opupdt(v,1); |
---|
29 | cout << ldup.to_mat()<<endl; |
---|
30 | |
---|
31 | cout << "Test +="<<endl; |
---|
32 | ldmat ld2x = ld; |
---|
33 | ld2x+=ld; |
---|
34 | cout << ld.to_mat() << ld2x.to_mat() <<endl; |
---|
35 | |
---|
36 | cout << "Test ldinv()"<<endl; |
---|
37 | ldmat Il = ld; |
---|
38 | ld.inv(Il); // |
---|
39 | mat I = Il.to_mat()*ld.to_mat(); |
---|
40 | cout << "ld:"<<Il.to_mat() << "eye:"<< I <<endl; |
---|
41 | |
---|
42 | cout << "Test ldform()"<<endl; |
---|
43 | mat V = "1 2; 2 13"; |
---|
44 | ldmat lV(V); |
---|
45 | ldmat ilV(V); |
---|
46 | lV.inv(ilV); |
---|
47 | cout << "ld:" << lV << "eye:"<< V*(ilV.to_mat()) <<endl; |
---|
48 | |
---|
49 | cout << "Test logdet()"<<endl; |
---|
50 | chmat chV(V); |
---|
51 | cout << "ch:" << chV.to_mat() <<endl; |
---|
52 | cout << "log(det(V)):"<< chV.logdet() <<endl; |
---|
53 | cout << "qform : " << chV.qform(ones(2)) <<endl; |
---|
54 | |
---|
55 | |
---|
56 | //Exit program: |
---|
57 | getchar(); |
---|
58 | return 0; |
---|
59 | |
---|
60 | } |
---|