OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
GSLHistogram.h File Reference
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <stdexcept>
#include <vector>
Include dependency graph for GSLHistogram.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gsl_histogram
 1D histogram with explicit bin edges. More...
 
class  gsl_histogram2d
 2D histogram with explicit x/y bin edges. More...
 
class  gsl_histogram2d_pdf
 2D PDF derived from histogram for sampling. More...
 

Functions

gsl_histogramgsl_histogram_alloc (size_t n)
 Allocate a 1D histogram with n bins.
 
void gsl_histogram_set_ranges_uniform (gsl_histogram *h, double xmin, double xmax)
 Set uniform bin edges over \([x_{\min}, x_{\max}]\).
 
void gsl_histogram_increment (gsl_histogram *h, double x)
 Increment the bin containing x by 1.
 
double gsl_histogram_get (const gsl_histogram *h, size_t i)
 Get the bin count for index i.
 
void gsl_histogram_free (gsl_histogram *h)
 Free a histogram allocated by gsl_histogram_alloc.
 
size_t gsl_histogram_bins (const gsl_histogram *h)
 Number of bins in the histogram.
 
int gsl_histogram_get_range (const gsl_histogram *h, size_t i, double *lower, double *upper)
 Get the \([x_i, x_{i+1})\) range for a bin.
 
int gsl_histogram_set_ranges (gsl_histogram *h, const double *range, size_t n)
 Set explicit bin edges for a histogram.
 
gsl_histogram2dgsl_histogram2d_alloc (size_t nx, size_t ny)
 Allocate a 2D histogram with nx by ny bins.
 
void gsl_histogram2d_set_ranges_uniform (gsl_histogram2d *h, double xmin, double xmax, double ymin, double ymax)
 Set uniform x/y bin edges.
 
int gsl_histogram2d_set_ranges (gsl_histogram2d *h, const double *xrange, size_t nx, const double *yrange, size_t ny)
 Set explicit x/y bin edges.
 
size_t gsl_histogram2d_nx (const gsl_histogram2d *h)
 Number of x bins.
 
size_t gsl_histogram2d_ny (const gsl_histogram2d *h)
 Number of y bins.
 
void gsl_histogram2d_increment (gsl_histogram2d *h, double x, double y)
 Increment the bin containing x,y by 1.
 
double gsl_histogram2d_get (const gsl_histogram2d *h, size_t i, size_t j)
 Get the bin count for index \((i,j)\).
 
void gsl_histogram2d_accumulate (gsl_histogram2d *h, double x, double y, double weight)
 Accumulate a weighted sample into the 2D histogram.
 
void gsl_histogram2d_fprintf (FILE *fh, const gsl_histogram2d *h, const char *xformat, const char *yformat)
 Print the 2D histogram in a simple text table.
 
void gsl_histogram2d_free (gsl_histogram2d *h)
 Free a 2D histogram.
 
gsl_histogram2d_pdfgsl_histogram2d_pdf_alloc (size_t, size_t)
 Allocate a 2D histogram PDF.
 
void gsl_histogram2d_pdf_init (gsl_histogram2d_pdf *p, const gsl_histogram2d *h)
 Initialize a PDF from a histogram.
 
void gsl_histogram2d_pdf_sample (const gsl_histogram2d_pdf *p, double u, double v, double *x, double *y)
 Sample from the PDF using two uniform variates.
 
void gsl_histogram2d_pdf_free (gsl_histogram2d_pdf *p)
 Free a 2D histogram PDF.
 

Function Documentation

◆ gsl_histogram2d_accumulate()

void gsl_histogram2d_accumulate ( gsl_histogram2d h,
double  x,
double  y,
double  weight 
)
inline

Accumulate a weighted sample into the 2D histogram.

Parameters
hInput/Output: histogram to update.
xInput: x sample value.
yInput: y sample value.
weightInput: weight to add.

Definition at line 428 of file GSLHistogram.h.

References gsl_histogram2d::accumulate().

Referenced by LaserProfile::fillHistrogram().

Here is the call graph for this function:

◆ gsl_histogram2d_alloc()

gsl_histogram2d * gsl_histogram2d_alloc ( size_t  nx,
size_t  ny 
)
inline

Allocate a 2D histogram with nx by ny bins.

Parameters
nxInput: number of x bins.
nyInput: number of y bins.
Returns
Output: histogram pointer.

Definition at line 364 of file GSLHistogram.h.

