Show
Ignore:
Timestamp:
08/19/09 16:54:24 (15 years ago)
Author:
vbarta
Message:

using own error macros (basically copied from IT++, but never aborting)

Files:
1 modified

Legend:

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

    r545 r565  
    4444                //!Default constructor 
    4545                str (ivec ids0, ivec times0) : ids (ids0), times (times0) { 
    46                         it_assert_debug (times0.length() == ids0.length(), "Incompatible input"); 
     46                        bdm_assert_debug (times0.length() == ids0.length(), "Incompatible input"); 
    4747                }; 
    4848}; 
     
    298298                //! Returns a sample, \f$ x \f$ from density \f$ f_x()\f$ 
    299299                virtual vec sample() const { 
    300                         it_error ("not implemented"); 
    301                         return vec (0); 
     300                        bdm_error ("not implemented"); 
     301                        return vec(); 
    302302                } 
    303303 
     
    308308                //! In case the argument is out of suport return -Infinity 
    309309                virtual double evallog (const vec &val) const { 
    310                         it_error ("not implemented"); 
     310                        bdm_error ("not implemented"); 
    311311                        return 0.0; 
    312312                } 
     
    326326                //! return expected value 
    327327                virtual vec mean() const { 
    328                         it_error ("not implemneted"); 
    329                         return vec (0); 
    330                 }; 
     328                        bdm_error ("not implemneted"); 
     329                        return vec(); 
     330                } 
    331331 
    332332                //! return expected variance (not covariance!) 
    333333                virtual vec variance() const { 
    334                         it_error ("not implemneted"); 
    335                         return vec (0); 
    336                 }; 
     334                        bdm_error ("not implemneted"); 
     335                        return vec(); 
     336                } 
     337 
    337338                //! Lower and upper bounds of \c percentage % quantile, returns mean-2*sigma as default 
    338339                virtual void qbounds (vec &lb, vec &ub, double percentage = 0.95) const { 
     
    353354                void set_rv (const RV &rv0) { 
    354355                        rv = rv0; 
    355                 }   //it_assert_debug(isnamed(),""); }; 
     356                } 
     357 
    356358                //! True if rv is assigned 
    357359                bool isnamed() const { 
     
    359361                        return b; 
    360362                } 
     363 
    361364                //! Return name (fails when isnamed is false) 
    362365                const RV& _rv() const { 
    363                         it_assert_debug (isnamed(), ""); 
     366                        bdm_assert_debug (isnamed(), ""); 
    364367                        return rv; 
    365368                } 
     
    425428 
    426429                //! Returns a sample from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv 
    427                 virtual vec samplecond (const vec &cond) {it_error ("Not implemented");return vec (0);}; 
     430                virtual vec samplecond (const vec &cond) { 
     431                        bdm_error ("Not implemented"); 
     432                        return vec(); 
     433                } 
    428434 
    429435                //! Returns \param N samples from the density conditioned on \c cond, \f$x \sim epdf(rv|cond)\f$. \param cond is numeric value of \c rv 
     
    431437 
    432438                //! Shortcut for conditioning and evaluation of the internal epdf. In some cases,  this operation can be implemented efficiently. 
    433                 virtual double evallogcond (const vec &dt, const vec &cond) {it_error ("Not implemented");return 0.0;} 
     439                virtual double evallogcond (const vec &dt, const vec &cond) { 
     440                        bdm_error ("Not implemented"); 
     441                        return 0.0; 
     442                } 
    434443 
    435444                //! Matrix version of evallogcond 
     
    441450 
    442451                //! Array<vec> version of evallogcond 
    443                 virtual vec evallogcond_m (const Array<vec> &Dt, const vec &cond) {it_error ("Not implemented");return vec (0);} 
     452                virtual vec evallogcond_m (const Array<vec> &Dt, const vec &cond) { 
     453                        bdm_error ("Not implemented"); 
     454                        return vec(); 
     455                } 
    444456 
    445457                //! \name Access to attributes 
     
    497509                //! constructor 
    498510                mpdf_internal() : mpdf(), iepdf() {set_ep (iepdf);} 
     511 
    499512                //! Update \c iepdf so that it represents this mpdf conditioned on \c rvc = cond 
    500513                //! This function provides convenient reimplementation in offsprings 
    501514                virtual void condition (const vec &cond) { 
    502                         it_error ("Not implemented"); 
    503                 }; 
     515                        bdm_error ("Not implemented"); 
     516                } 
     517 
    504518                //!access function to iepdf 
    505519                EPDF& e() {return iepdf;} 
     
    571585                //! Get val for myself from val of "Up" 
    572586                vec pushdown (const vec &val_up) { 
    573                         it_assert_debug (upsize == val_up.length(), "Wrong val_up"); 
     587                        bdm_assert_debug (upsize == val_up.length(), "Wrong val_up"); 
    574588                        return get_vec (val_up, v2v_up); 
    575589                } 
     
    577591                //! Fill val of "Up" by my pieces 
    578592                void pushup (vec &val_up, const vec &val) { 
    579                         it_assert_debug (downsize == val.length(), "Wrong val"); 
    580                         it_assert_debug (upsize == val_up.length(), "Wrong val_up"); 
     593                        bdm_assert_debug (downsize == val.length(), "Wrong val"); 
     594                        bdm_assert_debug (upsize == val_up.length(), "Wrong val_up"); 
    581595                        set_subvector (val_up, v2v_up, val); 
    582596                } 
     
    628642                        //establish c2c connection 
    629643                        rvc.dataind (rvc_up, c2c_lo, c2c_up); 
    630                         it_assert_debug (c2c_lo.length() + v2c_lo.length() == condsize, "cond is not fully given"); 
     644                        bdm_assert_debug (c2c_lo.length() + v2c_lo.length() == condsize, "cond is not fully given"); 
    631645                } 
    632646 
     
    746760                //! default constructors 
    747761                DS() : Drv(), Urv() {}; 
     762 
    748763                //! Returns full vector of observed data=[output, input] 
    749764                virtual void getdata (vec &dt) { 
    750                         it_error ("abstract class"); 
    751                 }; 
     765                        bdm_error ("abstract class"); 
     766                } 
     767 
    752768                //! Returns data records at indeces. 
    753769                virtual void getdata (vec &dt, const ivec &indeces) { 
    754                         it_error ("abstract class"); 
    755                 }; 
     770                        bdm_error ("abstract class"); 
     771                } 
     772 
    756773                //! Accepts action variable and schedule it for application. 
    757774                virtual void write (vec &ut) { 
    758                         it_error ("abstract class"); 
    759                 }; 
     775                        bdm_error ("abstract class"); 
     776                } 
     777 
    760778                //! Accepts action variables at specific indeces 
    761779                virtual void write (vec &ut, const ivec &indeces) { 
    762                         it_error ("abstract class"); 
    763                 }; 
     780                        bdm_error ("abstract class"); 
     781                } 
    764782 
    765783                //! Moves from \f$ t \f$ to \f$ t+1 \f$, i.e. perfroms the actions and reads response of the system. 
     
    768786                //! Register DS for logging into logger L 
    769787                virtual void log_add (logger &L) { 
    770                         it_assert_debug (dtsize == Drv._dsize(), ""); 
    771                         it_assert_debug (utsize == Urv._dsize(), ""); 
     788                        bdm_assert_debug (dtsize == Drv._dsize(), "invalid DS: dtsize different from Drv"); 
     789                        bdm_assert_debug (utsize == Urv._dsize(), "invalid DS: utsize different from Urv"); 
    772790 
    773791                        L_dt = L.add (Drv, ""); 
     
    857875                //! I.e. marginal likelihood of the data with the posterior integrated out. 
    858876                virtual double logpred (const vec &dt) const { 
    859                         it_error ("Not implemented"); 
     877                        bdm_error ("Not implemented"); 
    860878                        return 0.0; 
    861879                } 
     880 
    862881                //! Matrix version of logpred 
    863882                vec logpred_m (const mat &dt) const { 
     
    871890                //!Constructs a predictive density \f$ f(d_{t+1} |d_{t}, \ldots d_{0}) \f$ 
    872891                virtual epdf* epredictor() const { 
    873                         it_error ("Not implemented"); 
     892                        bdm_error ("Not implemented"); 
    874893                        return NULL; 
    875894                }; 
    876895                //!Constructs conditional density of 1-step ahead predictor \f$ f(d_{t+1} |d_{t+h-1}, \ldots d_{t}) \f$ 
    877896                virtual mpdf* predictor() const { 
    878                         it_error ("Not implemented"); 
     897                        bdm_error ("Not implemented"); 
    879898                        return NULL; 
    880899                }; 
     
    895914                //! Substitute \c val for \c rvc. 
    896915                virtual void condition (const vec &val) { 
    897                         it_error ("Not implemented!"); 
    898                 }; 
     916                        bdm_error ("Not implemented!"); 
     917                } 
    899918 
    900919                //!@} 
     
    10021021        condition (cond); 
    10031022        tmp = iepdf.evallog (dt); 
    1004         // it_assert_debug(std::isfinite(tmp), "Infinite value"); 
    10051023        return tmp; 
    10061024}