LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::histogram1D Class Reference
[Aggregate Data Types]

one dimensional histogram of type double More...

#include <ltiHistogram.h>

Inheritance diagram for lti::histogram1D:
Inheritance graph
[legend]
Collaboration diagram for lti::histogram1D:
Collaboration graph
[legend]

List of all members.

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 histogram1Dcopy (const histogram1D &other)
mathObjectclone () const
histogram1Doperator= (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

Detailed Description

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.


Constructor & Destructor Documentation

lti::histogram1D::histogram1D (  ) 

default constructor creates an empty histogram;

lti::histogram1D::histogram1D ( const int &  cells  ) 

create a one dimensional histogram of the given dimensionality.

Parameters:
cells the number of cells.
lti::histogram1D::histogram1D ( const histogram1D other  ) 

create this histogram as a copy of another histogram

Parameters:
other the histogram to be copied.
virtual lti::histogram1D::~histogram1D (  )  [virtual]

destructor


Member Function Documentation

value_type& lti::histogram1D::at ( const int &  x  )  [inline]

access element x of the histogram

Parameters:
x index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the number of entries in the given cell
const value_type& lti::histogram1D::at ( const int &  x  )  const [inline]

read-only access to the element x of the histogram

Parameters:
x index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the number of entries in the given cell
mathObject* lti::histogram1D::clone (  )  const [virtual]

create a clone of this histogram

Returns:
a pointer to a copy 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.

Parameters:
other the source histogram to be copied.
Returns:
a reference to this object

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.

Parameters:
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 $at(x)/n$, where n is the number of entries in the histogram (see getNumberOfEntries()).

Parameters:
x index of the histogram element to be accessed. It should be between getFirstCell() and getLastCell()
Returns:
the probabilty of the element x, respect to the histogram data.
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)).

Parameters:
other the histogram to be copied
Returns:
a reference to the actual histogram

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.

Parameters:
x index of the histogram element to be incremented
increment amount of the incrementation (default: 1)
Returns:
the new number of entries of the incremented cell.
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)

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


Member Data Documentation

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


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

Generated on Sat Apr 10 15:28:24 2010 for LTI-Lib by Doxygen 1.6.1