JayBeams  0.1
Another project to have fun coding.
Public Member Functions | Public Attributes | List of all members
jb::binning_strategy_concept Class Reference

The interface that must be met by the binning_strategy in jb::histogram. More...

Public Member Functions

sample_type histogram_min () const
 The minimum value that will be included in the histogram. More...
 
sample_type histogram_max () const
 The smallest value that will not be included in the histogram. More...
 
sample_type theoretical_min () const
 The minimum value that can be attained by the samples. More...
 
sample_type theoretical_max () const
 The minimum value that can be attained by the samples. More...
 
std::size_t sample2bin (sample_type const &x) const
 Map a variable type into a bin number. More...
 
sample_type bin2sample (std::size_t i) const
 Map a bin number into the start of its range. More...
 
sample_type interpolate (sample_type x_a, sample_type x_b, double y_a, double s, double q) const
 Interpolate a x-coordinate given endpoints and y values. More...
 

Public Attributes

typedef sample_type
 The type of the samples. More...
 

Detailed Description

The interface that must be met by the binning_strategy in jb::histogram.

Definition at line 5 of file binning_strategy_concept.dox.

Member Function Documentation

◆ bin2sample()

sample_type jb::binning_strategy_concept::bin2sample ( std::size_t  i) const

Map a bin number into the start of its range.

◆ histogram_max()

sample_type jb::binning_strategy_concept::histogram_max ( ) const

The smallest value that will not be included in the histogram.

Any sample with such a value or higher is included in the overflow bin.

Notice that the histogram only includes the samples such that: histogram_min() <= sample < histogram_max().

◆ histogram_min()

sample_type jb::binning_strategy_concept::histogram_min ( ) const

The minimum value that will be included in the histogram.

Any sample with a smaller value is included in the underflow bin.

◆ interpolate()

sample_type jb::binning_strategy_concept::interpolate ( sample_type  x_a,
sample_type  x_b,
double  y_a,
double  s,
double  q 
) const

Interpolate a x-coordinate given endpoints and y values.

Given the two endpoints (x_a,y_a) and (x_b,y_a + s) of a line, and a y value such that y is the [y_a,y_a + s] range, compute the value of \(x\) that most closely satisfies:

\[ {{(x - x_a)} \over {(y - y_a)}} = {{(x_b - x_a)} \over {s}} \]

This function is used to encapsulate rounding differences for different types of samples.

Parameters
x_aThe x coordinate for the a point.
y_aThe y coordinate for the a point.
x_bThe x coordinate for the b point.
sThe difference between y_b and y_a.
qA value in the [y_a,y_b] range.
Returns
The closest solution to the equation shown above for values in the sample_type domain.

◆ sample2bin()

std::size_t jb::binning_strategy_concept::sample2bin ( sample_type const &  x) const

Map a variable type into a bin number.

◆ theoretical_max()

sample_type jb::binning_strategy_concept::theoretical_max ( ) const

The minimum value that can be attained by the samples.

For example, 86400 if all samples are "secons within a day", or simply std::numberic_limits<sample_type>::max().

◆ theoretical_min()

sample_type jb::binning_strategy_concept::theoretical_min ( ) const

The minimum value that can be attained by the samples.

For example, 0 if all samples are known to be positive, or maybe std::numberic_limits<sample_type>::min().

Member Data Documentation

◆ sample_type

typedef jb::binning_strategy_concept::sample_type

The type of the samples.

Must be comparable using operator< and operator<=.

Definition at line 12 of file binning_strategy_concept.dox.


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