References gsl_histogram2d::bin_, gsl_histogram2d::nx_, and gsl_histogram2d::ny_.

Referenced by LaserProfile::fillHistrogram(), TEST_F(), TEST_F(), and TEST_F().

◆ gsl_histogram2d_fprintf()

void gsl_histogram2d_fprintf ( FILE *  fh,
const gsl_histogram2d h,
const char *  xformat,
const char *  yformat 
)
inline

Print the 2D histogram in a simple text table.

Parameters
fhInput: output file handle.
hInput: histogram.
xformatInput: printf-style format string for x values.
yformatInput: printf-style format string for y values.

Definition at line 437 of file GSLHistogram.h.

References gsl_histogram2d::bin(), gsl_histogram2d::nx(), gsl_histogram2d::ny(), gsl_histogram2d::xrange(), and gsl_histogram2d::yrange().

Referenced by LaserProfile::saveHistogram().

Here is the call graph for this function:

◆ gsl_histogram2d_free()

void gsl_histogram2d_free ( gsl_histogram2d h)
inline

Free a 2D histogram.

Parameters
hInput: histogram to release (can be null).

Definition at line 454 of file GSLHistogram.h.

Referenced by TEST_F(), TEST_F(), TEST_F(), and LaserProfile::~LaserProfile().

◆ gsl_histogram2d_get()

double gsl_histogram2d_get ( const gsl_histogram2d h,
size_t  i,
size_t  j 
)
inline

Get the bin count for index \((i,j)\).

Parameters
hInput: histogram.
iInput: x bin index.
jInput: y bin index.
Returns
Output: bin count.

Definition at line 419 of file GSLHistogram.h.

References gsl_histogram2d::get().

Referenced by TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ gsl_histogram2d_increment()

void gsl_histogram2d_increment ( gsl_histogram2d h,
double  x,
double  y 
)
inline

Increment the bin containing x,y by 1.

Parameters
hInput/Output: histogram to update.
xInput: x sample value.
yInput: y sample value.

Definition at line 410 of file GSLHistogram.h.

References gsl_histogram2d::increment().

Referenced by TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ gsl_histogram2d_nx()

size_t gsl_histogram2d_nx ( const gsl_histogram2d h)
inline

Number of x bins.

Parameters
hInput: histogram.
Returns
Output: x bin count.

Definition at line 399 of file GSLHistogram.h.

References gsl_histogram2d::nx().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram2d_ny()

size_t gsl_histogram2d_ny ( const gsl_histogram2d h)
inline

Number of y bins.

Parameters
hInput: histogram.
Returns
Output: y bin count.

Definition at line 404 of file GSLHistogram.h.

References gsl_histogram2d::ny().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram2d_pdf_alloc()

gsl_histogram2d_pdf * gsl_histogram2d_pdf_alloc ( size_t  ,
size_t   
)
inline

Allocate a 2D histogram PDF.

Parameters
nxInput: number of x bins (unused).
nyInput: number of y bins (unused).
Returns
Output: PDF pointer.

Definition at line 460 of file GSLHistogram.h.

Referenced by LaserProfile::setupRNG().

◆ gsl_histogram2d_pdf_free()

void gsl_histogram2d_pdf_free ( gsl_histogram2d_pdf p)
inline

Free a 2D histogram PDF.

Parameters
pInput: PDF to release (can be null).

Definition at line 484 of file GSLHistogram.h.

Referenced by LaserProfile::~LaserProfile().

◆ gsl_histogram2d_pdf_init()

void gsl_histogram2d_pdf_init ( gsl_histogram2d_pdf p,
const gsl_histogram2d h 
)
inline

Initialize a PDF from a histogram.

Parameters
pInput/Output: PDF to initialize.
hInput: source histogram.

Definition at line 467 of file GSLHistogram.h.

References gsl_histogram2d_pdf::init().

Referenced by LaserProfile::setupRNG().

Here is the call graph for this function:

◆ gsl_histogram2d_pdf_sample()

void gsl_histogram2d_pdf_sample ( const gsl_histogram2d_pdf p,
double  u,
double  v,
double *  x,
double *  y 
)
inline

Sample from the PDF using two uniform variates.

Parameters
pInput: PDF.
uInput: uniform variate in \([0,1]\).
vInput: uniform variate in \([0,1]\).
xOutput: sampled x value.
yOutput: sampled y value.

Definition at line 477 of file GSLHistogram.h.

Referenced by LaserProfile::getXY().

◆ gsl_histogram2d_set_ranges()

