Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
vpdfl_axis_gaussian Class Reference

Multi-variate Gaussian PDF, with a diagonal covariance matrix. More...

#include <vpdfl_axis_gaussian.h>

Inheritance diagram for vpdfl_axis_gaussian:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vpdfl_axis_gaussian ()
virtual ~vpdfl_axis_gaussian ()
void set (const vnl_vector< double > &mean, const vnl_vector< double > &var)
double log_k () const
 Constant offset for log probability.
const vnl_vector< double > & sd () const
 SD for each dimension.
virtual double log_p (const vnl_vector< double > &x) const
 Log of probability density at x.
virtual void gradient (vnl_vector< double > &g, const vnl_vector< double > &x, double &p) const
 Gradient and value of PDF at x.
virtual void gradient_logp (vnl_vector< double > &g, const vnl_vector< double > &x) const
 Gradient and value of log(p(x)) at x.
virtual vpdfl_sampler_basenew_sampler () const
 Create a sampler object on the heap.
virtual double log_prob_thresh (double pass_proportion) const
 Compute threshold for PDF to pass a given proportion.
virtual void nearest_plausible (vnl_vector< double > &x, double log_p_min) const
 Compute nearest point to x which has a density above a threshold.
short version_no () const
 Version number for I/O.
virtual vcl_string is_a () const
 Name of the class.
virtual bool is_class (vcl_string const &s) const
 Does the name of the class match the argument?.
virtual vpdfl_pdf_baseclone () const
 Create a copy on the heap and return base class pointer.
virtual void print_summary (vcl_ostream &os) const
 Print class to os.
virtual void b_write (vsl_b_ostream &bfs) const
 Save class to binary file stream.
virtual void b_read (vsl_b_istream &bfs)
 Load class from binary file stream.
const vnl_vector< double > & mean () const
 Mean of distribution.
const vnl_vector< double > & variance () const
 Variance of each dimension.
int n_dims () const
 Number of dimensions.
virtual int n_peaks () const
 Number of peaks of distribution.
virtual const vnl_vector
< double > & 
peak (int) const
 Position of the i'th peak.
virtual double operator() (const vnl_vector< double > &x) const
 Probability density at x.
virtual bool is_valid_pdf () const
 Return true if the object represents a valid PDF.

Protected Member Functions

void set_mean (const vnl_vector< double > &m)
void set_variance (const vnl_vector< double > &v)

Private Member Functions

void calcLogK ()
void calcSD ()
double dx_sigma_dx (const vnl_vector< double > &x) const
 Calculate (x-mu)' * Sigma^-1 * (x-mu).

Private Attributes

double log_k_
vnl_vector< double > sd_

Detailed Description

Multi-variate Gaussian PDF, with a diagonal covariance matrix.

Definition at line 23 of file vpdfl_axis_gaussian.h.


Constructor & Destructor Documentation

vpdfl_axis_gaussian::vpdfl_axis_gaussian ( )

Definition at line 27 of file vpdfl_axis_gaussian.cxx.

vpdfl_axis_gaussian::~vpdfl_axis_gaussian ( ) [virtual]

Definition at line 35 of file vpdfl_axis_gaussian.cxx.


Member Function Documentation

void vpdfl_axis_gaussian::b_read ( vsl_b_istream bfs) [virtual]

Load class from binary file stream.

Implements vpdfl_pdf_base.

Definition at line 238 of file vpdfl_axis_gaussian.cxx.

void vpdfl_axis_gaussian::b_write ( vsl_b_ostream bfs) const [virtual]

Save class to binary file stream.

Implements vpdfl_pdf_base.

Definition at line 230 of file vpdfl_axis_gaussian.cxx.

void vpdfl_axis_gaussian::calcLogK ( ) [private]

Definition at line 41 of file vpdfl_axis_gaussian.cxx.

void vpdfl_axis_gaussian::calcSD ( ) [private]

Definition at line 52 of file vpdfl_axis_gaussian.cxx.

vpdfl_pdf_base * vpdfl_axis_gaussian::clone ( ) const [virtual]

Create a copy on the heap and return base class pointer.

Caller is responsible for deletion

Implements vpdfl_pdf_base.

Definition at line 216 of file vpdfl_axis_gaussian.cxx.

double vpdfl_axis_gaussian::dx_sigma_dx ( const vnl_vector< double > &  x) const [private]

Calculate (x-mu)' * Sigma^-1 * (x-mu).

Mahalanobis distance squared from the mean.

Definition at line 73 of file vpdfl_axis_gaussian.cxx.

void vpdfl_axis_gaussian::gradient ( vnl_vector< double > &  g,
const vnl_vector< double > &  x,
double &  p 
) const [virtual]

Gradient and value of PDF at x.

Computes gradient of PDF at x, and returns the prob at x in p

Implements vpdfl_pdf_base.

Definition at line 104 of file vpdfl_axis_gaussian.cxx.

void vpdfl_axis_gaussian::gradient_logp ( vnl_vector< double > &  g,
const vnl_vector< double > &  x 
) const [virtual]

Gradient and value of log(p(x)) at x.

Computes gradient df/dx of f(x)=log(p(x)) at x. Result is vector of same dimensionality as x.

