chmat_test.cpp itpp/itbase.h math/chmat.h int int main () main #include<itpp/itbase.h> #include<math/chmat.h> usingnamespaceitpp; //Theselinesareneededforuseofcoutandendl usingstd::cout; usingstd::endl; intmain(){ //Kalmanfilter matA0=randu(3,3); matA=A0*A0.T(); //Testconstructor chmatCh(A); cout<<"Testingconstructors:"<<endl <<"A="<<A<<endl <<"Ch.to_mat()="<<Ch.to_mat()<<endl<<endl; //Testinversion chmatiCh(3); Ch.inv(iCh); cout<<"inv(A)="<<inv(A)<<endl <<"inv(Ch).to_mat()="<<iCh.to_mat()<<endl<<endl; //Testlogdet cout<<"logdet(A)="<<log(det(A))<<endl <<"logdet(Ch)="<<Ch.logdet()<<endl<<endl; //Testadd chmatCh2(Ch); Ch2.add(Ch); cout<<"A+A="<<A+A<<endl <<"Ch2.add(Ch)="<<Ch2.to_mat()<<endl<<endl; vecv=randu(3); //Testqform cout<<"vAv'="<<v*(A*v)<<endl <<"qform(Ch,v)="<<Ch.qform(v)<<endl<<endl; //Testinvqform cout<<"vinv(A)v'="<<v*(inv(A)*v)<<endl <<"invqform(Ch,v)="<<Ch.invqform(v)<<endl<<endl; //Testopupdate Ch2=Ch; Ch2.opupdt(v,1.0); cout<<"A+vv'="<<A+outer_product(v,v)<<endl <<"opupdt(Ch,v)="<<Ch2.to_mat()<<endl<<endl; }