eDSP  0.0.1
A cross-platform DSP library written in C++.
Public Types | Public Member Functions | List of all members
edsp::statistics::histogram< T, Allocator > Struct Template Reference

Histogram density estimator. More...

#include <histogram.hpp>

Public Types

using size_type = std::size_t
 
using value_type = T
 

Public Member Functions

constexpr histogram (size_type num_bins, size_type cache_size)
 Creates an Histogram with the specified number of bins and cache size. More...
 
template<typename InIterator , typename OutputIt >
constexpr void compute (InIterator first, InIterator last, OutputIt out)
 Computes the histogram of the range [first, last). More...
 

Detailed Description

template<typename T, typename Allocator = std::allocator<std::pair<T, T>>>
struct edsp::statistics::histogram< T, Allocator >

Histogram density estimator.

The histogram density estimator returns a histogram of the sample distribution. The positions and sizes of the bins are determined using a specifiable number of cached samples (cache_size). The range between the minimum and the maximum of the cached samples is subdivided into a specifiable number of bins (num_bins) of same size.

Template Parameters
TType of element.
AllocatorAllocator type, defaults to std::allocator<std::pair<T, T>>.

Member Typedef Documentation

◆ size_type

template<typename T , typename Allocator = std::allocator<std::pair<T, T>>>
using edsp::statistics::histogram< T, Allocator >::size_type = std::size_t

◆ value_type

template<typename T , typename Allocator = std::allocator<std::pair<T, T>>>
using edsp::statistics::histogram< T, Allocator >::value_type = T

Constructor & Destructor Documentation

◆ histogram()

template<typename T , typename Allocator = std::allocator<std::pair<T, T>>>
constexpr edsp::statistics::histogram< T, Allocator >::histogram ( size_type  num_bins,
size_type  cache_size 
)
inline

Creates an Histogram with the specified number of bins and cache size.

Parameters
num_binsNumber of bins.
cache_sizeNumber of cached samples to determine the positions and sizes of the bins.

Member Function Documentation

◆ compute()

template<typename T , typename Allocator = std::allocator<std::pair<T, T>>>
template<typename InIterator , typename OutputIt >
constexpr void edsp::statistics::histogram< T, Allocator >::compute ( InIterator  first,
InIterator  last,
OutputIt  out 
)
inline

Computes the histogram of the range [first, last).

Compute a range of std::pair, where each pair contains the position of the bin (lower bound) and the samples count (normalized with the total number of samples).

Parameters
firstInput iterator defining the begin of the range to examine.
lastInput iterator defining the end of the range to examine.
outOutput iterator containing the pairs (bin/sample).

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