Changeset 182

Show
Ignore:
Timestamp:
10/17/08 10:28:15 (16 years ago)
Author:
smidl
Message:

compilation error!

Files:
14 modified

Legend:

Unmodified
Added
Removed
  • bdm/estim/arx.cpp

    r180 r182  
    6262         
    6363        est.mean_mat(mu,R); 
     64        //here I know that mu can have only one column 
    6465        tmp->set_parameters(mu.get_col(0),ldmat(R)); 
    6566        return tmp; 
  • bdm/estim/merger.cpp

    r180 r182  
    1717                case 4: 
    1818                        break; 
     19                default: // Approximate conditional density 
     20                        break; 
    1921        } 
    2022        return vec ( 0 ); 
     
    3436        for ( int i=0;i<Ns;i++ ) {      set_col_part ( Smp_ex,i,Smp ( i ) );} 
    3537 
    36         dbg << Name ( "Smp0" ) << Smp_ex; 
     38        dbg << Name ( "Smp_0" ) << Smp_ex; 
    3739 
    3840        // Stuff for merging 
     
    4547        mat V0=1e-8*eye ( rv.count() +1 ); 
    4648        ARX A0 ( RV ( "{th_r  }", vec_1 ( rv.count() * ( rv.count() +1 ) ) ),\ 
    47                  V0, 4.0 ); //initial guess of Mix: zero mean, large variance 
     49                 V0, rv.count() *rv.count() +3.0 ); //initial guess of Mix: zero mean, large variance 
    4850 
    4951 
     
    5355        int niter = 0; 
    5456        char str[100]; 
    55          
    56         vec Mix_pdf(Ns); 
     57 
     58        epdf* Mpred; 
     59        vec Mix_pdf ( Ns ); 
    5760        while ( !converged ) { 
    5861                //Re-estimate Mix 
     
    6063                Mix.init ( &A0, Smp_ex, Nc ); 
    6164                Mix.bayesB ( Smp_ex ); 
    62  
     65                Mpred = Mix.predictor(rv); // Allocation => must be deleted at the end!! 
     66         
    6367                // Generate new samples 
    64                 eSmp.set_samples ( Mix.predictor ( rv ) ); 
     68                eSmp.set_samples ( Mpred ); 
    6569                for ( int i=0;i<Ns;i++ ) {      set_col_part ( Smp_ex,i,Smp ( i ) );} 
    6670 
    6771                sprintf ( str,"Mpdf%d",niter ); 
    68                 for (int i=0;i<Ns;i++){Mix_pdf(i) = Mix.logpred(Smp_ex.get_col(i));} 
     72                for ( int i=0;i<Ns;i++ ) {Mix_pdf ( i ) = Mix.logpred ( Smp_ex.get_col ( i ) );} 
    6973                dbg << Name ( str ) << Mix_pdf; 
    7074 
     
    7478                //Importace weighting 
    7579                for ( int i=0;i<n;i++ ) { 
     80                        lw_src=0.0; 
     81                        //======== Same RVs =========== 
    7682                        //Split according to dependency in rvs 
    77                         //======== Same RVs =========== 
    7883                        if ( rvsinrv ( i ).length() ==rv.count() ) { 
    7984                                // no need for conditioning or marginalization 
    80                                 for ( int j=0;j<Ns;j++ ) { 
     85                                for ( int j=0;j<Ns; j++ ) { // Smp is Array<> => for cycle 
    8186                                        lw_src ( j ) =mpdfs ( i )->_epdf().evalpdflog ( Smp ( j ) ); 
     87                                } 
     88                        } 
     89                        else { 
     90                                vec smpk; 
     91                                // compute likelihood of marginal on the conditional variable 
     92                                if ( mpdfs ( i )->_rvc().count() >0 ) { 
     93                                        // Make marginal on rvc_i 
     94                                        epdf* tmp_marg = Mpred->marginal ( mpdfs ( i )->_rvc() ); 
     95                                        lw_src += tmp_marg->evalpdflog_m ( get_vec(Smp(i), irv_rvcs(i) ) ); 
     96                                        delete tmp_marg; 
     97                                } 
     98                                // Compute likelihood of the missing variable 
     99                                if ( rv.count() > mpdfs ( i )->_rv().count() + mpdfs ( i )->_rvc().count() ) { 
     100                                        // There are variales unknown to mpdfs 
     101                                        RV z = ( rv.subt ( mpdfs ( i )->_rv() ) ).subt ( mpdfs ( i )->_rvc() ); 
     102                                        mpdf* tmp_cond = Mpred->condition ( z );  
     103                                        // Indeces of rest rv in Smp 
     104                                        ivec zinrv=z.dataind ( rv ) ; 
     105                                        // Indeces of rest rvc in Smp 
     106                                        ivec zinrvc=tmp_cond->_rvc().dataind ( rv ); 
     107                                        // Compute likelihood 
     108                                        for ( int k= 0; k<Ns; k++ ) { 
     109                                                smpk=Smp( k ); 
     110                                                tmp_cond->condition ( get_vec ( smpk,zinrvc ) ); 
     111                                                lw_src ( k ) += tmp_cond->_epdf().evalpdflog ( get_vec ( smpk,zinrv ) ); 
     112                                        } 
     113                                        delete tmp_cond; 
     114                                } 
     115                                // Compute likelihood of the partial source 
     116                                for ( int k= 0; k<Ns; k++ ) { 
     117                                        smpk=Smp( k ); 
     118                                        mpdfs ( i )->condition ( get_vec ( smpk,irvcs_rv(i) ) ); 
     119                                        lw_src ( k ) += mpdfs ( i )->_epdf().evalpdflog ( get_vec ( smpk, rvsinrv ( i ) ) ); 
    82120                                } 
    83121                        } 
     
    92130 
    93131                w = lognorm_merge ( lW ); //merge 
    94  
     132                 
    95133                sprintf ( str,"w%d",niter ); 
    96134                dbg << Name ( str ) << w; 
     135                sprintf ( str,"lw_m%d",niter ); 
     136                dbg << Name ( str ) << lw_mix; 
    97137 
    98138                //Importance weighting 
     
    100140                //renormalize 
    101141                w /=sum ( w ); 
     142 
     143                sprintf ( str,"w_is_%d",niter ); 
     144                dbg << Name ( str ) << w; 
    102145 
    103146                eSmp.resample(); // So that it can be used in bayes 
     
    109152                // ==== stopping rule === 
    110153                niter++; 
    111                 converged = ( niter>3 ); 
     154                converged = ( niter>20); 
    112155        } 
    113156 
  • bdm/estim/merger.h

    r180 r182  
    6060        //! weight w is a 
    6161        vec sample ( )const { return Mix._epdf().sample();} 
    62         double evalpdflog ( const vec &dt ) const{ vec dtf=zeros(dt.length()+1); dtf.set_subvector(0,dt); return Mix.logpred ( dtf );} 
     62        double evalpdflog ( const vec &dt ) const{  
     63                vec dtf=ones(dt.length()+1);     
     64                dtf.set_subvector(0,dt);  
     65                return Mix.logpred ( dtf );} 
    6366        vec mean()const {return Mix._epdf().mean();} 
    6467        //! for future use 
    6568        virtual ~merger() {}; 
     69         
     70        //! Access function 
     71        MixEF& _Mix() {return Mix;} 
    6672}; 
    6773 
  • bdm/stat/emix.cpp

    r181 r182  
    3131} 
    3232 
    33 // mprod::mprod ( Array<mpdf*> mFacs, bool overlap) : mpdf ( RV(), RV() ), n ( mFacs.length() ), epdfs ( n ), mpdfs ( mFacs ), rvinds ( n ), rvcinrv ( n ), rvcsinrvc ( n ) { 
     33emix* emix::marginal(const RV &rv) const{ 
     34        Array<epdf*> Cn(Coms.length()); 
     35        for(int i=0;i<Coms.length();i++){Cn(i)=Coms(i)->marginal(rv);} 
     36        emix* tmp = new emix(rv); 
     37        tmp->set_parameters(w,Coms,false); 
     38        tmp->ownComs(); 
     39        return tmp; 
     40} 
     41 
     42mratio* emix::condition(const RV &rv) const{ 
     43        return new mratio(this,rv); 
     44}; 
     45 
     46// mprod::mprod ( Array<mpdf*> mFacs, bool overlap) : mpdf ( RV(), RV() ), n ( mFacs.length() ), epdfs ( n ), mpdfs ( mFacs ), rvinds ( n ), rvcinrv ( n ), irvcs_rvc ( n ) { 
    3447//              int i; 
    3548//              bool rvaddok; 
     
    5467//                      rvcinrv ( i ) = mpdfs ( i )->_rvc().dataind ( rv ); 
    5568//                      // find ith rvc in common rv 
    56 //                      rvcsinrvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc ); 
     69//                      irvcs_rvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc ); 
    5770//                      // 
    5871// /*                   if ( rvcinrv ( i ).length() >0 ) {independent = false;} 
    59 //                      if ( rvcsinrvc ( i ).length() >0 ) {independent = false;}*/ 
     72//                      if ( irvcs_rvc ( i ).length() >0 ) {independent = false;}*/ 
    6073//              } 
    6174//      }; 
  • bdm/stat/emix.h

    r181 r182  
    1919 
    2020using namespace itpp; 
     21 
     22//this comes first because it is used inside emix! 
     23 
     24/*! \brief Class representing ratio of two densities 
     25which arise e.g. by applying the Bayes rule. 
     26It represents density in the form: 
     27\f[ 
     28f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} 
     29\f] 
     30where \f$ f(rvc) = \int f(rv,rvc) d\ rv \f$. 
     31 
     32In particular this type of arise by conditioning of a mixture model. 
     33 
     34At present the only supported operation is evalcond(). 
     35 */ 
     36class mratio: public mpdf { 
     37        protected: 
     38        //! Nominator in the form of mpdf 
     39                const epdf* nom; 
     40        //!Denominator in the form of epdf 
     41                epdf* den; 
     42        //!flag for destructor  
     43                bool destroynom; 
     44        public: 
     45        //!Default constructor. By default, the given epdf is not copied!  
     46        //! It is assumed that this function will be used only temporarily. 
     47                mratio(const epdf* nom0, const RV &rv, bool copy=false):mpdf(rv,RV()){ 
     48                        if (copy){ 
     49//                      nom = nom0->_copy_(); 
     50                                destroynom=true; 
     51                        } else { 
     52                                nom = nom0; 
     53                                destroynom = false; 
     54                        } 
     55                        rvc = nom->_rv().subt(rv); 
     56                        it_assert_debug(rvc.length()>0,"Makes no sense to use this object!"); 
     57                        den = nom->marginal(rvc); 
     58                }; 
     59                double evalcond(const vec &val, const vec &cond) const { 
     60                        return exp(nom->evalpdflog(concat(val,cond)) - den->evalpdflog(cond)); 
     61                } 
     62        //! Object takes ownership of nom and will destroy it 
     63                void ownnom(){destroynom=true;} 
     64        //! Default destructor 
     65                ~mratio(){delete den; if (destroynom) {delete nom;}} 
     66}; 
    2167 
    2268/*! 
     
    4187        //!Default constructor 
    4288        emix ( const RV &rv ) : epdf ( rv ) {}; 
    43         //! Set weights \c w and components \c Coms , Coms are not copied! 
     89        //! Set weights \c w and components \c Coms 
     90        //!By default Coms are copied inside. \param copy can be set to false if Coms live externally. Use method ownComs() if Coms should be destroyed by the destructor. 
    4491        void set_parameters ( const vec &w, const Array<epdf*> &Coms, bool copy=true ); 
    4592 
     
    56103                return log ( sum ); 
    57104        }; 
     105        vec evalpdflog_m ( const mat &Val ) const { 
     106                vec x=ones(Val.cols()); 
     107                vec y(Val.cols()); 
     108                for (int i = 0; i < w.length(); i++ ) { 
     109                        y = w ( i )*exp(Coms ( i )->evalpdflog_m ( Val ) ); 
     110                        elem_mult_inplace(y,x); //result is in x 
     111                } 
     112                return log(x); 
     113        }; 
     114 
     115        emix* marginal ( const RV &rv ) const; 
     116        mratio* condition ( const RV &rv ) const; //why not mratio!! 
    58117 
    59118//Access methods 
     
    78137        Array<epdf*> epdfs; 
    79138        //! Indeces of rvc in common rvc 
    80         Array<ivec> rvcsinrvc; 
     139        Array<ivec> irvcs_rvc; 
    81140        //! Indeces of common rvc in rvcs 
    82         Array<ivec> rvcinrvcs; 
     141        Array<ivec> irvc_rvcs; 
    83142public: 
    84143        /*!\brief Constructor from list of mFacs, 
    85144        */ 
    86         mprod ( Array<mpdf*> mFacs ) : compositepdf ( mFacs ), mpdf ( getrv ( true ),RV() ), epdfs ( n ), rvcsinrvc ( n ) { 
     145        mprod ( Array<mpdf*> mFacs ) : compositepdf ( mFacs ), mpdf ( getrv ( true ),RV() ), epdfs ( n ), irvcs_rvc ( n ), irvc_rvcs ( n ) { 
    87146                setrvc ( rv,rvc ); 
    88147                setindices ( rv ); 
    89148                for ( int i = 0;i < n;i++ ) { 
    90                         // find ith rvc in common rv 
    91                         rvcsinrvc ( i ) = mpdfs ( i )->_rvc().dataind ( rvc ); 
    92                         //and vice-versa 
    93                         rvcinrvcs ( i ) = rvc.dataind ( mpdfs ( i )->_rvc() ); 
     149                        // establish link between rvc and rvcs 
     150                        rvc.dataind ( mpdfs ( i )->_rvc(), irvc_rvcs ( i ), irvcs_rvc ( i ) ); 
    94151                } 
    95152 
     
    99156        }; 
    100157 
    101         double evalcond ( const vec &val, const vec &cond ) const { 
     158        double evalcond ( const vec &val, const vec &cond ) { 
    102159                int i; 
    103160                double res = 0.0; 
    104161                vec condi; 
    105                 for ( i = n - 1;i > 0;i++ ) { 
    106                         if ( ( rvcsinrvc ( i ).length() > 0 ) || ( rvcsinrv ( i ).length() > 0 ) ) { 
    107                                 condi = zeros ( rvcsinrvc ( i ).length() +rvcsinrv ( i ).length() ); 
     162                for ( i = n - 1;i >= 0;i-- ) { 
     163                        if ( ( irvcs_rvc ( i ).length() > 0 ) || ( irvcs_rv ( i ).length() > 0 ) ) { 
     164                                condi = zeros ( irvcs_rvc ( i ).length() +irvcs_rv ( i ).length() ); 
    108165                                //copy part of the rvc into condi 
    109                                 set_subvector ( condi, rvcinrvcs ( i ), get_vec ( cond,rvcsinrvc ( i ) ) ); 
     166                                set_subvector ( condi, irvcs_rvc ( i ), get_vec ( cond,irvc_rvcs ( i ) ) ); 
    110167                                //copy part of the rv into condi 
    111                                 set_subvector ( condi, rvinrvcs ( i ), get_vec ( val,rvcsinrv ( i ) ) ); 
     168                                set_subvector ( condi, irvcs_rv ( i ), get_vec ( val,irv_rvcs ( i ) ) ); 
    112169                                mpdfs ( i )->condition ( condi ); 
    113170                        } 
     
    115172                        res += epdfs ( i )->evalpdflog ( val ( rvsinrv ( i ) ) ); 
    116173                } 
    117                 return res; 
     174                return exp ( res ); 
    118175        } 
    119176        vec samplecond ( const vec &cond, double &ll ) { 
     
    123180                ll = 0; 
    124181                for ( int i = ( n - 1 );i >= 0;i-- ) { 
    125                         if ( ( rvcsinrvc ( i ).length() > 0 ) || ( rvcsinrv ( i ).length() > 0 ) ) { 
    126                                 condi = zeros ( rvcsinrv ( i ).length() + rvcsinrvc ( i ).length() ); 
     182                        if ( ( irvcs_rvc ( i ).length() > 0 ) || ( irvcs_rv ( i ).length() > 0 ) ) { 
     183                                condi = zeros ( irvcs_rv ( i ).length() + irvcs_rvc ( i ).length() ); 
    127184                                // copy data in condition 
    128                                 set_subvector ( condi,rvcsinrvc ( i ), cond ); 
     185                                set_subvector ( condi,irvcs_rvc ( i ), get_vec ( cond, irvc_rvcs ( i ) ) ); 
    129186                                // copy data in already generated sample 
    130                                 set_subvector ( condi,rvinrvcs ( i ), get_vec ( smp,rvcsinrv ( i ) ) ); 
     187                                set_subvector ( condi,irvcs_rv ( i ), get_vec ( smp,irv_rvcs ( i ) ) ); 
    131188 
    132189                                mpdfs ( i )->condition ( condi ); 
     
    220277        }; 
    221278}; 
     279 
    222280#endif //MX_H 
  • bdm/stat/libBM.cpp

    r181 r182  
    151151                } 
    152152        } 
     153        it_assert_debug(res.length()==tsize,"this rv is not fully present in crv!"); 
    153154        return res; 
    154155 
     156} 
     157 
     158void RV::dataind (const RV &rv2, ivec &selfi, ivec &rv2i) const { 
     159        //clean results 
     160        selfi.set_size(0); 
     161        rv2i.set_size(0); 
     162         
     163        // just in case any rv is empty 
     164        if ((len==0)||(rv2.length()==0)){return;}  
     165         
     166        //find comon rv 
     167        ivec cids=itpp::find(this->findself(rv2)>=0); 
     168         
     169        // index of  
     170        if ( cids.length()>0 ) { 
     171                str str1 = tostr(); 
     172                str str2 = rv2.tostr();  
     173                 
     174                ivec part1; 
     175                ivec part2; 
     176                int i,j; 
     177                // find common rv in strs 
     178                for ( j=0; j < cids.length();j++ ) { 
     179                        i = cids(j); 
     180                        part1 = itpp::find ( ( str1.ids == ids ( i ) ) & ( str1.times == times ( i ) ) ); 
     181                        part2 = itpp::find ( ( str2.ids == ids ( i ) ) & ( str2.times == times ( i ) ) ); 
     182                        selfi = concat ( selfi, part1 ); 
     183                        rv2i = concat ( rv2i, part2 ); 
     184                } 
     185        } 
     186        it_assert_debug(selfi.length() == rv2i.length(),"this should not happen!"); 
    155187} 
    156188 
     
    206238                // find ith rv in common rv 
    207239                rvsinrv ( i ) = mpdfs ( i )->_rv().dataind ( rv ); 
    208                 rvcsinrv ( i ) = mpdfs ( i )->_rvc().dataind ( rv ); 
    209                 rvinrvcs ( i ) = rv.dataind(mpdfs ( i )->_rvc()); 
    210                 //rvcsinrv and rvinrvcs must be 1-to-1 
    211                 it_assert_debug(rvcsinrv ( i ).length()==rvinrvcs(i).length(),"" ); 
     240                // establish link between rv and rvc 
     241                rv.dataind(mpdfs(i)->_rvc(), irv_rvcs(i), irvcs_rv(i)); 
    212242        } 
    213243} 
  • bdm/stat/libBM.h

    r181 r182  
    9292        //! generate \c str from rv, by expanding sizes 
    9393        str tostr() const; 
    94         //! generate indeces into \param crv data vector that form data vector of self. 
     94        //! when this rv is a part of bigger rv, this function returns indeces of self in the data vector of the bigger crv.   
     95        //! Then, data can be copied via: data_of_this = cdata(ind); 
    9596        ivec dataind(const RV &crv) const; 
     97        //! generate mutual indeces when copying data betwenn self and crv.  
     98        //! Data are copied via: data_of_this(selfi) = data_of_rv2(rv2i) 
     99        void dataind(const RV &rv2, ivec &selfi, ivec &rv2i) const; 
    96100 
    97101        //!access function 
     
    178182        } 
    179183        //! Return conditional density on the given RV, the remaining rvs will be in conditioning 
    180         mpdf* condition(const RV &rv){it_warning("Not implemented"); return NULL;} 
     184        virtual mpdf* condition(const RV &rv) const {it_warning("Not implemented"); return NULL;} 
    181185        //! Return marginal density on the given RV, the remainig rvs are intergrated out 
    182         epdf* marginal(const RV &rv){it_warning("Not implemented"); return NULL;} 
     186        epdf* marginal(const RV &rv) const {it_warning("Not implemented"); return NULL;} 
    183187 
    184188        //! return expected value 
     
    248252        //!Default constructor 
    249253        mepdf (epdf &em ) :mpdf ( em._rv(),RV() ) {ep=&em;}; 
     254        void condition(const vec &cond){} 
    250255}; 
    251256 
     
    260265                Array<ivec> rvsinrv; 
    261266                //! Indeces of rvc in common rv 
    262                 Array<ivec> rvcsinrv; 
     267                Array<ivec> irvcs_rv; 
    263268                //! Indeces of common rv in rvc 
    264                 Array<ivec> rvinrvcs; 
     269                Array<ivec> irv_rvcs; 
    265270        public: 
    266                 compositepdf(Array<mpdf*> A0): n(A0.length()), mpdfs(A0), rvsinrv(n), rvcsinrv(n),rvinrvcs(n){}; 
     271                compositepdf(Array<mpdf*> A0): n(A0.length()), mpdfs(A0), rvsinrv(n), irvcs_rv(n),irv_rvcs(n){}; 
    267272                //! find common rv, flag \param checkoverlap modifies whether overlaps are acceptable 
    268273                RV getrv(bool checkoverlap=false); 
  • bdm/stat/libEF.cpp

    r178 r182  
    9595         
    9696        // set mean value 
    97         M= iLsub*L ( xdim,end,0,xdim-1 ); 
     97        M= L ( xdim,end,0,xdim-1 ).T()*iLsub; 
    9898        R= ldR.to_mat()  ; 
    9999} 
     
    207207                N_babies ( j ) ++; 
    208208        } 
    209  
    210209        // We have assigned new babies for each Particle 
    211210        // Now, we fill the resulting index such that: 
  • bdm/stat/libEF.h

    r181 r182  
    130130        double lognc () const; 
    131131        vec mean() const {return mu;} 
    132         mlnorm<sq_T>* condition ( const RV &rvn ); 
    133         enorm<sq_T>* marginal ( const RV &rv ); 
     132        mlnorm<sq_T>* condition ( const RV &rvn ) const ; 
     133        enorm<sq_T>* marginal ( const RV &rv ) const; 
    134134//Access methods 
    135135        //! returns a pointer to the internal mean value. Use with Care! 
     
    384384        //! Set value of \c rvc . Result of this operation is stored in \c epdf use function \c _ep to access it. 
    385385        void condition (const vec &cond ); 
     386         
     387/*      template<class sq_M> 
     388        friend std::ostream &operator<< ( std::ostream &os, const mlnorm<sq_M> &ml );*/ 
    386389}; 
    387390 
     
    594597 
    595598template<class sq_T> 
    596 enorm<sq_T>* enorm<sq_T>::marginal ( const RV &rvn ) { 
     599enorm<sq_T>* enorm<sq_T>::marginal ( const RV &rvn ) const { 
    597600        ivec irvn = rvn.dataind ( rv ); 
    598601 
     
    604607 
    605608template<class sq_T> 
    606 mlnorm<sq_T>* enorm<sq_T>::condition ( const RV &rvn ) { 
     609mlnorm<sq_T>* enorm<sq_T>::condition ( const RV &rvn ) const { 
    607610 
    608611        RV rvc = rv.subt ( rvn ); 
     
    620623        int end=R.rows()-1; 
    621624        mat S11 = S.get ( 0,n, 0, n ); 
    622         mat S12 = S.get ( rvn.count(), end, 0, n ); 
     625        mat S12 = S.get (0, n , rvn.count(), end ); 
    623626        mat S22 = S.get ( rvn.count(), end, rvn.count(), end ); 
    624627 
     
    636639/////////// 
    637640 
     641// template<class sq_T> 
     642// std::ostream &operator<< ( std::ostream &os, const mlnorm<sq_T> &ml ){ 
     643//      os << "A:"<< ml.A<<endl; 
     644//      os << "mu:"<< ml.mu_const<<endl; 
     645//      os << "R:" << ml.est._R().to_mat() <<endl; 
     646//      return os; 
     647// } 
     648// ; 
    638649 
    639650#endif //EF_H 
  • linux/gdb_bdm

    r88 r182  
    7676 
    7777define dv 
    78     output $arg0.data[0]@($arg0.datasize) 
    79 end 
    80 define dvx 
    81     output $arg0.data[0]@($arg0.datasize) 
     78        if $arg0.datasize >0 
     79        output $arg0.data[0]@($arg0.datasize) 
     80        else 
     81                printf "{}" 
     82        end 
    8283end 
    8384 
     
    8687   dv $arg0.D 
    8788end 
     89 
     90define drv 
     91        dv $arg0.ids 
     92        dv $arg0.sizes 
     93        dv $arg0.times 
     94end 
  • tests/CMakeLists.txt

    r179 r182  
    2323# Add executable called "helloDemo" that is built from the source files 
    2424# "demo.cxx" and "demo_b.cxx".  The extensions are automatically found. 
     25 
     26# BASIC TESTS 
     27TEST(rv_test) 
     28TEST(loggers_test) 
     29 
    2530TEST(chmat_test) 
    2631TEST(ldmat_test) 
    2732TEST(fsqmat_test) 
    28 TEST(arx_test) 
    29 TEST(loggers_test) 
    30 TEST(rv_test) 
    31 TEST(merger_test) 
    32 TEST(mixef_test) 
    3333TEST(enorm_test) 
    3434TEST(egiw_test) 
    3535TEST(test0) 
     36TEST(testResample) 
     37 
     38# ESTIM TESTS 
     39TEST(arx_test) 
     40TEST(merger_test) 
     41TEST(merger_iter_test) 
     42TEST(mixef_test) 
     43 
    3644TEST(testKF) 
    3745TEST(testPF) 
    3846TEST(testSmp) 
    3947TEST(testEpdf) 
    40 TEST(testResample) 
    4148TEST(testKF_QR) 
    4249TEST(testKF_QRexh) 
  • tests/enorm_test.cpp

    r179 r182  
    7171        cout << "composite mean: " <<Emu <<endl; 
    7272        cout << "composite variance: " <<Er <<endl; 
     73         
     74        cout << endl << " test of pdflog at zero "<<endl; 
     75        cout << "original: " << exp(E.evalpdflog(vec("0 0"))) <<endl; 
     76        cout << "composite: " << mEp.evalcond(vec("0 0"),vec(0)) << endl; 
    7377} 
  • tests/merger_test.cpp

    r180 r182  
    4848        vec mm2 = M.evalpdflog_m(x_grid); 
    4949         
    50 /*      M.set_parameters(1.0,10,3); 
    51         vec m1 = M.lognorm_merge(lW); 
    52         M.merge(&g0); 
    53         vec mm1 = M.evalpdflog_m(x_grid); 
    54          
    55         M.set_parameters(3.0,10,3); 
    56         vec m3 = M.lognorm_merge(lW); 
    57         M.merge(&g0); 
    58         vec mm3 = M.evalpdflog_m(x_grid); 
    59          
    60         M.set_parameters(300.0,10,3); 
    61         vec m300 = M.lognorm_merge(lW); 
    62         M.merge(&g0); 
    63         vec mm300 = M.evalpdflog_m(x_grid);*/ 
    64                  
    6550        it_file it("merger_test.it"); 
    6651        it << Name("lf1") << l_f1; 
    6752        it << Name("lf2") << l_f2; 
    68 /*      it << Name("m1") << m1; 
    69         it << Name("mm1") << mm1;*/ 
    7053        it << Name("m2") << m2; 
    7154        it << Name("mm2") << mm2; 
    72 /*      it << Name("m3") << m3; 
    73         it << Name("mm3") << mm3; 
    74         it << Name("m300") << m300; 
    75         it << Name("mm300") << mm300;*/ 
    7655} 
  • tests/rv_test.cpp

    r162 r182  
    4242        cout << ac.dataind(abc) <<endl; 
    4343         
     44        cout<< "copy indeces between ba and ab" << endl; 
     45        RV ba = b; 
     46        ba.add(a); 
     47         
     48        ivec ai; 
     49        ivec bi; 
     50        ba.dataind(ac,ai,bi); 
     51        cout << "ba(" << ai <<")=ac(" << bi <<")"<<endl; 
     52         
    4453        //Exit program: 
    4554