Revision 101, 1.2 kB
(checked in by mido, 16 years ago)
|
drobny update LDcek - vse je nyni prinejhorsim tak, jako v Matlabu, z nej uz tedy pro LD nic nevzejde; doplneni chybejicich slov INLINE do prislusneho headru
|
Rev | Line | |
---|
[1] | 1 | #include <itpp/itbase.h> |
---|
[15] | 2 | #include "../bdm/stat/libBM.h" |
---|
| 3 | #include "../bdm/math/libDC.h" |
---|
[37] | 4 | #include "../bdm/math/chmat.h" |
---|
[1] | 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 | { |
---|
[32] | 14 | RV th = RV ( "1 2","{a b }","1 1","0 0"); |
---|
[7] | 15 | RV r = RV ( "3 4" ); |
---|
[1] | 16 | |
---|
[7] | 17 | cout << th << r << endl; |
---|
[1] | 18 | |
---|
[32] | 19 | ldmat ld = ldmat("1 0;0.5 1","1.1 1.3"); |
---|
[7] | 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(); |
---|
[101] | 40 | cout << "ld:" << endl << Il.to_mat() << "eye:" << endl<< I <<endl; |
---|
| 41 | getchar(); |
---|
[7] | 42 | |
---|
[18] | 43 | cout << "Test ldform()"<<endl; |
---|
[28] | 44 | mat V = "1 2; 2 13"; |
---|
[18] | 45 | ldmat lV(V); |
---|
[24] | 46 | ldmat ilV(V); |
---|
| 47 | lV.inv(ilV); |
---|
| 48 | cout << "ld:" << lV << "eye:"<< V*(ilV.to_mat()) <<endl; |
---|
[7] | 49 | |
---|
[37] | 50 | cout << "Test logdet()"<<endl; |
---|
| 51 | chmat chV(V); |
---|
| 52 | cout << "ch:" << chV.to_mat() <<endl; |
---|
| 53 | cout << "log(det(V)):"<< chV.logdet() <<endl; |
---|
| 54 | cout << "qform : " << chV.qform(ones(2)) <<endl; |
---|
| 55 | |
---|
[18] | 56 | |
---|
[5] | 57 | //Exit program: |
---|
[35] | 58 | getchar(); |
---|
[5] | 59 | return 0; |
---|
[1] | 60 | |
---|
| 61 | } |
---|