Changeset 678 for library/bdm/base/bdmbase.h
- Timestamp:
- 10/22/09 15:18:50 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/base/bdmbase.h
r677 r678 393 393 RV rvc; 394 394 395 //! TODO395 //! dimension of random variable 396 396 int dim; 397 397 398 //! TODO398 //! random variable 399 399 RV rv; 400 400 … … 479 479 } 480 480 481 bool isnamed() {481 bool isnamed() const { 482 482 return ( dim == rv._dsize() ) && ( dimc == rvc._dsize() ); 483 483 } … … 488 488 //! Probability density function with numerical statistics, e.g. posterior density. 489 489 class epdf : public mpdf { 490 protected:491 //! dimension of the random variable492 int dim;493 //! Description of the random variable494 RV rv;495 490 496 491 public: … … 506 501 All internal data structures are constructed as empty. Their values (including sizes) will be set by method \c set_parameters(). This way references can be initialized in constructors. 507 502 @{*/ 508 epdf() : dim ( 0 ), rv() {}; 509 epdf ( const epdf &e ) : dim ( e.dim ), rv ( e.rv ) {}; 510 epdf ( const RV &rv0 ) : dim ( rv0._dsize() ) { 511 set_rv ( rv0 ); 512 }; 503 epdf() {}; 504 epdf ( const epdf &e ) : mpdf(e) {}; 513 505 void set_parameters ( int dim0 ) { 514 506 dim = dim0; … … 574 566 //! @{ 575 567 576 //!Name its rv577 void set_rv ( const RV &rv0 ) {578 rv = rv0;579 }580 581 //! True if rv is assigned582 bool isnamed() const {583 bool b = ( dim == rv._dsize() );584 return b;585 }586 587 //! Return name (fails when isnamed is false)588 const RV& _rv() const {589 //bdm_assert_debug ( isnamed(), "" );590 return rv;591 }592 568 //! store values of the epdf on the following levels: 593 569 //! #1 mean … … 615 591 //! @{ 616 592 617 //! Size of the random variable618 int dimension() const {619 return dim;620 }621 593 //! Load from structure with elements: 622 594 //! \code … … 633 605 } 634 606 635 636 /*! \brief Unconditional mpdf, allows using epdf in the role of mpdf.637 638 */639 640 641 /// MEPDF BEGINS HERE TODO642 //! empty643 607 vec samplecond ( const vec &cond ) { 644 608 return sample(); … … 683 647 //! Efficient version of samplecond 684 648 virtual mat samplecond_m ( const vec &cond, int N ); 649 650 void validate() { 651 iepdf.validate(); 652 if (rv._dsize()< iepdf._rv()._dsize()) {rv=iepdf._rv();}; 653 dim = iepdf.dimension(); 654 } 685 655 }; 686 656