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

The parameters of a UniformBinsHistogram. More...

#include <tomographer/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)
 obvious constructor
 
template<typename OtherParams >
 Params (const OtherParams &other)
 Copy constructor, from any other UniformBinsHistogram::Params type.
 
bool is_within_bounds (Scalar value) const
 Tests whether the given value is in the range of the histogram. More...
 
std::size_t bin_index (Scalar value) const
 Returns which bin this value should be counted in (index in bins array) More...
 
std::size_t bin_index_unsafe (Scalar value) const
 Returns which bin this value should be counted in. More...
 
Scalar bin_lower_value (std::size_t index) const
 Returns the value which a given bin index represents (lower bin value limit) More...
 
Scalar bin_center_value (std::size_t index) const
 Returns the value which a given bin index represents (center bin value) More...
 
Scalar bin_upper_value (std::size_t index) const
 Returns the value which a given bin index represents (upper bin value limit) More...
 
Scalar bin_resolution () 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 80 of file histogram.h.

Member Function Documentation

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::bin_center_value ( 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 156 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
std::size_t Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::bin_index ( 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 116 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
std::size_t Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::bin_index_unsafe ( 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 is_within_bounds(value).

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

Definition at line 132 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::bin_lower_value ( 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 144 of file histogram.h.

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

Returns the width of a bin.

This is simply (max - min) / num_bins.

Definition at line 178 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
Scalar Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::bin_upper_value ( 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 169 of file histogram.h.

template<typename Scalar_, typename CountType_ = unsigned int>
bool Tomographer::UniformBinsHistogram< Scalar_, CountType_ >::Params::is_within_bounds ( 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 107 of file histogram.h.


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