This class represents a hyper-cube shaped uniform distribution. More...
#include <Uniform.h>
Public Member Functions | |
Uniform * | clone () const |
Creates a clone of the object. The clone method is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified. | |
double | getDensity (const arma::vec &vec) const |
Calculates the density of the distribution at point v. Will always return the same density if v is inside the volume, and 0 otherwise. | |
double | getLikelihood (const PDF &pdf) const |
double | getMaxDensity () const |
Returns the maximum density of this distribution, which always equals 1 / volume. | |
Uniform & | operator= (const Uniform &other) |
Assignment operator. The operation is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified. | |
void | setDensity (const double &density) |
Sets the density of the uniform distribution. | |
void | setMean (const pbl::Vector mean) |
Set the mean of the volume representing this uniform distribution. | |
void | setSize (const pbl::Vector size) |
Set the size of the volume representing this uniform distribution. | |
std::string | toString (const std::string &indent="") const |
Represents the uniform distribution as a string for easier console output. | |
Uniform (int dim) | |
Constructs a uniform distribution with known dimensionality but unknown size and density. | |
Uniform (int dim, double density) | |
Constructs a uniform distribution with known dimensionality and density, but unknown shape. Will become obsolete in the future. | |
Uniform (pbl::Vector mean, pbl::Vector size) | |
Constructs a uniform distribution with given mean value and size. The density of the distribution equals 1 / Volume, with the volume being determined by the size vector. | |
Uniform (const Uniform &pdf) | |
Copy constructor. | |
virtual | ~Uniform () |
Destructor. | |
Protected Member Functions | |
void | calculateUniformDensity () |
Protected Attributes | |
pbl::Vector | mean_ |
pbl::Vector | size_ |
bool | size_is_set_ |
double | uniform_probability_ |
This class represents a hyper-cube shaped uniform distribution.
Uniform::Uniform | ( | int | dim | ) |
Constructs a uniform distribution with known dimensionality but unknown size and density.
dim | The dimensionality of the uniform distribution |
Definition at line 42 of file Uniform.cpp.
Uniform::Uniform | ( | int | dim, |
double | density | ||
) |
Constructs a uniform distribution with known dimensionality and density, but unknown shape. Will become obsolete in the future.
dim | The dimensionality of the uniform distribution |
density | The density of the uniform distribution |
Definition at line 45 of file Uniform.cpp.
Uniform::Uniform | ( | pbl::Vector | mean, |
pbl::Vector | size | ||
) |
Constructs a uniform distribution with given mean value and size. The density of the distribution equals 1 / Volume, with the volume being determined by the size vector.
mean | The mean of the uniform distribution |
size | The size of the uniform distribution |
Definition at line 48 of file Uniform.cpp.
Uniform::Uniform | ( | const Uniform & | ) |
Copy constructor.
Definition at line 52 of file Uniform.cpp.
Uniform::~Uniform | ( | ) | [virtual] |
Destructor.
Definition at line 56 of file Uniform.cpp.
void Uniform::calculateUniformDensity | ( | ) | [protected] |
Definition at line 145 of file Uniform.cpp.
Uniform * Uniform::clone | ( | ) | const [virtual] |
Creates a clone of the object. The clone method is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified.
Implements pbl::PDF.
Definition at line 70 of file Uniform.cpp.
double Uniform::getDensity | ( | const arma::vec & | vec | ) | const |
Calculates the density of the distribution at point v. Will always return the same density if v is inside the volume, and 0 otherwise.
v | The point to calculate the density for |
Definition at line 128 of file Uniform.cpp.
double Uniform::getLikelihood | ( | const PDF & | ) | const [virtual] |
Implements pbl::PDF.
Definition at line 74 of file Uniform.cpp.
double Uniform::getMaxDensity | ( | ) | const [virtual] |
Returns the maximum density of this distribution, which always equals 1 / volume.
Implements pbl::PDF.
Definition at line 132 of file Uniform.cpp.
Assignment operator. The operation is cheap since it only copies a pointer. A deep clone will only be created if the original object is modified.
Definition at line 59 of file Uniform.cpp.
void Uniform::setDensity | ( | const double & | density | ) |
Sets the density of the uniform distribution.
density | The uniform density of the distribution |
Definition at line 123 of file Uniform.cpp.
void Uniform::setMean | ( | const pbl::Vector | mean | ) |
Set the mean of the volume representing this uniform distribution.
mean | The mean of the volumne |
Definition at line 136 of file Uniform.cpp.
void Uniform::setSize | ( | const pbl::Vector | size | ) |
Set the size of the volume representing this uniform distribution.
size | The size of the volumne |
Definition at line 140 of file Uniform.cpp.
std::string Uniform::toString | ( | const std::string & | indent = "" | ) | const [virtual] |
Represents the uniform distribution as a string for easier console output.
Implements pbl::PDF.
Definition at line 154 of file Uniform.cpp.
pbl::Vector pbl::Uniform::mean_ [protected] |
pbl::Vector pbl::Uniform::size_ [protected] |
bool pbl::Uniform::size_is_set_ [protected] |
double pbl::Uniform::uniform_probability_ [protected] |