ldmat_test.cpp itpp/itbase.h math/libDC.h int int main () main #include<itpp/itbase.h> #include<math/libDC.h> usingnamespaceitpp; //Theselinesareneededforuseofcoutandendl usingstd::cout; usingstd::endl; intmain(){ //Kalmanfilter matA0=randu(3,3); matA=A0*A0.T(); //Testconstructor ldmatLD(A); cout<<"Testingconstructors:"<<endl <<"A="<<A<<endl <<"LD.to_mat()="<<LD.to_mat()<<endl<<endl; //Testinversion ldmatiLD(3); LD.inv(iLD); cout<<"inv(A)="<<inv(A)<<endl <<"inv(LD).to_mat()="<<iLD.to_mat()<<endl<<endl; //Testlogdet cout<<"logdet(A)="<<log(det(A))<<endl <<"logdet(LD)="<<LD.logdet()<<endl<<endl; //Testadd ldmatLD2(LD); LD2.add(LD); cout<<"A+A="<<A+A<<endl <<"LD2.add(LD)="<<LD2.to_mat()<<endl<<endl; vecv=randu(3); //Testqform cout<<"vAv'="<<v*(A*v)<<endl <<"qform(LD,v)="<<LD.qform(v)<<endl<<endl; //Testinvqform cout<<"vinv(A)v'="<<v*(inv(A)*v)<<endl <<"invqform(LD,v)="<<LD.invqform(v)<<endl<<endl; //Testopupdate LD2=LD; LD2.opupdt(v,1.0); cout<<"A+vv'="<<A+outer_product(v,v)<<endl <<"opupdt(LD,v)="<<LD2.to_mat()<<endl<<endl; }