Samples from Univariate exponential distributions. More...
#include <pdf1d_exponential_sampler.h>
Public Member Functions | |
pdf1d_exponential_sampler () | |
Dflt ctor. | |
virtual | ~pdf1d_exponential_sampler () |
Destructor. | |
virtual void | set_model (const pdf1d_pdf &) |
Set model for which this is an instance. | |
virtual double | sample () |
Draw random sample from Gaussian distribution. | |
virtual void | regular_samples (vnl_vector< double > &x) |
Fill x with samples possibly chosen so as to represent the distribution. | |
virtual void | reseed (unsigned long) |
Reseeds the internal random number generator. | |
const pdf1d_exponential & | exponential () 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 pdf1d_sampler * | clone () const |
Create a copy on the heap and return base class pointer. | |
const pdf1d_pdf & | model () const |
PDF of which this is an instance. | |
virtual void | get_samples (vnl_vector< double > &x) |
Fill x with samples drawn from distribution. | |
virtual void | regular_samples_and_prob (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. | |
const pdf1d_pdf * | pdf_model_ |
Samples from Univariate exponential distributions.
Definition at line 19 of file pdf1d_exponential_sampler.h.
pdf1d_exponential_sampler::pdf1d_exponential_sampler | ( | ) |
Dflt ctor.
Definition at line 18 of file pdf1d_exponential_sampler.cxx.
pdf1d_exponential_sampler::~pdf1d_exponential_sampler | ( | ) | [virtual] |
Destructor.
Definition at line 27 of file pdf1d_exponential_sampler.cxx.
pdf1d_sampler * pdf1d_exponential_sampler::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements pdf1d_sampler.
Definition at line 54 of file pdf1d_exponential_sampler.cxx.
const pdf1d_exponential & pdf1d_exponential_sampler::exponential | ( | ) | const |
Return a reference to the pdf model.
This is properly cast.
Definition at line 107 of file pdf1d_exponential_sampler.cxx.
void pdf1d_sampler::get_samples | ( | vnl_vector< double > & | x | ) | [virtual, inherited] |
Fill x with samples drawn from distribution.
Definition at line 45 of file pdf1d_sampler.cxx.
vcl_string pdf1d_exponential_sampler::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from pdf1d_sampler.
Definition at line 36 of file pdf1d_exponential_sampler.cxx.
bool pdf1d_exponential_sampler::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Does the name of the class match the argument?.
Reimplemented from pdf1d_sampler.
Definition at line 45 of file pdf1d_exponential_sampler.cxx.
const pdf1d_pdf & pdf1d_sampler::model | ( | ) | const [inherited] |
PDF of which this is an instance.
Definition at line 38 of file pdf1d_sampler.cxx.
void pdf1d_sampler::print_summary | ( | vcl_ostream & | os | ) | const [virtual, inherited] |
Print class to os.
Definition at line 101 of file pdf1d_sampler.cxx.
void pdf1d_exponential_sampler::regular_samples | ( | vnl_vector< double > & | x | ) | [virtual] |
Fill x with samples possibly chosen so as to represent the distribution.
5 or fewer samples requested, they are spaced out equally.
Reimplemented from pdf1d_sampler.
Definition at line 88 of file pdf1d_exponential_sampler.cxx.
void pdf1d_sampler::regular_samples_and_prob | ( | 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])
By default simply randomly sample from distribution
Definition at line 65 of file pdf1d_sampler.cxx.
void pdf1d_exponential_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 pdf1d_sampler.
Definition at line 60 of file pdf1d_exponential_sampler.cxx.
double pdf1d_exponential_sampler::sample | ( | ) | [virtual] |
Draw random sample from Gaussian distribution.
Implements pdf1d_sampler.
Definition at line 78 of file pdf1d_exponential_sampler.cxx.
void pdf1d_exponential_sampler::set_model | ( | const pdf1d_pdf & | model | ) | [virtual] |
Set model for which this is an instance.
Error check that it is an axis exponential.
Reimplemented from pdf1d_sampler.
Definition at line 68 of file pdf1d_exponential_sampler.cxx.
const pdf1d_pdf* pdf1d_sampler::pdf_model_ [protected, inherited] |
Definition at line 26 of file pdf1d_sampler.h.
vnl_random pdf1d_exponential_sampler::rng_ [protected] |
The random number generator.
Definition at line 23 of file pdf1d_exponential_sampler.h.