Alexandria 2.31.2
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Euclid::Histogram::Binning::Sqrt< VarType > Class Template Reference

#include <Sqrt.h>

Inheritance diagram for Euclid::Histogram::Binning::Sqrt< VarType >:
Collaboration diagram for Euclid::Histogram::Binning::Sqrt< VarType >:

Public Member Functions

template<typename Iterator>
void computeBins (Iterator begin, Iterator end)
 
ssize_t getBinIndex (VarType value) const final
 
std::pair< VarType, VarType > getBinEdges (size_t i) const final
 
VarType getEdge (size_t i) const final
 
- Public Member Functions inherited from Euclid::Histogram::BinStrategy< VarType >
 BinStrategy ()
 
virtual ~BinStrategy ()=default
 
size_t getBinCount () const
 
virtual std::vector< VarType > getEdges () const
 
virtual VarType getBin (size_t i) const
 

Private Attributes

VarType m_start
 
VarType m_step
 
VarType m_end
 

Additional Inherited Members

- Protected Attributes inherited from Euclid::Histogram::BinStrategy< VarType >
size_t m_nbins
 

Detailed Description

template<typename VarType>
class Euclid::Histogram::Binning::Sqrt< VarType >

Bin strategy that estimates the number of bins as \( \sqrt{n} \)

Definition at line 43 of file Sqrt.h.

Member Function Documentation

◆ computeBins()

template<typename VarType>
template<typename Iterator>
void Euclid::Histogram::Binning::Sqrt< VarType >::computeBins ( Iterator begin,
Iterator end )
inline

Definition at line 46 of file Sqrt.h.

References std::ceil(), m_end, Euclid::Histogram::BinStrategy< VarType >::m_nbins, m_start, m_step, std::minmax_element(), and std::sqrt().

Here is the call graph for this function:

◆ getBinEdges()

template<typename VarType>
std::pair< VarType, VarType > Euclid::Histogram::Binning::Sqrt< VarType >::getBinEdges ( size_t i) const
inlinefinalvirtual

Get the two edges corresponding to the bin i

Parameters
iThe bin index
Returns
The two bin edges

Reimplemented from Euclid::Histogram::BinStrategy< VarType >.

Definition at line 60 of file Sqrt.h.

References m_start, m_step, and std::make_pair().

Here is the call graph for this function:

◆ getBinIndex()

template<typename VarType>
ssize_t Euclid::Histogram::Binning::Sqrt< VarType >::getBinIndex ( VarType value) const
inlinefinalvirtual

Get the bin index corresponding to the given value

Parameters
valueThe value to map to a bin
Returns
The bin index. If value is outside of the bounds, a negative number or a value bigger or equal to m_nbins can be used to mark the fact

Implements Euclid::Histogram::BinStrategy< VarType >.

Definition at line 54 of file Sqrt.h.

References m_end, Euclid::Histogram::BinStrategy< VarType >::m_nbins, m_start, and m_step.

◆ getEdge()

template<typename VarType>
VarType Euclid::Histogram::Binning::Sqrt< VarType >::getEdge ( size_t e) const
inlinefinalvirtual

Get the edge value e. Note that there are always one more edge than bins: i.e. the bin 0 has the edges (0, 1), the bin 1 the edges (1, 2), etc...

Implements Euclid::Histogram::BinStrategy< VarType >.

Definition at line 64 of file Sqrt.h.

References m_start, and m_step.

Member Data Documentation

◆ m_end

template<typename VarType>
VarType Euclid::Histogram::Binning::Sqrt< VarType >::m_end
private

Definition at line 70 of file Sqrt.h.

Referenced by computeBins(), and getBinIndex().

◆ m_start

template<typename VarType>
VarType Euclid::Histogram::Binning::Sqrt< VarType >::m_start
private

Definition at line 70 of file Sqrt.h.

Referenced by computeBins(), getBinEdges(), getBinIndex(), and getEdge().

◆ m_step

template<typename VarType>
VarType Euclid::Histogram::Binning::Sqrt< VarType >::m_step
private

Definition at line 70 of file Sqrt.h.

Referenced by computeBins(), getBinEdges(), getBinIndex(), and getEdge().


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