numerics
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
 Map value to bin index. Returns nbins (out of range sentinel) if outside.
 
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
 
real hi
 
idx nbins
 

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 51 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 58 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 62 of file stats.hpp.

References hi, num::ipow(), lo, and nbins.

Referenced by fill().

◆ bin_centre()

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

Definition at line 67 of file stats.hpp.

References hi, num::ipow(), lo, and nbins.

◆ bin_width()

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

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

References bin(), counts, num::ipow(), and nbins.

Referenced by main().

◆ pdf()

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

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

Definition at line 87 of file stats.hpp.

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

◆ reset()

void num::Histogram::reset ( )
inline

Definition at line 78 of file stats.hpp.

References counts.

Referenced by main().

◆ total()

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

Definition at line 80 of file stats.hpp.

References counts.

Referenced by pdf().

Member Data Documentation

◆ counts

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

Definition at line 52 of file stats.hpp.

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

◆ hi

real num::Histogram::hi

Definition at line 53 of file stats.hpp.

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

◆ lo

real num::Histogram::lo

Definition at line 53 of file stats.hpp.

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

◆ nbins

idx num::Histogram::nbins

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