Computes gradient df/dx of f(x)=log(p(x)) at x.

Reimplemented from vpdfl_pdf_base.

Definition at line 134 of file vpdfl_axis_gaussian.cxx.

vcl_string vpdfl_axis_gaussian::is_a ( ) const [virtual]

Name of the class.

Reimplemented from vpdfl_pdf_base.

Definition at line 194 of file vpdfl_axis_gaussian.cxx.

bool vpdfl_axis_gaussian::is_class ( vcl_string const &  s) const [virtual]

Does the name of the class match the argument?.

Reimplemented from vpdfl_pdf_base.

Definition at line 202 of file vpdfl_axis_gaussian.cxx.

bool vpdfl_pdf_base::is_valid_pdf ( ) const [virtual, inherited]

Return true if the object represents a valid PDF.

This will return false, if n_dims() is 0, for example just ofter default construction.

Reimplemented in vpdfl_mixture.

Definition at line 141 of file vpdfl_pdf_base.cxx.

double vpdfl_axis_gaussian::log_k ( ) const [inline]

Constant offset for log probability.

Definition at line 45 of file vpdfl_axis_gaussian.h.

double vpdfl_axis_gaussian::log_p ( const vnl_vector< double > &  x) const [virtual]

Log of probability density at x.

Implements vpdfl_pdf_base.

Definition at line 99 of file vpdfl_axis_gaussian.cxx.

double vpdfl_axis_gaussian::log_prob_thresh ( double  pass_proportion) const [virtual]

Compute threshold for PDF to pass a given proportion.

Reimplemented from vpdfl_pdf_base.

Definition at line 163 of file vpdfl_axis_gaussian.cxx.

const vnl_vector<double>& vpdfl_pdf_base::mean ( ) const [inline, inherited]

Mean of distribution.

Definition at line 46 of file vpdfl_pdf_base.h.

int vpdfl_pdf_base::n_dims ( ) const [inline, inherited]

Number of dimensions.

Definition at line 52 of file vpdfl_pdf_base.h.

virtual int vpdfl_pdf_base::n_peaks ( ) const [inline, virtual, inherited]

Number of peaks of distribution.

Definition at line 55 of file vpdfl_pdf_base.h.

void vpdfl_axis_gaussian::nearest_plausible ( vnl_vector< double > &  x,
double  log_p_min 
) const [virtual]

Compute nearest point to x which has a density above a threshold.

If log_p(x)>log_p_min then x unchanged. Otherwise x is moved directly towards the mean (i.e. to the nearest plausible point using a Mahalanobis distance) until log_p(x)=log_p_min.

Parameters:
xThis may be modified to the nearest plausible position.
log_p_minlower threshold for log_p(x)

Implements vpdfl_pdf_base.

Definition at line 171 of file vpdfl_axis_gaussian.cxx.

vpdfl_sampler_base * vpdfl_axis_gaussian::new_sampler ( ) const [virtual]

Create a sampler object on the heap.

Caller is responsible for deletion.

Implements vpdfl_pdf_base.

Definition at line 155 of file vpdfl_axis_gaussian.cxx.

double vpdfl_pdf_base::operator() ( const vnl_vector< double > &  x) const [virtual, inherited]

Probability density at x.

Reimplemented in vpdfl_mixture, and vpdfl_gaussian_kernel_pdf.

Definition at line 34 of file vpdfl_pdf_base.cxx.

virtual const vnl_vector<double>& vpdfl_pdf_base::peak ( int  ) const [inline, virtual, inherited]

Position of the i'th peak.

Definition at line 58 of file vpdfl_pdf_base.h.

void vpdfl_axis_gaussian::print_summary ( vcl_ostream &  os) const [virtual]

Print class to os.

Implements vpdfl_pdf_base.

Definition at line 223 of file vpdfl_axis_gaussian.cxx.

const vnl_vector<double>& vpdfl_axis_gaussian::sd ( ) const [inline]

SD for each dimension.

Definition at line 48 of file vpdfl_axis_gaussian.h.

void vpdfl_axis_gaussian::set ( const vnl_vector< double > &  mean,
const vnl_vector< double > &  var 
)

Definition at line 60 of file vpdfl_axis_gaussian.cxx.

void vpdfl_pdf_base::set_mean ( const vnl_vector< double > &  m) [inline, protected, inherited]

Reimplemented in vpdfl_gaussian.

Definition at line 35 of file vpdfl_pdf_base.h.

void vpdfl_pdf_base::set_variance ( const vnl_vector< double > &  v) [inline, protected, inherited]

Definition at line 36 of file vpdfl_pdf_base.h.

const vnl_vector<double>& vpdfl_pdf_base::variance ( ) const [inline, inherited]

Variance of each dimension.

Definition at line 49 of file vpdfl_pdf_base.h.

short vpdfl_axis_gaussian::version_no ( ) const

Version number for I/O.

Reimplemented from vpdfl_pdf_base.

Definition at line 209 of file vpdfl_axis_gaussian.cxx.


Member Data Documentation

double vpdfl_axis_gaussian::log_k_ [private]

Definition at line 25 of file vpdfl_axis_gaussian.h.

Definition at line 26 of file vpdfl_axis_gaussian.h.


The documentation for this class was generated from the following files: