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

#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 [lo, hi). Useful for umbrella sampling – each window collects a Histogram of the reaction coordinate (e.g. nucleus size), then WHAM stitches them together.

Definition at line 57 of file stats.hpp.

Constructor & Destructor Documentation

◆ Histogram()

num::Histogram::Histogram ( idx  nbins,
real  lo,
real  hi 
)
inline
Parameters
nbinsNumber of bins
lo,hiRange of the histogram [lo, hi)

Definition at line 65 of file stats.hpp.

Member Function Documentation

◆ bin()

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

Map value to bin index. Returns nbins (out of range sentinel) if outside.

Definition at line 73 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 80 of file stats.hpp.

References hi, lo, and nbins.

◆ bin_width()

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

Definition at line 86 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 90 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 108 of file stats.hpp.

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

◆ reset()

void num::Histogram::reset ( )
inline

Definition at line 96 of file stats.hpp.

References counts.

◆ total()

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

Definition at line 100 of file stats.hpp.

References counts.

Referenced by pdf().

Member Data Documentation

◆ counts

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

Definition at line 58 of file stats.hpp.

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

◆ hi

real num::Histogram::hi = 0.0

Definition at line 60 of file stats.hpp.

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

◆ lo

real num::Histogram::lo = 0.0

Definition at line 59 of file stats.hpp.

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

◆ nbins

idx num::Histogram::nbins = 0

Definition at line 61 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: