Changeset 565 for library/bdm/base/bdmbase.h
- Timestamp:
- 08/19/09 16:54:24 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r545 r565 44 44 //!Default constructor 45 45 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"); 47 47 }; 48 48 }; … … 298 298 //! Returns a sample, \f$ x \f$ from density \f$ f_x()\f$ 299 299 virtual vec sample() const { 300 it_error ("not implemented");301 return vec (0);300 bdm_error ("not implemented"); 301 return vec(); 302 302 } 303 303 … … 308 308 //! In case the argument is out of suport return -Infinity 309 309 virtual double evallog (const vec &val) const { 310 it_error ("not implemented");310 bdm_error ("not implemented"); 311 311 return 0.0; 312 312 } … … 326 326 //! return expected value 327 327 virtual vec mean() const { 328 it_error ("not implemneted");329 return vec (0);330 } ;328 bdm_error ("not implemneted"); 329 return vec(); 330 } 331 331 332 332 //! return expected variance (not covariance!) 333 333 virtual vec variance() const { 334 it_error ("not implemneted"); 335 return vec (0); 336 }; 334 bdm_error ("not implemneted"); 335 return vec(); 336 } 337 337 338 //! Lower and upper bounds of \c percentage % quantile, returns mean-2*sigma as default 338 339 virtual void qbounds (vec &lb, vec &ub, double percentage = 0.95) const { … … 353 354 void set_rv (const RV &rv0) { 354 355 rv = rv0; 355 } //it_assert_debug(isnamed(),""); }; 356 } 357 356 358 //! True if rv is assigned 357 359 bool isnamed() const { … … 359 361 return b; 360 362 } 363 361 364 //! Return name (fails when isnamed is false) 362 365 const RV& _rv() const { 363 it_assert_debug (isnamed(), "");366 bdm_assert_debug (isnamed(), ""); 364 367 return rv; 365 368 } … … 425 428 426 429 //! 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 } 428 434 429 435 //! 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 … … 431 437 432 438 //! 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 } 434 443 435 444 //! Matrix version of evallogcond … … 441 450 442 451 //! 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 } 444 456 445 457 //! \name Access to attributes … … 497 509 //! constructor 498 510 mpdf_internal() : mpdf(), iepdf() {set_ep (iepdf);} 511 499 512 //! Update \c iepdf so that it represents this mpdf conditioned on \c rvc = cond 500 513 //! This function provides convenient reimplementation in offsprings 501 514 virtual void condition (const vec &cond) { 502 it_error ("Not implemented"); 503 }; 515 bdm_error ("Not implemented"); 516 } 517 504 518 //!access function to iepdf 505 519 EPDF& e() {return iepdf;} … … 571 585 //! Get val for myself from val of "Up" 572 586 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"); 574 588 return get_vec (val_up, v2v_up); 575 589 } … … 577 591 //! Fill val of "Up" by my pieces 578 592 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"); 581 595 set_subvector (val_up, v2v_up, val); 582 596 } … … 628 642 //establish c2c connection 629 643 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"); 631 645 } 632 646 … … 746 760 //! default constructors 747 761 DS() : Drv(), Urv() {}; 762 748 763 //! Returns full vector of observed data=[output, input] 749 764 virtual void getdata (vec &dt) { 750 it_error ("abstract class"); 751 }; 765 bdm_error ("abstract class"); 766 } 767 752 768 //! Returns data records at indeces. 753 769 virtual void getdata (vec &dt, const ivec &indeces) { 754 it_error ("abstract class"); 755 }; 770 bdm_error ("abstract class"); 771 } 772 756 773 //! Accepts action variable and schedule it for application. 757 774 virtual void write (vec &ut) { 758 it_error ("abstract class"); 759 }; 775 bdm_error ("abstract class"); 776 } 777 760 778 //! Accepts action variables at specific indeces 761 779 virtual void write (vec &ut, const ivec &indeces) { 762 it_error ("abstract class");763 } ;780 bdm_error ("abstract class"); 781 } 764 782 765 783 //! Moves from \f$ t \f$ to \f$ t+1 \f$, i.e. perfroms the actions and reads response of the system. … … 768 786 //! Register DS for logging into logger L 769 787 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"); 772 790 773 791 L_dt = L.add (Drv, ""); … … 857 875 //! I.e. marginal likelihood of the data with the posterior integrated out. 858 876 virtual double logpred (const vec &dt) const { 859 it_error ("Not implemented");877 bdm_error ("Not implemented"); 860 878 return 0.0; 861 879 } 880 862 881 //! Matrix version of logpred 863 882 vec logpred_m (const mat &dt) const { … … 871 890 //!Constructs a predictive density \f$ f(d_{t+1} |d_{t}, \ldots d_{0}) \f$ 872 891 virtual epdf* epredictor() const { 873 it_error ("Not implemented");892 bdm_error ("Not implemented"); 874 893 return NULL; 875 894 }; 876 895 //!Constructs conditional density of 1-step ahead predictor \f$ f(d_{t+1} |d_{t+h-1}, \ldots d_{t}) \f$ 877 896 virtual mpdf* predictor() const { 878 it_error ("Not implemented");897 bdm_error ("Not implemented"); 879 898 return NULL; 880 899 }; … … 895 914 //! Substitute \c val for \c rvc. 896 915 virtual void condition (const vec &val) { 897 it_error ("Not implemented!");898 } ;916 bdm_error ("Not implemented!"); 917 } 899 918 900 919 //!@} … … 1002 1021 condition (cond); 1003 1022 tmp = iepdf.evallog (dt); 1004 // it_assert_debug(std::isfinite(tmp), "Infinite value");1005 1023 return tmp; 1006 1024 }