#include <emix.h>
Public Member Functions | |
emix (const RV &rv) | |
Default constructor. | |
void | set_parameters (const vec &w, const Array< epdf * > &Coms, bool copy=true) |
vec | sample () const |
Returns a sample, from density . | |
vec | mean () const |
return expected value | |
double | evallog (const vec &val) const |
Compute log-probability of argument val . | |
vec | evallog_m (const mat &Val) const |
Compute log-probability of multiple values argument val . | |
mat | evallog_M (const mat &Val) const |
Auxiliary function that returns pdflog for each component. | |
emix * | marginal (const RV &rv) const |
Return marginal density on the given RV, the remainig rvs are intergrated out. | |
mratio * | condition (const RV &rv) const |
Return conditional density on the given RV, the remaining rvs will be in conditioning. | |
vec & | _w () |
returns a pointer to the internal mean value. Use with Care! | |
void | ownComs () |
Auxiliary function for taking ownership of the Coms(). | |
epdf * | _Coms (int i) |
access function | |
virtual mat | sample_m (int N) const |
Returns N samples from density . | |
const RV & | _rv () const |
access function, possibly dangerous! | |
void | _renewrv (const RV &in_rv) |
modifier function - useful when copying epdfs | |
Protected Attributes | |
vec | w |
weights of the components | |
Array< epdf * > | Coms |
Component (epdfs). | |
bool | destroyComs |
Flag if owning Coms. | |
RV | rv |
Identified of the random variable. |
Density function:
where is any density on random variable , called component,
void emix::set_parameters | ( | const vec & | w, | |
const Array< epdf * > & | Coms, | |||
bool | copy = true | |||
) |
Set weights w
and components Coms
By default Coms are copied inside.
copy | can be set to false if Coms live externally. Use method ownComs() if Coms should be destroyed by the destructor. |
References epdf::_rv(), Coms, destroyComs, RV::equal(), epdf::rv, and w.
Referenced by marginal(), MixEF::predictor(), and mmix::set_parameters().