Changeset 760

Show
Ignore:
Timestamp:
01/05/10 22:19:49 (14 years ago)
Author:
smidl
Message:

cleanups & stuff for SYSID like estimation

Files:
7 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/estimator.cpp

    r756 r760  
    122122        int Ndat=10; 
    123123        if ( Cfg.exists ( "experiment" ) ) { 
    124                 if ( Cfg.getRoot().lookupValue ( "experiment.ndat",Ndat ) ) { 
     124                if (  UI::get(Ndat, Cfg.getRoot()["experiment"],"ndat" ) ) { 
    125125                        bdm_assert ( Ndat<=Ds->max_length(), "Data source has less data then required" ); 
    126126                }; 
     
    209209                if ( n_output<1 ) mexErrMsgTxt ( "Wrong number of output variables!" ); 
    210210                output[0] = mL->toCell(); 
    211                 if (n_output>1)  
     211                if (n_output>1) { 
     212                        mL->_setting_conf().setAutoConvert(true); 
    212213                        output[1]= UImxArray::create_mxArray(mL->_setting_conf().getRoot()); 
     214                } 
    213215        } 
    214216#endif 
  • applications/bdmtoolbox/mex/merger.cpp

    r756 r760  
    145145                output[0] = tmp; 
    146146        } 
     147        if (n_output>1){ 
     148                Config C; 
     149                C.setAutoConvert(true); 
     150                UI::save(&(Merger->_Smp()),C.getRoot()); 
     151                output[1]= UImxArray::create_mxArray(C.getRoot()); 
     152        } 
    147153#endif 
    148154} 
  • library/bdm/base/bdmbase.h

    r750 r760  
    612612                // TODO we do not want to store rvc..  
    613613                // therfore, pdf::to_setting( set ) is omitted 
     614                root::to_setting(set); 
    614615                UI::save( &rv, set, "rv" ); 
    615616        } 
  • library/bdm/base/user_info.h

    r737 r760  
    545545        //! A root descendant instance is stored in the new child Setting appended to the passed element 
    546546        template< class T> static void save ( const T * const instance, Setting &element, const string &name = "" ) { 
    547                 Setting &set = ( name == "" ) ? element.add ( Setting::TypeGroup ) 
     547                Setting &set = ( name == "" ) ?  (element.getType()==Setting::TypeArray) ? element.add ( Setting::TypeGroup ) : element  
    548548                               : element.add ( name, Setting::TypeGroup ); 
    549549 
  • library/bdm/stat/discrete.cpp

    r737 r760  
    9797 
    9898void discrete_support::from_setting ( const Setting &set ) { 
    99         UI::get ( Spoints, set, "points", UI::compulsory ); 
     99        UI::get ( Spoints, set, "points", UI::optional ); 
    100100        if ( points() < 1 ) { 
    101101                int npoints; 
  • library/bdm/stat/emix.cpp

    r750 r760  
    77         
    88        bool isnamed = Coms0 ( 0 )->isnamed(); 
    9         int i; 
    109        RV tmp_rv; 
    1110        if ( isnamed ) tmp_rv = Coms0 ( 0 )->_rv(); 
  • library/bdm/stat/exp_family.h

    r750 r760  
    14221422        }; 
    14231423        virtual void    validate (){ 
    1424           bdm_assert ( n > 0, "Empty samples" ); 
    1425           epdf::validate ( samples ( 0 ).length() ); 
     1424          bdm_assert (samples.length()==w.length(),"samples and weigths are of different lengths"); 
     1425          n = w.length(); 
     1426          if (n>0) 
     1427                epdf::validate ( samples ( 0 ).length() ); 
    14261428        } 
    14271429        //! Potentially dangerous, use with care. 
     
    14831485        //! For this class, qbounds are minimum and maximum value of the population! 
    14841486        void qbounds ( vec &lb, vec &ub, double perc = 0.95 ) const; 
    1485 }; 
     1487 
     1488        void to_setting ( Setting &set ) const { 
     1489                epdf::to_setting( set ); 
     1490                UI::save ( samples, set, "samples" ); 
     1491                UI::save ( w, set, "w" ); 
     1492        } 
     1493 
     1494        void from_setting ( const Setting &set ) { 
     1495                epdf::from_setting( set ); 
     1496                 
     1497                UI::get( samples, set, "samples", UI::compulsory ); 
     1498                UI::get ( w, set, "w", UI::compulsory ); 
     1499                validate(); 
     1500        } 
     1501 
     1502}; 
     1503UIREGISTER(eEmp); 
    14861504 
    14871505