numerics 0.1.0
Loading...
Searching...
No Matches
num::Histogram Struct Reference

Fixed-bin histogram over \([\ell,h)\). More...

#include <stats.hpp>

Public Member Functions

 Histogram (idx nbins, real lo, real hi)
 
idx bin (real x) const
 
real bin_centre (idx b) const
 
real bin_width () const
 
void fill (real x, real weight=1.0)
 
void reset ()
 
real total () const
 
std::vector< realpdf () const
 Normalise so that the histogram integrates to 1 (probability density).
 

Public Attributes

std::vector< realcounts
 
real lo = 0.0
 
real hi = 0.0
 
idx nbins = 0
 

Detailed Description

Fixed-bin histogram over \([\ell,h)\).

Definition at line 42 of file stats.hpp.

Constructor & Destructor Documentation

◆ Histogram()

num::Histogram::Histogram ( idx  nbins,
real  lo,
real  hi 
)
inline

Definition at line 48 of file stats.hpp.

Member Function Documentation

◆ bin()

idx num::Histogram::bin ( real  x) const
inline

Definition at line 54 of file stats.hpp.

References hi, lo, and nbins.

Referenced by fill().

◆ bin_centre()

real num::Histogram::bin_centre ( idx  b) const
inline

Definition at line 60 of file stats.hpp.

References hi, lo, and nbins.

◆ bin_width()

real num::Histogram::bin_width ( ) const
inline

Definition at line 64 of file stats.hpp.

References hi, lo, and nbins.

Referenced by pdf().

◆ fill()

void num::Histogram::fill ( real  x,
real  weight = 1.0 
)
inline

Definition at line 66 of file stats.hpp.

References bin(), counts, and nbins.

◆ pdf()

std::vector< real > num::Histogram::pdf ( ) const
inline

Normalise so that the histogram integrates to 1 (probability density).

Definition at line 82 of file stats.hpp.

References bin_width(), counts, nbins, num::norm(), and total().

◆ reset()

void num::Histogram::reset ( )
inline

Definition at line 72 of file stats.hpp.

References counts.

◆ total()

real num::Histogram::total ( ) const
inline

Definition at line 74 of file stats.hpp.

References counts.

Referenced by pdf().

Member Data Documentation

◆ counts

std::vector<real> num::Histogram::counts

Definition at line 43 of file stats.hpp.

Referenced by fill(), pdf(), reset(), and total().

◆ hi

real num::Histogram::hi = 0.0

Definition at line 45 of file stats.hpp.

Referenced by bin(), bin_centre(), and bin_width().

◆ lo

real num::Histogram::lo = 0.0

Definition at line 44 of file stats.hpp.

Referenced by bin(), bin_centre(), and bin_width().

◆ nbins

idx num::Histogram::nbins = 0

Definition at line 46 of file stats.hpp.

Referenced by bin(), bin_centre(), bin_width(), fill(), and pdf().


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