HistogramRWMathVec<int>
Member Functions | |||
addCount() binBoundaries() bins() |
larger() operator<<() operator=() |
resetCounts() smaller() totalCount() |
#include <rw/histo.h> #include <rw/math/mathvec.h> RWMathVec<double> v; unsigned n; Histogram H(n, v);
The class Histogram constructs and maintains a histogram of input data. The count is stored as a public RWMathVec<int> base class. It can be used anywhere an RWMathVec<int> can be used.
Histogram();
Constructs a histogram with 0 bins.
Histogram(unsigned nbins, const RWMathVec<double>& v);
Constructs a histogram from the data in v, with nbins bins of data. The bins are of equal size and are scaled with the maximum and minimum data in v. The count in the histogram is initialized with the contents of v.
Histogram(unsigned nbins, double min, double max);
Constructs a histogram with no initial data, with nbins bins. The bins are of equal size and are scaled with max and min.
Histogram(const RWMathVec<double>& b);
Constructs a histogram with no initial data, with bin boundaries defined by the data in b. The number of bins is b.length()-1.
Histogram(const Histogram& h);
Copy constructor. The new histogram does not reference the old histogram's data.
void addCount(double a);
Adds data value a to the histogram.
void addCount(const RWMathVec<double>& v);
Adds the contents of the vector v to the histogram.
RWMathVec<double> binBoundaries() const;
Returns the boundaries of the histogram's bins as a vector.
unsigned bins() const;
Returns the number of bins.
unsigned larger() const;
Returns the total accumulated number of data values that are greater than the largest bin.
Histogram& resetCounts();
Removes all data values from the histogram. Each bin count, including larger and smaller counts, is set to 0. The bin boundaries are retained. Returns a reference to self.
unsigned smaller() const;
Returns the total accumulated number of data values that are less than the smallest bin.
unsigned totalCount() const;
Returns the total accumulated number of data values in the histogram. This the sum of all the bin counts, plus the number of data values that are smaller than the smallest bin, and the number of data values that are larger than the largest bin.
Histogram& operator=(const Histogram& h)
Assignment operator. Self is a copy of h's data.
ostream& operator<<(ostream& s, const Histogram& h);
Outputs a summary of the histogram h on ostream s.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.