Show
Ignore:
Timestamp:
11/10/09 11:03:09 (15 years ago)
Author:
mido
Message:

_m changed to _mat

emix.cfg prepared, but it is not yet debugged!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/stat/emix.h

    r711 r713  
    159159                return tmp; 
    160160        }; 
    161         vec evallog_m ( const mat &Val ) const { 
     161        vec evallog_mat ( const mat &Val ) const { 
    162162                vec x = zeros ( Val.cols() ); 
    163163                for ( int i = 0; i < w.length(); i++ ) { 
    164                         x += w ( i ) * exp ( Coms ( i )->evallog_m ( Val ) ); 
     164                        x += w ( i ) * exp ( Coms ( i )->evallog_mat ( Val ) ); 
    165165                } 
    166166                return log ( x ); 
    167167        }; 
     168        /* 
    168169        //! Auxiliary function that returns pdflog for each component 
    169         mat evallog_M ( const mat &Val ) const { 
     170        mat evallog_mat ( const mat &Val ) const { 
    170171                mat X ( w.length(), Val.cols() ); 
    171172                for ( int i = 0; i < w.length(); i++ ) { 
    172                         X.set_row ( i, w ( i ) *exp ( Coms ( i )->evallog_m ( Val ) ) ); 
     173                        X.set_row ( i, w ( i ) *exp ( Coms ( i )->evallog_mat ( Val ) ) ); 
    173174                } 
    174175                return X; 
    175176        }; 
     177        */ 
    176178 
    177179        shared_ptr<epdf> marginal ( const RV &rv ) const; 
     
    180182        shared_ptr<pdf> condition ( const RV &rv ) const; 
    181183 
    182 //Access methods 
     184        //Access methods 
    183185        //! returns a pointer to the internal mean value. Use with Care! 
    184186        vec& _w() { 
     
    197199                } 
    198200        } 
     201 
     202        //! Load from structure with elements: 
     203        //!  \code 
     204        //! { class='emix'; 
     205        //!   pdfs = (..., ...);     // list of pdfs in the mixture 
     206        //!   weights = ( 0.5, 0.5 ); // weights of pdfs in the mixture 
     207        //! } 
     208        //! \endcode 
     209        //!@} 
     210        void from_setting ( const Setting &set ) { 
     211                UI::get ( Coms, set, "pdfs", UI::compulsory ); 
     212 
     213                if( !UI::get( w, set, "weights", UI::optional ) ) 
     214                { 
     215                        int len = Coms.length(); 
     216                        w.set_length( len ); 
     217                        double default_weight = 1.0 / len; 
     218                        for( int i=0; i < len; i++) 
     219                                w(i) = default_weight; 
     220                } 
     221        } 
    199222}; 
    200223SHAREDPTR( emix ); 
     224UIREGISTER ( emix ); 
    201225 
    202226/*! 
     
    322346                return res; 
    323347        } 
    324         vec evallogcond_m ( const mat &Dt, const vec &cond ) { 
     348        vec evallogcond_mat ( const mat &Dt, const vec &cond ) { 
    325349                vec tmp ( Dt.cols() ); 
    326350                for ( int i = 0; i < Dt.cols(); i++ ) { 
     
    329353                return tmp; 
    330354        }; 
    331         vec evallogcond_m ( const Array<vec> &Dt, const vec &cond ) { 
     355        vec evallogcond_mat ( const Array<vec> &Dt, const vec &cond ) { 
    332356                vec tmp ( Dt.length() ); 
    333357                for ( int i = 0; i < Dt.length(); i++ ) {