bpp::IntervalData Class Reference

Interval data storage. More...

#include <Bpp/Numeric/IntervalData.h>

Collaboration diagram for bpp::IntervalData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 IntervalData (const Domain &domain, const std::string &name="")
virtual ~IntervalData ()
virtual const DomaingetDomain () const
virtual double getDomainValue (double x) const
virtual void setName (const std::string &name)
 Set the name of this data.
virtual const std::string & getName () const
virtual unsigned int getFreq (unsigned int i) const
virtual double getDensity (unsigned int i) const
virtual const std::vector
< unsigned int > & 
getFrequencies () const
virtual Vdouble getDensities () const
virtual void addValue (double value) throw (OutOfRangeException)
 Add a value to this data set.
virtual unsigned int getSize () const
virtual double getMinValue () const
virtual double getMaxValue () const
virtual double getMean () const
virtual double getSD () const
virtual double getSDP () const
virtual void reset ()
 Reset the container.
virtual void print (std::ostream &out) const
 Print a summary of this data.

Private Attributes

const Domain _domain
std::vector< unsigned int > _freqs
std::string _name
double _sum
double _sumsquare
double _min
double _max
unsigned int _n

Detailed Description

Interval data storage.

This class uses a Domain object for bounds and midpoints storage. the number of points in each interval/class is also stored.

Several statistical computations can be performed.

Adapted from the Java PSOL library.

Definition at line 62 of file IntervalData.h.


Constructor & Destructor Documentation

IntervalData::IntervalData ( const Domain domain,
const std::string &  name = "" 
)

Definition at line 46 of file IntervalData.cpp.

References reset().

virtual bpp::IntervalData::~IntervalData (  )  [inline, virtual]

Definition at line 74 of file IntervalData.h.


Member Function Documentation

void IntervalData::addValue ( double  value  )  throw (OutOfRangeException) [virtual]

Add a value to this data set.

Check for the interval this value belongs to, and update inner data (counts, sums, etc.).

Parameters:
value The value to add.
Exceptions:
OutOfRangeException If the value does not belong to the domain of this data set.

Definition at line 59 of file IntervalData.cpp.

Vdouble IntervalData::getDensities (  )  const [virtual]
Returns:
A vector with all element proportions.

Definition at line 52 of file IntervalData.cpp.

References _freqs, and getDensity().

virtual double bpp::IntervalData::getDensity ( unsigned int  i  )  const [inline, virtual]
Returns:
The proportion of elements in interval i.
Parameters:
i the index of the interval.

Definition at line 109 of file IntervalData.h.

References _freqs, and _n.

Referenced by getDensities(), and print().

virtual const Domain& bpp::IntervalData::getDomain (  )  const [inline, virtual]
Returns:
The domain associated to this data.

Definition at line 81 of file IntervalData.h.

References _domain.

virtual double bpp::IntervalData::getDomainValue ( double  x  )  const [inline, virtual]
Returns:
The value of the class the given value belongs to.

Definition at line 86 of file IntervalData.h.

References _domain, and bpp::Domain::getNearestValue().

virtual unsigned int bpp::IntervalData::getFreq ( unsigned int  i  )  const [inline, virtual]
Returns:
The number of elements in interval i.
Parameters:
i The index of the interval.

Definition at line 103 of file IntervalData.h.

References _freqs.

virtual const std::vector<unsigned int>& bpp::IntervalData::getFrequencies (  )  const [inline, virtual]
Returns:
A vector with all element counts.

Definition at line 114 of file IntervalData.h.

References _freqs.

virtual double bpp::IntervalData::getMaxValue (  )  const [inline, virtual]
Returns:
The maximum value in the dataset.

Definition at line 144 of file IntervalData.h.

References _max.

virtual double bpp::IntervalData::getMean (  )  const [inline, virtual]
Returns:
The true mean of the dataset.

Definition at line 149 of file IntervalData.h.

References _n, and _sum.

virtual double bpp::IntervalData::getMinValue (  )  const [inline, virtual]
Returns:
The minimum value in the dataset.

Definition at line 139 of file IntervalData.h.

References _min.

virtual const std::string& bpp::IntervalData::getName (  )  const [inline, virtual]
Returns:
The name of this data.

Definition at line 97 of file IntervalData.h.

References _name.

virtual double bpp::IntervalData::getSD (  )  const [inline, virtual]
Returns:
The estimation of the standard deviation of the data set (that is, the sum is divided by $n-1$ where $n$ is the number of points).

Definition at line 155 of file IntervalData.h.

References _n, and getSDP().

virtual double bpp::IntervalData::getSDP (  )  const [inline, virtual]
Returns:
The standard deviation of the data set (that is, the sum is divided by the number of points $n$ rather than $n-1$).

Definition at line 161 of file IntervalData.h.

References _n, _sum, and _sumsquare.

Referenced by getSD().

virtual unsigned int bpp::IntervalData::getSize (  )  const [inline, virtual]
Returns:
The total number of elements in this data set.

Definition at line 134 of file IntervalData.h.

References _n.

void IntervalData::print ( std::ostream &  out  )  const [virtual]

Print a summary of this data.

Parameters:
out The stream where to print the summary.

Definition at line 81 of file IntervalData.cpp.

References _domain, _freqs, bpp::Domain::getBound(), getDensity(), bpp::Domain::getSize(), and bpp::Domain::getValue().

void IntervalData::reset (  )  [virtual]

Reset the container.

Remove all data and reinitialize all values (counts, sum, etc.).

Definition at line 71 of file IntervalData.cpp.

References _domain, _freqs, _max, _min, _n, _sum, _sumsquare, and bpp::Domain::getSize().

Referenced by IntervalData().

virtual void bpp::IntervalData::setName ( const std::string &  name  )  [inline, virtual]

Set the name of this data.

Parameters:
name A name.

Definition at line 93 of file IntervalData.h.

References _name.


Member Data Documentation

Definition at line 65 of file IntervalData.h.

Referenced by getDomain(), getDomainValue(), print(), and reset().

std::vector<unsigned int> bpp::IntervalData::_freqs [private]

Definition at line 66 of file IntervalData.h.

Referenced by getDensities(), getDensity(), getFreq(), getFrequencies(), print(), and reset().

double bpp::IntervalData::_max [private]

Definition at line 68 of file IntervalData.h.

Referenced by getMaxValue(), and reset().

double bpp::IntervalData::_min [private]

Definition at line 68 of file IntervalData.h.

Referenced by getMinValue(), and reset().

unsigned int bpp::IntervalData::_n [private]

Definition at line 69 of file IntervalData.h.

Referenced by getDensity(), getMean(), getSD(), getSDP(), getSize(), and reset().

std::string bpp::IntervalData::_name [private]

Definition at line 67 of file IntervalData.h.

Referenced by getName(), and setName().

double bpp::IntervalData::_sum [private]

Definition at line 68 of file IntervalData.h.

Referenced by getMean(), getSDP(), and reset().

Definition at line 68 of file IntervalData.h.

Referenced by getSDP(), and reset().


The documentation for this class was generated from the following files:
Generated on Wed Feb 29 14:48:27 2012 for bpp-core by  doxygen 1.6.3