ompl::PDF< _T > Class Template Reference
A container that supports probabilistic sampling over weighted data.
More...
#include <PDF.h>
List of all members.
Classes |
class | Element |
| A class that will hold data contained in the PDF. More...
|
Public Member Functions |
Element & | add (const _T &d, const double w) |
| Adds a piece of data with a given weight to the PDF. Returns a corresponding Element, which can be used to subsequently update or remove the data from the PDF.
|
void | clear (void) |
| Clears the PDF.
|
bool | empty (void) const |
| Returns whether the PDF contains no data.
|
| PDF (const std::vector< _T > &d, const std::vector< double > &weights) |
| Constructs a PDF containing a given vector of data with given weights.
|
| PDF (void) |
| Constructs an empty PDF.
|
void | printTree (std::ostream &out=std::cout) const |
| Prints the PDF tree to a given output stream. Used for debugging purposes.
|
void | remove (Element &elem) |
| Removes the data in the given Element from the PDF. After calling this function, the Element object should no longer be used.
|
const _T & | sample (double r) const |
| Returns a piece of data from the PDF according to the input sampling value, which must be between 0 and 1.
|
std::size_t | size (void) const |
| Returns the number of elements in the PDF.
|
void | update (Element &elem, const double w) |
| Updates the data in the given Element with a new weight value.
|
| ~PDF (void) |
| Destructor. Clears allocated memory.
|
Private Attributes |
std::vector< Element * > | data_ |
std::vector< std::vector
< double > > | tree_ |
Detailed Description
template<typename _T>
class ompl::PDF< _T >
A container that supports probabilistic sampling over weighted data.
Definition at line 48 of file PDF.h.
Constructor & Destructor Documentation
Constructs an empty PDF.
Definition at line 67 of file PDF.h.
template<typename _T >
ompl::PDF< _T >::PDF |
( |
const std::vector< _T > & |
d, |
|
|
const std::vector< double > & |
weights | |
|
) |
| | [inline] |
Constructs a PDF containing a given vector of data with given weights.
Definition at line 72 of file PDF.h.
Destructor. Clears allocated memory.
Definition at line 85 of file PDF.h.
Member Function Documentation
Adds a piece of data with a given weight to the PDF. Returns a corresponding Element, which can be used to subsequently update or remove the data from the PDF.
Definition at line 91 of file PDF.h.
template<typename _T >
void ompl::PDF< _T >::clear |
( |
void |
|
) |
[inline] |
template<typename _T >
bool ompl::PDF< _T >::empty |
( |
void |
|
) |
const [inline] |
Returns whether the PDF contains no data.
Definition at line 238 of file PDF.h.
template<typename _T >
void ompl::PDF< _T >::printTree |
( |
std::ostream & |
out = std::cout |
) |
const [inline] |
Prints the PDF tree to a given output stream. Used for debugging purposes.
Definition at line 244 of file PDF.h.
Removes the data in the given Element from the PDF. After calling this function, the Element object should no longer be used.
Definition at line 165 of file PDF.h.
template<typename _T >
const _T& ompl::PDF< _T >::sample |
( |
double |
r |
) |
const [inline] |
Returns a piece of data from the PDF according to the input sampling value, which must be between 0 and 1.
Definition at line 126 of file PDF.h.
template<typename _T >
std::size_t ompl::PDF< _T >::size |
( |
void |
|
) |
const [inline] |
Returns the number of elements in the PDF.
Definition at line 232 of file PDF.h.
Updates the data in the given Element with a new weight value.
Definition at line 149 of file PDF.h.
Member Data Documentation
The documentation for this class was generated from the following file: