Tomographer  v2.0
Tomographer C++ Framework Documentation
Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params Struct Reference

The parameters of a UniformBinsHistogram. More...

#include <tomographer2/histogram.h>

+ Collaboration diagram for Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params:

Public Member Functions

 Params (Scalar min_=0.0, Scalar max_=1.0, std::size_t num_bins_=50)
 The obvious constructor.
 
template<typename OtherParams >
 Params (const OtherParams &other)
 Copy constructor, from any other UniformBinsHistogram::Params type.
 
bool isWithinBounds (Scalar value) const
 Tests whether the given value is in the range of the histogram. More...
 
std::size_t binIndex (Scalar value) const
 Returns which bin this value should be counted in (index in bins array) More...
 
std::size_t binIndexUnsafe (Scalar value) const
 Returns which bin this value should be counted in. More...
 
Scalar binLowerValue (std::size_t index) const
 Returns the value which a given bin index represents (lower bin value limit) More...
 
Scalar binCenterValue (std::size_t index) const
 Returns the value which a given bin index represents (center bin value) More...
 
Scalar binUpperValue (std::size_t index) const
 Returns the value which a given bin index represents (upper bin value limit) More...
 
Scalar binResolution () const
 Returns the width of a bin. More...
 

Public Attributes

Scalar min
 Lower range value.
 
Scalar max
 Upper range value.
 
std::size_t num_bins
 Number of bins to split the range into.
 

Detailed Description

template<typename Scalar_, typename CountType_ = unsigned int>
struct Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params

The parameters of a UniformBinsHistogram.

This is the \([\text{min},\text{max}]\) range and the number of bins.

Definition at line 87 of file histogram.h.

Member Function Documentation

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binCenterValue ( std::size_t  index) const
inline

Returns the value which a given bin index represents (center bin value)

This is the value at the center of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 163 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
std::size_t Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binIndex ( Scalar  value) const
inline

Returns which bin this value should be counted in (index in bins array)

Note
Raises std::out_of_range if the value is not in the range \( [\text{min},\text{max}[ \).

Definition at line 123 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
std::size_t Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binIndexUnsafe ( Scalar  value) const
inline

Returns which bin this value should be counted in.

This function blindly assumes its argument is within bounds, i.e. it must satisfy isWithinBounds(value).

Use this function only if you're sure the value is within bounds, otherwise call binIndex().

Definition at line 139 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binLowerValue ( std::size_t  index) const
inline

Returns the value which a given bin index represents (lower bin value limit)

This is the value at the left edge of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 151 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binResolution ( ) const
inline

Returns the width of a bin.

This is simply (max - min) / num_bins.

Definition at line 185 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::binUpperValue ( std::size_t  index) const
inline

Returns the value which a given bin index represents (upper bin value limit)

This is the value at the right edge of the bin.

Note
The index must be valid, i.e. index >= 0 && index < num_bins, or you might get an assert() failure in your face.

Definition at line 176 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
bool Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::isWithinBounds ( Scalar  value) const
inline

Tests whether the given value is in the range of the histogram.

Returns
true if value is finite (not inf or nan) and within the interval \([\text{min},\text{max}[\).

Definition at line 114 of file histogram.h.


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