Changeset 211 for bdm/stat/libBM.h
- Timestamp:
- 11/13/08 20:00:53 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
bdm/stat/libBM.h
r203 r211 126 126 RV concat ( const RV &rv1, const RV &rv2 ); 127 127 128 //!Default empty RV that can be used as default argument 129 extern RV RV0; 128 130 129 131 //! Class representing function \f$f(x)\f$ of variable \f$x\f$ represented by \c rv … … 172 174 173 175 //! Compute log-probability of argument \c val 174 virtual double eval pdflog ( const vec &val ) const =0;176 virtual double evallog ( const vec &val ) const =0; 175 177 176 178 //! Compute log-probability of multiple values argument \c val 177 virtual vec eval pdflog_m ( const mat &Val ) const {179 virtual vec evallog_m ( const mat &Val ) const { 178 180 vec x ( Val.cols() ); 179 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =eval pdflog ( Val.get_col ( i ) ) ;}181 for ( int i=0;i<Val.cols();i++ ) {x ( i ) =evallog ( Val.get_col ( i ) ) ;} 180 182 return x; 181 183 } … … 217 219 this->condition ( cond ); 218 220 vec temp= ep->sample(); 219 ll=ep->eval pdflog ( temp );return temp;221 ll=ep->evallog ( temp );return temp; 220 222 }; 221 223 //! 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 \param ll is a return value of log-likelihood of the sample. 222 virtual mat samplecond ( const vec &cond, vec &ll, int N ) {224 virtual mat samplecond_m ( const vec &cond, vec &ll, int N ) { 223 225 this->condition ( cond ); 224 226 mat temp ( rv.count(),N ); vec smp ( rv.count() ); 225 for ( int i=0;i<N;i++ ) {smp=ep->sample() ;temp.set_col ( i, smp );ll ( i ) =ep->eval pdflog ( smp );}227 for ( int i=0;i<N;i++ ) {smp=ep->sample() ;temp.set_col ( i, smp );ll ( i ) =ep->evallog ( smp );} 226 228 return temp; 227 229 }; … … 230 232 231 233 //! Shortcut for conditioning and evaluation of the internal epdf. In some cases, this operation can be implemented efficiently. 232 virtual double evalcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog ( dt ));}; 233 234 virtual vec evalcond_m ( const mat &Dt, const vec &cond ) {this->condition ( cond );return exp(ep->evalpdflog_m ( Dt ));}; 234 virtual double evallogcond ( const vec &dt, const vec &cond ) {this->condition ( cond );return ep->evallog ( dt );}; 235 236 //! Matrix version of evallogcond 237 virtual vec evallogcond_m ( const mat &Dt, const vec &cond ) {this->condition ( cond );return ep->evallog_m ( Dt );}; 235 238 236 239 //! Destructor for future use;