int gsl_histogram2d_set_ranges ( gsl_histogram2d h,
const double *  xrange,
size_t  nx,
const double *  yrange,
size_t  ny 
)
inline

Set explicit x/y bin edges.

Parameters
hInput/Output: histogram to configure.
xrangeInput: x edges array ( \(n_x+1\)).
nxInput: number of x edges.
yrangeInput: y edges array ( \(n_y+1\)).
nyInput: number of y edges.
Returns
Output: 0 on success, -1 on error.

Definition at line 390 of file GSLHistogram.h.

References gsl_histogram2d::set_ranges().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram2d_set_ranges_uniform()

void gsl_histogram2d_set_ranges_uniform ( gsl_histogram2d h,
double  xmin,
double  xmax,
double  ymin,
double  ymax 
)
inline

Set uniform x/y bin edges.

Parameters
hInput/Output: histogram to configure.
xminInput: x lower bound (inclusive).
xmaxInput: x upper bound (exclusive).
yminInput: y lower bound (inclusive).
ymaxInput: y upper bound (exclusive).

Definition at line 378 of file GSLHistogram.h.

References gsl_histogram2d::set_ranges_uniform().

Referenced by LaserProfile::fillHistrogram(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_alloc()

gsl_histogram * gsl_histogram_alloc ( size_t  n)
inline

Allocate a 1D histogram with n bins.

Parameters
nInput: number of bins.
Returns
Output: histogram pointer.

Definition at line 111 of file GSLHistogram.h.

References gsl_histogram::bin_, and gsl_histogram::n_.

Referenced by DistributionMoments::computePercentiles(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ gsl_histogram_bins()

size_t gsl_histogram_bins ( const gsl_histogram h)
inline

Number of bins in the histogram.

Parameters
hInput: histogram.
Returns
Output: bin count.

Definition at line 144 of file GSLHistogram.h.

References gsl_histogram::n().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_free()

void gsl_histogram_free ( gsl_histogram h)
inline

Free a histogram allocated by gsl_histogram_alloc.

Parameters
hInput: histogram to release (can be null).

Definition at line 139 of file GSLHistogram.h.

Referenced by DistributionMoments::computePercentiles(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

◆ gsl_histogram_get()

double gsl_histogram_get ( const gsl_histogram h,
size_t  i 
)
inline

Get the bin count for index i.

Parameters
hInput: histogram.
iInput: bin index.
Returns
Output: bin count.

Definition at line 135 of file GSLHistogram.h.

References gsl_histogram::get().

Referenced by TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_get_range()

int gsl_histogram_get_range ( const gsl_histogram h,
size_t  i,
double *  lower,
double *  upper 
)
inline

Get the \([x_i, x_{i+1})\) range for a bin.

Parameters
hInput: histogram.
iInput: bin index.
lowerOutput: lower edge.
upperOutput: upper edge.
Returns
Output: 0 on success, -1 on invalid index.

Definition at line 152 of file GSLHistogram.h.

References gsl_histogram::n(), and gsl_histogram::range().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_increment()

void gsl_histogram_increment ( gsl_histogram h,
double  x 
)
inline

Increment the bin containing x by 1.

Parameters
hInput/Output: histogram to update.
xInput: sample value.

Definition at line 129 of file GSLHistogram.h.

References gsl_histogram::increment().

Referenced by DistributionMoments::computePercentiles(), TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_set_ranges()

int gsl_histogram_set_ranges ( gsl_histogram h,
const double *  range,
size_t  n 
)
inline

Set explicit bin edges for a histogram.

Parameters
hInput/Output: histogram to configure.
rangeInput: array of \(n\) edges (must be \(n_+1\)).
nInput: number of edges.
Returns
Output: 0 on success, -1 on error.

Definition at line 169 of file GSLHistogram.h.

References gsl_histogram::set_ranges().

Referenced by TEST_F().

Here is the call graph for this function:

◆ gsl_histogram_set_ranges_uniform()

void gsl_histogram_set_ranges_uniform ( gsl_histogram h,
double  xmin,
double  xmax 
)
inline

Set uniform bin edges over \([x_{\min}, x_{\max}]\).

Parameters
hInput/Output: histogram to configure.
xminInput: lower bound (inclusive).
xmaxInput: upper bound (exclusive).

Definition at line 122 of file GSLHistogram.h.

References gsl_histogram::set_ranges_uniform().

Referenced by DistributionMoments::computePercentiles(), TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function: