A multi-dimensional Gaussian probability density function using a Cholesky decomposition. More...
#include <prob_dens_func.h>
Given a (square) covariance matrix, , and a mean vector
the PDF is
Given the Cholesky decomposition , and a vector,
of samples from the standard Gaussian with 0 mean and unit variance, one can create a sample
from
.
A separate class for the two-dimensional case is prob_dens_mdim_biv_gaussian .
Definition at line 987 of file prob_dens_func.h.
Public Member Functions | |
const mat_t & | get_chol () |
Get the Cholesky decomposition. | |
const mat_t & | get_covar_inv () |
Get the inverse of the covariance matrix. | |
const vec_t & | get_peak () |
Get the peak location. | |
const double & | get_norm () |
Get the normalization. | |
virtual size_t | dim () const |
The dimensionality. | |
prob_dens_mdim_gaussian () | |
Create an empty distribution. | |
prob_dens_mdim_gaussian (const prob_dens_mdim_gaussian &pdmg_loc) | |
Copy constructor. | |
prob_dens_mdim_gaussian & | operator= (const prob_dens_mdim_gaussian &pdmg_loc) |
Copy constructor with operator=. | |
template<class mat2_t , class vec2_t , class mat2_col_t = const_matrix_column_gen<mat2_t>> | |
int | set (size_t p_mdim, size_t n_pts, const mat2_t &pts, const vec2_t &vals, vec_t &peak_arg, mat_t &covar_arg) |
Create a distribution from a set of samples from a multidimensional Gaussian, returning the peak values and covariance matrix. More... | |
template<class mat2_t , class vec2_t , class mat2_col_t = const_matrix_column_gen<mat2_t>> | |
int | set (size_t p_mdim, size_t n_pts, const mat2_t &pts, const vec2_t &vals) |
Create a distribution from a set of samples from a multidimensional Gaussian. More... | |
prob_dens_mdim_gaussian (size_t p_ndim, vec_t &p_peak, mat_t &covar) | |
Create a distribution from the covariance matrix. | |
void | set (size_t p_ndim, vec_t &p_peak, mat_t &covar) |
Set the peak and covariance matrix for the distribution. More... | |
void | set_alt (size_t p_ndim, vec_t &p_peak, mat_t &p_chol, mat_t &p_covar_inv, double p_norm) |
Alternate set function for use when covariance matrix has already been decomposed and inverted. | |
template<class vec_vec_t , class mat_col_t , class func_t > | |
void | set_gproc (size_t n_dim, size_t n_init, vec_vec_t &x, vec_t &y, func_t &fcovar) |
Given a data set and a covariance function, construct probability distribution based on a Gaussian process which includes noise. More... | |
virtual double | pdf (const vec_t &x) const |
The normalized density. | |
virtual double | log_pdf (const vec_t &x) const |
The log of the normalized density. | |
virtual void | operator() (vec_t &x) const |
Sample the distribution. | |
![]() | |
virtual size_t | dim () const |
Return the dimensionality. | |
virtual double | pdf (const boost::numeric::ublas::vector< double > &x) const |
The normalized density. | |
virtual double | log_pdf (const boost::numeric::ublas::vector< double > &x) const |
The log of the normalized density. | |
virtual void | operator() (boost::numeric::ublas::vector< double > &x) const |
Sample the distribution. | |
Public Attributes | |
o2scl::prob_dens_gaussian | pdg |
Standard normal. | |
Protected Attributes | |
mat_t | chol |
Cholesky decomposition. | |
mat_t | covar_inv |
Inverse of the covariance matrix. | |
vec_t | peak |
Location of the peak. | |
double | norm |
Normalization factor, ![]() | |
size_t | ndim |
Number of dimensions. | |
vec_t | q |
Temporary storage 1. | |
vec_t | vtmp |
Temporary storage 2. | |
|
inline |
The matrix pts
should have a size of n_pts
in the first index and p_mdim
in the second index
Definition at line 1123 of file prob_dens_func.h.
|
inline |
The matrix pts
should have a size of n_pts
in the first index and p_mdim
in the second index
Definition at line 1089 of file prob_dens_func.h.
|
inline |
Definition at line 1144 of file prob_dens_func.h.
|
inline |
mat_col_t
is a matrix column type for the internal object matrix type mat_t
, and not associated with the data type vec_vec_t
. Since the default matrix type is boost::numeric::ublas::matrix < double >
a good matrix column type for this function is boost::numeric::ublas::matrix_column < boost::numeric::ublas::matrix < double > >
. This matrix column type is needed for the LU decomposition and inversion. Definition at line 1217 of file prob_dens_func.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).