1 #ifndef UTIL_INT_DISTRIBUTION_H 2 #define UTIL_INT_DISTRIBUTION_H 11 #include <util/param/ParamComposite.h> 12 #include <util/containers/DArray.h> 89 template <
class Archive>
90 void serialize(Archive& ar,
const unsigned int version);
109 void output(std::ostream& out);
160 {
return (value -
min_); }
183 template <
class Archive>
DArray< long > histogram_
Histogram array.
IntDistribution()
Default constructor.
IntDistribution & operator=(const IntDistribution &other)
Assignment operator.
int binIndex(int value)
Return the index of the bin for a value.
virtual ~IntDistribution()
Destructor.
void serialize(Archive &ar, const unsigned int version)
Serialize to/from an archive.
A distribution (or histogram) of values for an int variable.
Saving / output archive for binary ostream.
void output(std::ostream &out)
Output the distribution to file.
void clear()
Clear (i.e., zero) previously allocated histogram.
void setParam(int min, int max)
Set parameters and initialize.
void sample(int value)
Sample a value.
Utility classes for scientific computation.
int max() const
Get maximum value in range of histogram.
const DArray< long > & data() const
Get histogram array.
virtual void loadParameters(Serializable::IArchive &ar)
Load state from an archive.
int nBin() const
Get the number of bins.
Saving archive for binary istream.
void readParameters(std::istream &in)
Read parameters from file and initialize.
int min() const
Get minimum value in range of histogram.
int nReject_
Number of sampled values that were out of range.
virtual void save(Serializable::OArchive &ar)
Save state to an archive.
An object that can read multiple parameters from file.
int nSample_
Number of sampled values in Histogram.