Changeset 620

Show
Ignore:
Timestamp:
09/16/09 14:47:36 (15 years ago)
Author:
smidl
Message:

replace assert_debug by assert in classes interacting with users (from_setting, set_parameters, validate)

Location:
library/bdm
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/base/bdmbase.cpp

    r604 r620  
    7676void RV::init ( const Array<std::string> &in_names, const ivec &in_sizes, const ivec &in_times ) { 
    7777        len = in_names.length(); 
    78         bdm_assert_debug ( in_names.length() == in_times.length(), "check \"times\" " ); 
    79         bdm_assert_debug ( in_names.length() == in_sizes.length(), "check \"sizes\" " ); 
     78        bdm_assert ( in_names.length() == in_times.length(), "check \"times\" " ); 
     79        bdm_assert ( in_names.length() == in_sizes.length(), "check \"sizes\" " ); 
    8080 
    8181        times.set_length ( len ); 
  • library/bdm/base/bdmbase.h

    r619 r620  
    3535        //!Default constructor 
    3636        str ( ivec ids0, ivec times0 ) : ids ( ids0 ), times ( times0 ) { 
    37                 bdm_assert_debug ( times0.length() == ids0.length(), "Incompatible input" ); 
     37                bdm_assert ( times0.length() == ids0.length(), "Incompatible input" ); 
    3838        }; 
    3939}; 
     
    183183        //! returns name of a scalar at position scalat, i.e. it can be in the middle of vector name, in that case it adds "_%d" to it 
    184184        std::string scalarname ( int scalat ) const { 
    185                 bdm_assert_debug(scalat<dsize,"Wrong input index"); 
     185                bdm_assert(scalat<dsize,"Wrong input index"); 
    186186                int id=0; 
    187187                int scalid=0; 
     
    995995        //! Register DS for logging into logger L 
    996996        virtual void log_add ( logger &L ) { 
    997                 bdm_assert_debug ( dtsize == Drv._dsize(), "invalid DS: dtsize (" + num2str ( dtsize ) + ") different from Drv " + num2str ( Drv._dsize() ) ); 
    998                 bdm_assert_debug ( utsize == Urv._dsize(), "invalid DS: utsize (" + num2str ( utsize ) + ") different from Urv " + num2str ( Urv._dsize() ) ); 
     997                bdm_assert ( dtsize == Drv._dsize(), "invalid DS: dtsize (" + num2str ( dtsize ) + ") different from Drv " + num2str ( Drv._dsize() ) ); 
     998                bdm_assert ( utsize == Urv._dsize(), "invalid DS: utsize (" + num2str ( utsize ) + ") different from Urv " + num2str ( Urv._dsize() ) ); 
    999999 
    10001000                L_dt = L.add ( Drv, "" ); 
  • library/bdm/base/loggers.h

    r611 r620  
    4949 
    5050        void logit ( int id, const vec &v ) { 
    51                 bdm_assert_debug ( id < vectors.length(), "Logger was not initialized, run init()." ); 
     51                bdm_assert ( id < vectors.length(), "Logger was not initialized, run init()." ); 
    5252                if ( id >= 0 ) { 
    5353                        vectors ( id ).set_row ( ind, v ); 
  • library/bdm/base/user_info.h

    r600 r620  
    321321 
    322322                root *typeless_instance = related_UI.new_instance(); 
    323                 bdm_assert_debug ( typeless_instance, "UI::new_instance failed" ); 
     323                bdm_assert ( typeless_instance, "UI::new_instance failed" ); 
    324324 
    325325                instance = dynamic_cast<T*> ( typeless_instance ); 
     
    351351                T *tmp_inst = 0; 
    352352                from_setting ( tmp_inst, element ); 
    353                 bdm_assert_debug ( tmp_inst, "UI::from_setting failed" ); 
     353                bdm_assert ( tmp_inst, "UI::from_setting failed" ); 
    354354                instance = tmp_inst; 
    355355        } 
  • library/bdm/design/ctrlbase.cpp

    r586 r620  
    2222 
    2323void LQG::validate() { 
    24         bdm_assert_debug ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); 
    25         bdm_assert_debug ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); 
    26         bdm_assert_debug ( y_req.length() == dimy, "LQG: wrong dimensions of y_req " ); 
     24        bdm_assert ( Qy.cols() == dimy, "LQG: wrong dimensions of Qy " ); 
     25        bdm_assert ( Qu.cols() == dimu, "LQG: wrong dimensions of Qu " ); 
     26        bdm_assert ( y_req.length() == dimy, "LQG: wrong dimensions of y_req " ); 
    2727} 
    2828 
  • library/bdm/estim/kalman.h

    r605 r620  
    138138                void validate() { 
    139139                        StateSpace<sq_T>::validate(); 
    140                         bdm_assert_debug(est->dimension(), "Statistics and model parameters mismatch"); 
     140                        bdm_assert(est->dimension(), "Statistics and model parameters mismatch"); 
    141141                } 
    142142}; 
     
    386386                         
    387387                        //We can do only 1d now... :( 
    388                         bdm_assert_debug(yrv._dsize()==1, "Only for SISO so far..." ); 
     388                        bdm_assert(yrv._dsize()==1, "Only for SISO so far..." ); 
    389389 
    390390                        // create names for  
     
    463463template<class sq_T> 
    464464void StateSpace<sq_T>::validate(){ 
    465         bdm_assert_debug (A.cols() == dimx, "KalmanFull: A is not square"); 
    466         bdm_assert_debug (B.rows() == dimx, "KalmanFull: B is not compatible"); 
    467         bdm_assert_debug (C.cols() == dimx, "KalmanFull: C is not square"); 
    468         bdm_assert_debug ( (D.rows() == dimy) || (D.cols() == dimu), "KalmanFull: D is not compatible"); 
    469         bdm_assert_debug ( (Q.cols() == dimx) || (Q.rows() == dimx), "KalmanFull: Q is not compatible"); 
    470         bdm_assert_debug ( (R.cols() == dimy) || (R.rows() == dimy), "KalmanFull: R is not compatible"); 
     465        bdm_assert (A.cols() == dimx, "KalmanFull: A is not square"); 
     466        bdm_assert (B.rows() == dimx, "KalmanFull: B is not compatible"); 
     467        bdm_assert (C.cols() == dimx, "KalmanFull: C is not square"); 
     468        bdm_assert ( (D.rows() == dimy) || (D.cols() == dimu), "KalmanFull: D is not compatible"); 
     469        bdm_assert ( (Q.cols() == dimx) || (Q.rows() == dimx), "KalmanFull: Q is not compatible"); 
     470        bdm_assert ( (R.cols() == dimy) || (R.rows() == dimy), "KalmanFull: R is not compatible"); 
    471471} 
    472472 
  • library/bdm/math/functions.h

    r565 r620  
    124124        //! Alternative initialization 
    125125        void set_parameters ( const mat &A0, const mat &B0 ) { 
    126                 bdm_assert_debug ( A0.rows() == B0.rows(), "bilinfn matrices must have the same number of rows" ); 
     126                bdm_assert ( A0.rows() == B0.rows(), "bilinfn matrices must have the same number of rows" ); 
    127127                A = A0; 
    128128                B = B0; 
  • library/bdm/stat/discrete.h

    r569 r620  
    5555                        void initialize() { 
    5656                                dim = ranges.length(); 
    57                                 bdm_assert_debug(gridsizes.length() == dim, "Incompatible dimensions of input"); 
     57                                bdm_assert(gridsizes.length() == dim, "Incompatible dimensions of input"); 
    5858                                Npoints = prod(gridsizes); 
    59                                 bdm_assert_debug(Npoints > 0, "Wrong input parameters"); 
     59                                bdm_assert(Npoints > 0, "Wrong input parameters"); 
    6060                                 
    6161                                //precompute steps 
  • library/bdm/stat/emix.cpp

    r601 r620  
    1212 
    1313        for ( i = 0; i < w.length(); i++ ) { 
    14                 bdm_assert_debug ( dim == ( Coms0 ( i )->dimension() ), "Component sizes do not match!" ); 
    15                 bdm_assert_debug ( !isnamed || tmp_rv.equal ( Coms0 ( i )->_rv() ), "Component RVs do not match!" ); 
     14                bdm_assert ( dim == ( Coms0 ( i )->dimension() ), "Component sizes do not match!" ); 
     15                bdm_assert ( !isnamed || tmp_rv.equal ( Coms0 ( i )->_rv() ), "Component RVs do not match!" ); 
    1616        } 
    1717 
     
    4444 
    4545void emix::marginal ( const RV &rv, emix &target ) const { 
    46         bdm_assert_debug ( isnamed(), "rvs are not assigned" ); 
     46        bdm_assert ( isnamed(), "rvs are not assigned" ); 
    4747 
    4848        Array<shared_ptr<epdf> > Cn ( Coms.length() ); 
     
    5555 
    5656shared_ptr<mpdf> emix::condition ( const RV &rv ) const { 
    57         bdm_assert_debug ( isnamed(), "rvs are not assigned" ); 
     57        bdm_assert ( isnamed(), "rvs are not assigned" ); 
    5858        mratio *tmp = new mratio ( this, rv ); 
    5959        return shared_ptr<mpdf>(tmp); 
  • library/bdm/stat/exp_family.h

    r613 r620  
    136136                void from_setting (const Setting &root); 
    137137                void validate() { 
    138                         bdm_assert_debug (mu.length() == R.rows(), "parameters mismatch"); 
     138                        bdm_assert (mu.length() == R.rows(), "mu and R parameters do not match"); 
    139139                        dim = mu.length(); 
    140140                } 
     
    416416                } 
    417417                void validate() { 
    418                         bdm_assert_debug (alpha.length() == beta.length(), "parameters do not match"); 
     418                        bdm_assert (alpha.length() == beta.length(), "parameters do not match"); 
    419419                        dim = alpha.length(); 
    420420                } 
     
    530530                        bdm_assert(high.length()==low.length(), "Incompatible high and low vectors"); 
    531531                        dim = high.length(); 
    532                         bdm_assert_debug (min (distance) > 0.0, "bad support"); 
     532                        bdm_assert (min (distance) > 0.0, "bad support"); 
    533533                } 
    534534}; 
     
    558558 
    559559                //! Set \c A and \c R 
    560                 void set_parameters (const  mat &A0, const vec &mu0, const sq_T &R0) { 
    561                         bdm_assert_debug (A0.rows() == mu0.length(), "mlnorm: A vs. mu mismatch"); 
    562                         bdm_assert_debug (A0.rows() == R0.rows(), "mlnorm: A vs. R mismatch"); 
    563                          
     560                void set_parameters (const  mat &A0, const vec &mu0, const sq_T &R0) {   
    564561                        this->iepdf.set_parameters (zeros (A0.rows()), R0); 
    565562                        A = A0; 
     
    593590                        UI::get (R0, set, "R", UI::compulsory); 
    594591                        set_parameters (A, mu_const, R0); 
     592                        validate(); 
    595593                }; 
     594                void validate() { 
     595                        bdm_assert (A.rows() == mu_const.length(), "mlnorm: A vs. mu mismatch"); 
     596                        bdm_assert (A.rows() == _R().rows(), "mlnorm: A vs. R mismatch"); 
     597                         
     598                } 
    596599}; 
    597600UIREGISTER2 (mlnorm,ldmat); 
     
    704707 
    705708                void validate() { 
    706                         bdm_assert_debug (A.rows() == mu_const.length(), "mlstudent: A vs. mu mismatch"); 
    707                         bdm_assert_debug (_R.rows() == A.rows(), "mlstudent: A vs. R mismatch"); 
     709                        bdm_assert (A.rows() == mu_const.length(), "mlstudent: A vs. mu mismatch"); 
     710                        bdm_assert (_R.rows() == A.rows(), "mlstudent: A vs. R mismatch"); 
    708711                         
    709712                } 
     
    11561159                //! Set samples 
    11571160                void set_parameters (const Array<vec> &Av) { 
    1158                         bdm_assert_debug(Av.size()>0,"Empty samples");  
     1161                        bdm_assert(Av.size()>0,"Empty samples");  
    11591162                        n = Av.size();  
    11601163                        epdf::set_parameters(Av(0).length()); 
     
    13221325void enorm<sq_T>::marginal ( const RV &rvn, enorm<sq_T> &target ) const 
    13231326{ 
    1324         bdm_assert_debug (isnamed(), "rv description is not assigned"); 
     1327        bdm_assert (isnamed(), "rv description is not assigned"); 
    13251328        ivec irvn = rvn.dataind (rv); 
    13261329 
     
    13451348        typedef mlnorm<sq_T> TMlnorm; 
    13461349 
    1347         bdm_assert_debug (isnamed(), "rvs are not assigned"); 
     1350        bdm_assert (isnamed(), "rvs are not assigned"); 
    13481351        TMlnorm &uptarget = dynamic_cast<TMlnorm &>(target); 
    13491352 
    13501353        RV rvc = rv.subt (rvn); 
    1351         bdm_assert_debug ( (rvc._dsize() + rvn._dsize() == rv._dsize()), "wrong rvn"); 
     1354        bdm_assert ( (rvc._dsize() + rvn._dsize() == rv._dsize()), "wrong rvn"); 
    13521355        //Permutation vector of the new R 
    13531356        ivec irvn = rvn.dataind (rv);