Class prob_cond_mdim_indep (o2scl)

O2scl : Class List

template<class vec_t = boost::numeric::ublas::vector<double>>
class prob_cond_mdim_indep : public o2scl::prob_cond_mdim<boost::numeric::ublas::vector<double>>

A multi-dimensional conditional probability density function independent of the input.

The conditional probability, \( P(A|B) = P(A,B)/P(B) \). If the joint probability is factorizable because the events \( A \) and \( B \) are independent, i.e. \( P(A,B) = P(A) P(B) \), then \( P(A|B) = P(A) \) and is independent of \( B \). This class handles that particular case.

This class is experimental.

Note

This class stores a shared pointer of the underlying probability distribution, so copies created by the copy constructor point to the same object. If this object is not thread-safe, then copies of this class are also not thread-safe.

Public Functions

inline prob_cond_mdim_indep()

Create a conditional probability distribution based on a default multidimensional Gaussian.

inline prob_cond_mdim_indep(std::shared_ptr<prob_dens_mdim<vec_t>> out)

Create a conditional probability distribution based on the specified probability distribution.

inline prob_cond_mdim_indep(const prob_cond_mdim_indep &pcmi)

Copy constructor.

inline prob_cond_mdim_indep &operator=(const prob_cond_mdim_indep &pcmi)

Copy constructor with operator=.

inline void set_base(std::shared_ptr<prob_dens_mdim<vec_t>> b)

Set the base probability distribution.

inline virtual size_t dim() const

The dimensionality.

inline virtual double pdf(const vec_t &x_B, const vec_t &x_A) const

The conditional probability of x_A given x_B, i.e. \( P(A|B) \).

inline virtual double log_pdf(const vec_t &x_B, const vec_t &x_A) const

The log of the conditional probability of x_A given x_B i.e. \( \log [P(A|B)] \).

inline virtual void operator()(const vec_t &x_B, vec_t &x_A) const

Sample the distribution.

inline virtual const char *type()

Protected Attributes

std::shared_ptr<prob_dens_mdim<vec_t>> base

The underlying probability distribution.