#include <pdf1d_sampler.h>
Inheritance diagram for pdf1d_sampler:

This is really a random number generator whose outputs have the PDF of the relevant pdf1d_pdf. Sampler objects should only exist as long as their pdf object, and are not meant to be persistent.
Definition at line 23 of file pdf1d_sampler.h.
Public Member Functions | |
| pdf1d_sampler () | |
| Dflt ctor. | |
| virtual | ~pdf1d_sampler () |
| Destructor. | |
| const pdf1d_pdf & | model () const |
| PDF of which this is an instance. | |
| virtual void | set_model (const pdf1d_pdf &) |
| Set model for which this is an instance. | |
| virtual double | sample ()=0 |
| Draw random sample from distribution. | |
| virtual void | get_samples (vnl_vector< double > &x) |
| Fill x with samples drawn from distribution. | |
| virtual void | regular_samples (vnl_vector< double > &x) |
| Fill x with samples possibly chosen so as to represent the 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 | reseed (unsigned long)=0 |
| Reseeds the internal random number generator. | |
| 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 =0 |
| Create a copy on the heap and return base class pointer. | |
| virtual void | print_summary (vcl_ostream &os) const |
| Print class to os. | |
Protected Attributes | |
| const pdf1d_pdf * | pdf_model_ |
|
|
Dflt ctor.
Definition at line 18 of file pdf1d_sampler.cxx. |
|
|
Destructor.
Definition at line 26 of file pdf1d_sampler.cxx. |
|
|
Create a copy on the heap and return base class pointer.
Implemented in pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, pdf1d_mixture_sampler, and pdf1d_weighted_epanech_kernel_sampler. |
|
|
Fill x with samples drawn from distribution.
Definition at line 45 of file pdf1d_sampler.cxx. |
|
|
Name of the class.
Reimplemented in pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, pdf1d_mixture_sampler, and pdf1d_weighted_epanech_kernel_sampler. Definition at line 82 of file pdf1d_sampler.cxx. |
|
|
Does the name of the class match the argument?.
Reimplemented in pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, pdf1d_mixture_sampler, and pdf1d_weighted_epanech_kernel_sampler. Definition at line 91 of file pdf1d_sampler.cxx. |
|
|
PDF of which this is an instance.
Definition at line 38 of file pdf1d_sampler.cxx. |
|
|
Print class to os.
Definition at line 101 of file pdf1d_sampler.cxx. |
|
|
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 pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, and pdf1d_weighted_epanech_kernel_sampler. Definition at line 55 of file pdf1d_sampler.cxx. |
|
||||||||||||
|
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 65 of file pdf1d_sampler.cxx. |
|
|
Reseeds the internal random number generator. To achieve quasi-random initialisation use; #include <vcl_ctime.h>
..
sampler.reseed(vcl_time(0));
Implemented in pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, pdf1d_mixture_sampler, and pdf1d_weighted_epanech_kernel_sampler. |
|
|
Draw random sample from distribution.
Implemented in pdf1d_epanech_kernel_pdf_sampler, pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_kernel_pdf_sampler, pdf1d_gaussian_sampler, pdf1d_mixture_sampler, and pdf1d_weighted_epanech_kernel_sampler. |
|
|
Set model for which this is an instance.
Reimplemented in pdf1d_exponential_sampler, pdf1d_flat_sampler, pdf1d_gaussian_sampler, and pdf1d_mixture_sampler. Definition at line 32 of file pdf1d_sampler.cxx. |
|
|
Definition at line 26 of file pdf1d_sampler.h. |
1.4.4