root/tests/test0.cpp @ 101

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

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
6using namespace itpp;
7
8//These lines are needed for use of cout and endl
9using std::cout;
10using std::endl;
11
12int 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:" << endl << Il.to_mat() << "eye:" << endl<< I <<endl;
41        getchar();
42
43        cout << "Test ldform()"<<endl;
44        mat V = "1 2; 2 13"; 
45        ldmat lV(V);
46        ldmat ilV(V); 
47        lV.inv(ilV);
48        cout << "ld:" << lV << "eye:"<< V*(ilV.to_mat()) <<endl;
49
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       
56
57        //Exit program:
58        getchar();
59        return 0;
60
61}
Note: See TracBrowser for help on using the browser.