Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pbl::Uniform Class Reference

This class represents a hyper-cube shaped uniform distribution. More...

#include <Uniform.h>

Inheritance diagram for pbl::Uniform:
Inheritance graph
[legend]

Public Member Functions

Uniformclone () 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. More...
 
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. More...
 
double getLikelihood (const PDF &pdf) const
 
double getMaxDensity () const
 Returns the maximum density of this distribution, which always equals 1 / volume. More...
 
Uniformoperator= (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. More...
 
void setDensity (const double &density)
 Sets the density of the uniform distribution. More...
 
void setMean (const pbl::Vector mean)
 Set the mean of the volume representing this uniform distribution. More...
 
void setSize (const pbl::Vector size)
 Set the size of the volume representing this uniform distribution. More...
 
std::string toString (const std::string &indent="") const
 Represents the uniform distribution as a string for easier console output. More...
 
 Uniform (int dim)
 Constructs a uniform distribution with known dimensionality but unknown size and density. More...
 
 Uniform (int dim, double density)
 Constructs a uniform distribution with known dimensionality and density, but unknown shape. Will become obsolete in the future. More...
 
 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. More...
 
 Uniform (const Uniform &pdf)
 Copy constructor. More...
 
virtual ~Uniform ()
 Destructor. More...
 
- Public Member Functions inherited from pbl::PDF
int dimensions () const
 
virtual bool getExpectedValue (std::string &v) const
 
virtual bool getExpectedValue (arma::vec &v) const
 
 PDF (int dimensions, PDFType type)
 
 PDF (const PDF &orig)
 
PDFType type () const
 
virtual ~PDF ()
 

Protected Member Functions

void calculateUniformDensity ()
 

Protected Attributes

pbl::Vector mean_
 
pbl::Vector size_
 
bool size_is_set_
 
double uniform_probability_
 
- Protected Attributes inherited from pbl::PDF
int dimensions_
 
PDFType type_
 

Additional Inherited Members

- Public Types inherited from pbl::PDF
enum  PDFType {
  GAUSSIAN, MIXTURE, UNIFORM, DISCRETE,
  EXACT, HYBRID, UNKNOWN
}
 

Detailed Description

This class represents a hyper-cube shaped uniform distribution.

Author
Sjoerd van den Dries
Date
December, 2012
Version
1.0

Definition at line 51 of file Uniform.h.

Constructor & Destructor Documentation

Uniform::Uniform ( int  dim)

Constructs a uniform distribution with known dimensionality but unknown size and density.

Parameters
dimThe 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.

Parameters
dimThe dimensionality of the uniform distribution
densityThe 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.

Parameters
meanThe mean of the uniform distribution
sizeThe size of the uniform distribution

Definition at line 48 of file Uniform.cpp.

Uniform::Uniform ( const Uniform pdf)

Copy constructor.

Definition at line 52 of file Uniform.cpp.

Uniform::~Uniform ( )
virtual

Destructor.

Definition at line 56 of file Uniform.cpp.

Member Function Documentation

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.

Parameters
vThe point to calculate the density for
Returns
The density of the distribution at point v

Definition at line 128 of file Uniform.cpp.

double Uniform::getLikelihood ( const PDF 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.

Returns
The maximum density of this distribution

Implements pbl::PDF.

Definition at line 132 of file Uniform.cpp.

Uniform & 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.

Definition at line 59 of file Uniform.cpp.

void Uniform::setDensity ( const double &  density)

Sets the density of the uniform distribution.

Note
Only makes sense if the size of the volume is not set
Parameters
densityThe 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.

Parameters
meanThe 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.

Parameters
sizeThe 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.

Note
Should be changed into stream operator <<
Returns
The Gaussian as string

Implements pbl::PDF.

Definition at line 154 of file Uniform.cpp.

Member Data Documentation

pbl::Vector pbl::Uniform::mean_
protected

Definition at line 148 of file Uniform.h.

pbl::Vector pbl::Uniform::size_
protected

Definition at line 150 of file Uniform.h.

bool pbl::Uniform::size_is_set_
protected

Definition at line 154 of file Uniform.h.

double pbl::Uniform::uniform_probability_
protected

Definition at line 152 of file Uniform.h.


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


problib
Author(s): Sjoerd van den Dries, Jos Elfring
autogenerated on Fri Apr 16 2021 02:32:19