|
latest version v1.9 - last update 10 Apr 2010 |
|
one dimensional histogram of type double More...
#include <ltiHistogram.h>


Public Member Functions | |
| histogram1D () | |
| histogram1D (const int &cells) | |
| histogram1D (const histogram1D &other) | |
| virtual | ~histogram1D () |
| const char * | getTypeName () const |
| const int & | getFirstCell () const |
| const int & | getLastCell () const |
| int | size () const |
| void | resize (const int &cells) |
| void | initialize (const value_type &value=value_type(0)) |
| void | fill (const value_type &iniValue, const int &from=0, const int &to=MaxInt32) |
| const value_type & | at (const int &x) const |
| value_type & | at (const int &x) |
| const value_type & | put (const int &x, const value_type &increment=1.0f) |
| value_type | getProbability (const int &x) const |
| virtual histogram1D & | copy (const histogram1D &other) |
| mathObject * | clone () const |
| histogram1D & | operator= (const histogram1D &other) |
| int | getIndexOfMaximum () const |
| int | getIndexOfMinimum () const |
| virtual bool | write (ioHandler &handler, const bool complete=true) const |
| virtual bool | read (ioHandler &handler, const bool complete=true) |
Protected Attributes | |
| int | firstCell |
| int | lastCell |
one dimensional histogram of type double
The implementation of the 1D histogram allows an efficient way to create 1D histogram... much faster than using n-dimensional histograms with dimension 1.
| lti::histogram1D::histogram1D | ( | ) |
default constructor creates an empty histogram;
| lti::histogram1D::histogram1D | ( | const int & | cells | ) |
create a one dimensional histogram of the given dimensionality.
| cells | the number of cells. |
| lti::histogram1D::histogram1D | ( | const histogram1D & | other | ) |
create this histogram as a copy of another histogram
| other | the histogram to be copied. |
| virtual lti::histogram1D::~histogram1D | ( | ) | [virtual] |
destructor
| value_type& lti::histogram1D::at | ( | const int & | x | ) | [inline] |
access element x of the histogram
| x | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| const value_type& lti::histogram1D::at | ( | const int & | x | ) | const [inline] |
read-only access to the element x of the histogram
| x | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| mathObject* lti::histogram1D::clone | ( | ) | const [virtual] |
create a clone of this histogram
Reimplemented from lti::thistogram< T >.
| virtual histogram1D& lti::histogram1D::copy | ( | const histogram1D & | other | ) | [virtual] |
assigment operator.
copy the contents of other in this object.
| other | the source histogram to be copied. |
Reimplemented from lti::thistogram< T >.
Referenced by operator=().
| void lti::histogram1D::fill | ( | const value_type & | iniValue, | |
| const int & | from = 0, |
|||
| const int & | to = MaxInt32 | |||
| ) |
fills the histogram elements with iniValue between the n-dimensional points from and to.
| iniValue | the elements will be initialized with this value. | |
| from | first element index | |
| to | last element index |
If from or to are out of bounds, they will be (internaly) adjusted to a correct value.
Example:
lti::histogram1D hist(10); // 1D-histogram with 10 elements hist.clear(); hist.fill(9,1,3); // hist=[0,9,9,9,0,0,0,0,0,0]
| const int& lti::histogram1D::getFirstCell | ( | ) | const [inline] |
Returns the index of the first histogram element, which is always zero.
Reimplemented from lti::thistogram< T >.
| int lti::histogram1D::getIndexOfMaximum | ( | ) | const [inline] |
get the index of the biggest element in the histogram
Reimplemented from lti::thistogram< T >.
| int lti::histogram1D::getIndexOfMinimum | ( | ) | const [inline] |
get the index of the smallest element in the histogram
Reimplemented from lti::thistogram< T >.
| const int& lti::histogram1D::getLastCell | ( | ) | const [inline] |
Returns a vector to the last element of the histogram.
Reimplemented from lti::thistogram< T >.
| value_type lti::histogram1D::getProbability | ( | const int & | x | ) | const [inline] |
read-only access to the element x of the histogram as a discrete probability distribution term.
This is equivalent to
, where n is the number of entries in the histogram (see getNumberOfEntries()).
| x | index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell() |
| const char* lti::histogram1D::getTypeName | ( | void | ) | const [inline, virtual] |
returns the name of this class: "histogram"
Reimplemented from lti::thistogram< T >.
| void lti::histogram1D::initialize | ( | const value_type & | value = value_type(0) |
) |
initialize all cells of the histogram with 0 (or another specified number).
Reimplemented from lti::thistogram< T >.
| histogram1D& lti::histogram1D::operator= | ( | const histogram1D & | other | ) | [inline] |
assigment operator (alias for copy(other)).
| other | the histogram to be copied |
Reimplemented from lti::thistogram< T >.
References copy().
| const value_type& lti::histogram1D::put | ( | const int & | x, | |
| const value_type & | increment = 1.0f | |||
| ) | [inline] |
increment the cell at x by the given number of elements (or 1.0 if nothing is explicitly indicated!) and update the number of entries in the histogram.
| x | index of the histogram element to be incremented | |
| increment | amount of the incrementation (default: 1) |
| virtual bool lti::histogram1D::read | ( | ioHandler & | handler, | |
| const bool | complete = true | |||
| ) | [virtual] |
read the object from the given ioHandler
Reimplemented from lti::thistogram< T >.
| void lti::histogram1D::resize | ( | const int & | cells | ) |
change cell number of the histogram.
All data will be lost! (it will be initialized with 0)
| cells | the number of cells per dimension |
| int lti::histogram1D::size | ( | ) | const [inline] |
Returns the total number of cells in this histogram.
This method is slower than getLastCell, since it need to make some arithmetical operations. You should use getLastCell instead.
| virtual bool lti::histogram1D::write | ( | ioHandler & | handler, | |
| const bool | complete = true | |||
| ) | const [virtual] |
write the object in the given ioHandler
Reimplemented from lti::thistogram< T >.
int lti::histogram1D::firstCell [protected] |
first index ( 0 )
Reimplemented from lti::thistogram< T >.
int lti::histogram1D::lastCell [protected] |
last index (cellsInDimension(0) - 1)
Reimplemented from lti::thistogram< T >.