Class prob_cond_mdim_gaussian (o2scl)

O2scl : Class List

template<class vec_t = boost::numeric::ublas::vector<double>, class mat_t = boost::numeric::ublas::matrix<double>>
class prob_cond_mdim_gaussian : public o2scl::prob_cond_mdim<boost::numeric::ublas::vector<double>>

A multi-dimensional Gaussian conditional probability density function.

This class is experimental.

Todo

In class prob_cond_mdim_gaussian:

  • This should be a symmetric conditional probability, i.e. f$ P(x|y) = P(y|x) f$. Test this.

Note

Const functions are not thread-safe because mutable storage is used.

Public Functions

inline prob_cond_mdim_gaussian()

Create an empty distribution.

inline prob_cond_mdim_gaussian(const prob_cond_mdim_gaussian &pcmg)

Copy constructor.

inline prob_cond_mdim_gaussian &operator=(const prob_cond_mdim_gaussian &pcmg)

Copy constructor with operator=.

inline prob_cond_mdim_gaussian(size_t p_ndim, mat_t &covar)

Create a distribution from the covariance matrix.

inline virtual size_t dim() const

The dimensionality.

inline void set_seed(unsigned long int s)

Set the seed.

inline void clear()

Clear the distribution.

inline void set(size_t p_ndim, mat_t &covar)

Set the covariance matrix for the distribution.

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.

Protected Attributes

mat_t chol

Cholesky decomposition.

mat_t covar_inv

Inverse of the covariance matrix.

double norm

Normalization factor.

size_t ndim

Number of dimensions.

mutable vec_t q

Temporary storage 1.

mutable vec_t vtmp

Temporary storage 2.

mutable o2scl::prob_dens_gaussian pdg

Standard normal.