libDC.h itpp/itbase.h work/git/mixpp/bdm/stat/libEF.h work/git/mixpp/bdm/math/chmat.h work/git/mixpp/bdm/estim/libPF.h work/git/mixpp/bdm/math/libDC.cpp work/git/mixpp/tests/fsqmat_test.cpp work/git/mixpp/tests/ldmat_test.cpp work/git/mixpp/tests/rv_test.cpp work/git/mixpp/tests/test0.cpp work/git/mixpp/tests/testPF.cpp work/git/mixpp/tests/testResample.cpp sqmat fsqmat ldmat void void dydr (double *r, double *f, double *Dr, double *Df, double *R, int jl, int jh, double *kr, int m, int mx) dydr double * r double * f double * Dr double * Df double * R int jl int jh double * kr int m int mx Auxiliary function dydr; dyadic reduction. mat mat ltuinv (const mat &L) ltuinv const mat & L Auxiliary function ltuinv; inversion of a triangular matrix;. sqmat::dim ldmat::L Matrices in decomposed forms (LDL', LU, UDU', etc). Vaclav Smidl. ----------------------------------- BDM++ - C++ library for Bayesian Decision Making under UncertaintyUsing IT++ for numerical operations ----------------------------------- #ifndefDC_H #defineDC_H #include<itpp/itbase.h> usingnamespaceitpp; voiddydr(double*r,double*f,double*Dr,double*Df,double*R,intjl,intjh,double*kr,intm,intmx); //TODOcanbedonevia:dtrtri.ffromlapack matltuinv(constmat&L); classsqmat { public: virtualvoidopupdt(constvec&v,doublew)=0; virtualmatto_mat()=0; virtualvoidmult_sym(constmat&C)=0; virtualvoidmult_sym_t(constmat&C)=0; virtualdoublelogdet()const=0; virtualvecsqrt_mult(constvec&v)const=0; virtualdoubleqform(constvec&v)const=0; virtualdoubleinvqform(constvec&v)const=0; ////!easyversionofthe //sqmatinv(); virtualvoidclear()=0; intcols()const{returndim;}; introws()const{returndim;}; virtual~sqmat(){}; sqmat(constintdim0):dim(dim0){}; protected: intdim; }; classfsqmat:publicsqmat { protected: matM; public: voidopupdt(constvec&v,doublew); matto_mat(); voidmult_sym(constmat&C); voidmult_sym_t(constmat&C); voidmult_sym(constmat&C,fsqmat&U)const; voidmult_sym_t(constmat&C,fsqmat&U)const; voidclear(); fsqmat();//matwillbeinitializedOK fsqmat(constintdim0);//matwillbeinitializedOK fsqmat(constmat&M); fsqmat(constvec&d):sqmat(d.length()){M=diag(d);}; virtual~fsqmat(){}; virtualvoidinv(fsqmat&Inv); doublelogdet()const{returnlog(det(M));}; doubleqform(constvec&v)const{return(v*(M*v));}; doubleinvqform(constvec&v)const{return(v*(itpp::inv(M)*v));}; vecsqrt_mult(constvec&v)const{matCh=chol(M);returnCh*v;}; voidadd(constfsqmat&fsq2,doublew=1.0){M+=fsq2.M;}; voidsetD(constvec&nD){M=diag(nD);} vecgetD(){returndiag(M);} voidsetD(constvec&nD,inti){for(intj=i;j<nD.length();j++){M(j,j)=nD(j-i);}}//Fixmecanbemoregeneral fsqmat&operator += (constfsqmat&A){M+=A.M;return*this;}; fsqmat&operator -= (constfsqmat&A){M-=A.M;return*this;}; fsqmat&operator *= (doublex){M*=x;return*this;}; //fsqmat&operator=(constfsqmat&A){M=A.M;return*this;}; friendstd::ostream&operator<< (std::ostream&os,constfsqmat&sq); }; classldmat:sqmat { public: ldmat(constmat&L,constvec&D); ldmat(constmat&V); ldmat(vecD0); ldmat(); ldmat(constintdim0); virtual~ldmat(){}; //Reimplementationofcompulsoryoperatios voidopupdt(constvec&v,doublew); matto_mat(); voidmult_sym(constmat&C); voidmult_sym_t(constmat&C); voidadd(constldmat&ld2,doublew=1.0); doublelogdet()const; doubleqform(constvec&v)const; doubleinvqform(constvec&v)const; //sqmat&operator-=(constsqmat&ld2); voidclear(); intcols()const; introws()const; vecsqrt_mult(constvec&v)const; virtualvoidinv(ldmat&Inv)const; voidmult_sym(constmat&C,ldmat&U)const; voidmult_sym_t(constmat&C,ldmat&U)const; voidldform(constmat&A,constvec&D0); voidsetD(constvec&nD){D=nD;} voidsetD(constvec&nD,inti){D.replace_mid(i,nD);}//Fixmecanbemoregeneral voidsetL(constvec&nL){L=nL;} constvec&_D()const{returnD;} constmat&_L()const{returnL;} ldmat&operator += (constldmat&ldA); ldmat&operator -= (constldmat&ldA); ldmat&operator *= (doublex); friendstd::ostream&operator<< (std::ostream&os,constldmat&sq); protected: vecD; matL; }; inlineldmat&ldmat::operator += (constldmat&ldA){this->add(ldA);return*this;} inlineldmat&ldmat::operator -= (constldmat&ldA){this->add(ldA,-1.0);return*this;} inlineintldmat::cols()const{returndim;} inlineintldmat::rows()const{returndim;} #endif//DC_H