Loading...
Searching...
No Matches
Histogram Class Reference

This class computes a histogram, with a fixed interval width, of a population of floating-point values. More...

`#include <openvdb/math/Stats.h>`

## Public Member Functions

| Histogram (double min, double max, size_t numBins=10)
| Construct with given minimum and maximum values and the given bin count.
| Histogram (const Stats &s, size_t numBins=10)
| Construct with the given bin count and with minimum and maximum values taken from a Stats object.
bool | add (double val, uint64_t n=1)
| Add n samples with constant value val, provided that the val falls within this histogram's value range.
bool | add (const Histogram &other)
| Add all the contributions from the other histogram, provided that it has the same configuration as this histogram.
size_t | numBins () const
| Return the number of bins in this histogram.
double | min () const
| Return the lower bound of this histogram's value range.
double | max () const
| Return the upper bound of this histogram's value range.
double | min (int n) const
| Return the minimum value in the nth bin.
double | max (int n) const
| Return the maximum value in the nth bin.
uint64_t | count (int n) const
| Return the number of samples in the nth bin.
uint64_t | size () const
| Return the population size, i.e., the total number of samples.
void | print (const std::string &name="", std::ostream &strm=std::cout) const
| Print the histogram to the specified output stream.

## Detailed Description

This class computes a histogram, with a fixed interval width, of a population of floating-point values.

## Constructor & Destructor Documentation

## Histogram() [1/2]

Histogram | ( | double | min,
|  | double | max,
|  | size_t | numBins = 10 )

inline

Construct with given minimum and maximum values and the given bin count.

## Histogram() [2/2]

Histogram | ( | const Stats & | s,
|  | size_t | numBins = 10 )

inline

Construct with the given bin count and with minimum and maximum values taken from a Stats object.

## Member Function Documentation

## add() [1/2]

bool add | ( | const Histogram & | other | ) |

inline

Add all the contributions from the other histogram, provided that it has the same configuration as this histogram.

## add() [2/2]

bool add | ( | double | val,
|  | uint64_t | n = 1 )

inline

Add n samples with constant value val, provided that the val falls within this histogram's value range.

Returns
  `true` if the sample value falls within this histogram's value range.

## count()

uint64_t count | ( | int | n | ) | const

inline

Return the number of samples in the nth bin.

## max() [1/2]

double max | ( |  | ) | const

inline

Return the upper bound of this histogram's value range.

## max() [2/2]

double max | ( | int | n | ) | const

inline

Return the maximum value in the nth bin.

## min() [1/2]

double min | ( |  | ) | const

inline

Return the lower bound of this histogram's value range.

## min() [2/2]

double min | ( | int | n | ) | const

inline

Return the minimum value in the nth bin.

## numBins()

size_t numBins | ( |  | ) | const

inline

Return the number of bins in this histogram.

## print()

void print | ( | const std::string & | name = "",
|  | std::ostream & | strm = std::cout ) const

inline

Print the histogram to the specified output stream.

## size()

uint64_t size | ( |  | ) | const

inline

Return the population size, i.e., the total number of samples.