Public Member Functions | Protected Attributes
vpdfl_gaussian_sampler Class Reference

Samples from a Gaussian PDF. More...

#include <vpdfl_gaussian_sampler.h>

Inheritance diagram for vpdfl_gaussian_sampler:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vpdfl_gaussian_sampler ()
 Dflt ctor.
virtual ~vpdfl_gaussian_sampler ()
 Destructor.
virtual void sample (vnl_vector< double > &x)
 Draw random sample from Gaussian distribution.
virtual void reseed (unsigned long)
 Reseeds the internal random number generator.
const vpdfl_gaussiangaussian () const
 Return a reference to the pdf model.
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_sampler_baseclone () const
 Create a copy on the heap and return base class pointer.
const vpdfl_pdf_basemodel () const
 PDF of which this is an instance.
virtual void set_model (const vpdfl_pdf_base &)
 Set model for which this is an instance.
virtual void get_samples (vcl_vector< vnl_vector< double > > &x)
 Fill x with samples drawn from distribution.
virtual void regular_samples (vcl_vector< vnl_vector< double > > &x)
 Fill x with samples possibly chosen so as to represent the distribution.
virtual void regular_samples_and_prob (vcl_vector< vnl_vector< double > > &x, vnl_vector< double > &p)
 Fill x with samples possibly chosen so as to represent the distribution.
virtual void print_summary (vcl_ostream &os) const
 Print class to os.

Protected Attributes

vnl_random rng_
 The random number generator.
vnl_vector< double > b_
 workspace variable.
const vpdfl_pdf_basepdf_model_

Detailed Description

Samples from a Gaussian PDF.

Definition at line 23 of file vpdfl_gaussian_sampler.h.


Constructor & Destructor Documentation

vpdfl_gaussian_sampler::vpdfl_gaussian_sampler ( )

Dflt ctor.

Definition at line 21 of file vpdfl_gaussian_sampler.cxx.

vpdfl_gaussian_sampler::~vpdfl_gaussian_sampler ( ) [virtual]

Destructor.

Definition at line 30 of file vpdfl_gaussian_sampler.cxx.


Member Function Documentation

vpdfl_sampler_base * vpdfl_gaussian_sampler::clone ( ) const [virtual]

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

Implements vpdfl_sampler_base.

Reimplemented in vpdfl_pc_gaussian_sampler.

Definition at line 97 of file vpdfl_gaussian_sampler.cxx.

const vpdfl_gaussian & vpdfl_gaussian_sampler::gaussian ( ) const

Return a reference to the pdf model.

This is properly cast.

Definition at line 66 of file vpdfl_gaussian_sampler.cxx.

void vpdfl_sampler_base::get_samples ( vcl_vector< vnl_vector< double > > &  x) [virtual, inherited]

Fill x with samples drawn from distribution.

Definition at line 48 of file vpdfl_sampler_base.cxx.

vcl_string vpdfl_gaussian_sampler::is_a ( ) const [virtual]

Name of the class.

Reimplemented from vpdfl_sampler_base.

Reimplemented in vpdfl_pc_gaussian_sampler.

Definition at line 39 of file vpdfl_gaussian_sampler.cxx.

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

Does the name of the class match the argument?.

Reimplemented from vpdfl_sampler_base.

Reimplemented in vpdfl_pc_gaussian_sampler.

Definition at line 48 of file vpdfl_gaussian_sampler.cxx.

const vpdfl_pdf_base & vpdfl_sampler_base::model ( ) const [inherited]

PDF of which this is an instance.

Definition at line 40 of file vpdfl_sampler_base.cxx.

void vpdfl_sampler_base::print_summary ( vcl_ostream &  os) const [virtual, inherited]

Print class to os.

Definition at line 104 of file vpdfl_sampler_base.cxx.

void vpdfl_sampler_base::regular_samples ( vcl_vector< vnl_vector< double > > &  x) [virtual, inherited]

Fill x with samples possibly chosen so as to represent the distribution.

Generate a set of pseudo-random samples, chosen so as to be suitable to represent the distribution. This is meant to be used for estimating continuous integrals with sampled approximations. Where there are multiple peaks (e.g. kernel or mixture models), it is preferred that the number of samples from each component is roughly proportional to the weight for the component. When small numbers are requested, this can be done explicitly. The default is simply to call sample() for each element of x

Reimplemented in vpdfl_gaussian_kernel_pdf_sampler.

Definition at line 57 of file vpdfl_sampler_base.cxx.

void vpdfl_sampler_base::regular_samples_and_prob ( vcl_vector< vnl_vector< double > > &  x,
vnl_vector< double > &  p 
) [virtual, inherited]

Fill x with samples possibly chosen so as to represent the distribution.

As regular_samples(x), but p[i] is set to p(x[i])

Definition at line 67 of file vpdfl_sampler_base.cxx.

void vpdfl_gaussian_sampler::reseed ( unsigned long  seed) [virtual]

Reseeds the internal random number generator.

To achieve quasi-random initialisation use;

 #include <vcl_ctime.h>
 ..
 sampler.reseed(vcl_time(0));

Implements vpdfl_sampler_base.

Definition at line 56 of file vpdfl_gaussian_sampler.cxx.

void vpdfl_gaussian_sampler::sample ( vnl_vector< double > &  x) [virtual]

Draw random sample from Gaussian distribution.

Implements vpdfl_sampler_base.

Definition at line 73 of file vpdfl_gaussian_sampler.cxx.

void vpdfl_sampler_base::set_model ( const vpdfl_pdf_base model) [virtual, inherited]

Set model for which this is an instance.

Reimplemented in vpdfl_mixture_sampler, vpdfl_axis_gaussian_sampler, and vpdfl_gaussian_kernel_pdf_sampler.

Definition at line 34 of file vpdfl_sampler_base.cxx.


Member Data Documentation

workspace variable.

Reimplemented in vpdfl_pc_gaussian_sampler.

Definition at line 29 of file vpdfl_gaussian_sampler.h.

const vpdfl_pdf_base* vpdfl_sampler_base::pdf_model_ [protected, inherited]

Definition at line 31 of file vpdfl_sampler_base.h.

The random number generator.

Definition at line 27 of file vpdfl_gaussian_sampler.h.


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