Changeset 204 for bdm/stat/emix.h

Show
Ignore:
Timestamp:
11/10/08 15:40:29 (16 years ago)
Author:
smidl
Message:

merger is now in logarithms + new merge_test

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • bdm/stat/emix.h

    r193 r204  
    4747        //!Default constructor. By default, the given epdf is not copied! 
    4848        //! It is assumed that this function will be used only temporarily. 
    49         mratio ( const epdf* nom0, const RV &rv, bool copy=false ) :mpdf ( rv,nom0->_rv().subt(rv) ), dl(rv,rvc,nom0->_rv()) { 
     49        mratio ( const epdf* nom0, const RV &rv, bool copy=false ) :mpdf ( rv,nom0->_rv().subt ( rv ) ), dl ( rv,rvc,nom0->_rv() ) { 
    5050                if ( copy ) { 
    5151//                      nom = nom0->_copy_(); 
    52                         it_error("todo"); 
     52                        it_error ( "todo" ); 
    5353                        destroynom=true; 
    5454                } 
     
    6161        }; 
    6262        double evalcond ( const vec &val, const vec &cond ) { 
    63                 vec nom_val(rv.count()+rvc.count()); 
    64                 dl.fill_val_cond(nom_val,val,cond); 
     63                vec nom_val ( rv.count() +rvc.count() ); 
     64                dl.fill_val_cond ( nom_val,val,cond ); 
    6565                return exp ( nom->evalpdflog ( nom_val ) - den->evalpdflog ( cond ) ); 
    6666        } 
     
    132132        //! Auxiliary function for taking ownership of the Coms() 
    133133        void ownComs() {destroyComs=true;} 
    134          
     134 
    135135        //!access function 
    136         epdf* _Coms(int i){return Coms(i);} 
     136        epdf* _Coms ( int i ) {return Coms ( i );} 
    137137}; 
    138138 
     
    175175                                                // add logarithms 
    176176                                                res += epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) );*/ 
    177                         res *= mpdfs ( i )->evalcond (  
    178                                                    dls ( i )->get_val ( val ), 
    179                         dls ( i )->get_cond ( val, cond ) 
    180                                                                                 ); 
     177                        res *= mpdfs ( i )->evalcond ( 
     178                                   dls ( i )->get_val ( val ), 
     179                                   dls ( i )->get_cond ( val, cond ) 
     180                              ); 
    181181                } 
    182182                return res; 
     
    222222                        independent=rv.add ( epdfs ( i )->_rv() ); 
    223223                        it_assert_debug ( independent==true, "eprod:: given components are not independent ." ); 
    224                         dls ( i ) = new datalink_e2e( epdfs ( i )->_rv() , rv ); 
     224                } 
     225                for ( int i=0;i<epdfs.length();i++ ) { 
     226                        dls ( i ) = new datalink_e2e ( epdfs ( i )->_rv() , rv ); 
    225227                } 
    226228        } 
     
    230232                for ( int i=0;i<epdfs.length();i++ ) { 
    231233                        vec pom = epdfs ( i )->mean(); 
    232                         dls(i)->fill_val(tmp, pom ); 
     234                        dls ( i )->fill_val ( tmp, pom ); 
    233235                } 
    234236                return tmp; 
     
    238240                for ( int i=0;i<epdfs.length();i++ ) { 
    239241                        vec pom = epdfs ( i )->sample(); 
    240                         dls(i)->fill_val(tmp, pom ); 
     242                        dls ( i )->fill_val ( tmp, pom ); 
    241243                } 
    242244                return tmp; 
     
    245247                double tmp=0; 
    246248                for ( int i=0;i<epdfs.length();i++ ) { 
    247                         tmp+=epdfs ( i )->evalpdflog ( dls(i)->get_val ( val ) ); 
     249                        tmp+=epdfs ( i )->evalpdflog ( dls ( i )->get_val ( val ) ); 
    248250                } 
    249251                return tmp; 
     
    251253        //!access function 
    252254        const epdf* operator () ( int i ) const {it_assert_debug ( i<epdfs.length(),"wrong index" );return epdfs ( i );} 
    253          
     255 
    254256        //!Destructor 
    255         ~eprod(){for(int i=0;i<epdfs.length();i++){delete dls(i);}} 
     257        ~eprod() {for ( int i=0;i<epdfs.length();i++ ) {delete dls ( i );}} 
    256258}; 
    257259