ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::histogram::pdf Class Reference

Histogram probability (empirical) density functions. More...

#include <histogram.hpp>

Collaboration diagram for gsl::histogram::pdf:
Collaboration graph

Public Member Functions

 pdf ()
 The default constructor is only really useful for assigning to. More...
 
 pdf (size_t const n)
 The default constructor creates a new pdf with n elements. More...
 
 pdf (gsl_histogram_pdf *v)
 Could construct from a gsl_histogram_pdf. More...
 
 pdf (pdf const &v)
 The copy constructor. More...
 
pdfoperator= (pdf const &v)
 The assignment operator. More...
 
 ~pdf ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 pdf (pdf &&v)
 Move constructor. More...
 
pdfoperator= (pdf &&v)
 Move operator. More...
 
bool operator== (pdf const &v) const
 Two pdf are identically equal if their elements are identical. More...
 
bool operator!= (pdf const &v) const
 Two pdf are different if their elements are not identical. More...
 
bool operator< (pdf const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (pdf const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (pdf const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (pdf const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the pdf is empty. More...
 
void swap (pdf &v)
 Swap two pdf objects. More...
 
gsl_histogram_pdf * get () const
 Get the gsl_histogram_pdf. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_histogram_pdf. More...
 
size_t use_count () const
 Find how many pdf objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
int init (histogram const &h)
 C++ version of gsl_histogram_pdf_init(). More...
 
double sample (double r)
 C++ version of gsl_histogram_pdf_sample(). More...
 

Private Attributes

gsl_histogram_pdf * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Histogram probability (empirical) density functions.

Definition at line 519 of file histogram.hpp.

Constructor & Destructor Documentation

◆ pdf() [1/5]

gsl::histogram::pdf::pdf ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 524 of file histogram.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ pdf() [2/5]

gsl::histogram::pdf::pdf ( size_t const  n)
inlineexplicit

The default constructor creates a new pdf with n elements.

Parameters
nThe number of bins to approximate the pdf

Definition at line 534 of file histogram.hpp.

References ccgsl_pointer, count, and gsl::rstat::n().

◆ pdf() [3/5]

gsl::histogram::pdf::pdf ( gsl_histogram_pdf *  v)
inlineexplicit

Could construct from a gsl_histogram_pdf.

This is not usually a good idea. In this case we should not use gsl_histogram_pdf_free() to deallocate the memory.

Parameters
vThe pdf

Definition at line 550 of file histogram.hpp.

References ccgsl_pointer, and count.

◆ pdf() [4/5]

gsl::histogram::pdf::pdf ( pdf const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe pdf to copy.

Definition at line 561 of file histogram.hpp.

References ccgsl_pointer, and count.

◆ ~pdf()

gsl::histogram::pdf::~pdf ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 582 of file histogram.hpp.

References ccgsl_pointer, and count.

◆ pdf() [5/5]

gsl::histogram::pdf::pdf ( pdf &&  v)
inline

Move constructor.

Parameters
vThe pdf to move.

Definition at line 594 of file histogram.hpp.

References count.

Member Function Documentation

◆ empty()

bool gsl::histogram::pdf::empty ( ) const
inline

Find if the pdf is empty.

Returns
true if has size zero; otherwise false

Definition at line 671 of file histogram.hpp.

References ccgsl_pointer.

◆ get()

gsl_histogram_pdf * gsl::histogram::pdf::get ( ) const
inline

Get the gsl_histogram_pdf.

Returns
the gsl_histogram_pdf

Definition at line 697 of file histogram.hpp.

References ccgsl_pointer.

Referenced by init(), and sample().

◆ init()

int gsl::histogram::pdf::init ( histogram const &  h)
inline

C++ version of gsl_histogram_pdf_init().

Parameters
hA histogram
Returns
Error code on failure

Definition at line 724 of file histogram.hpp.

References gsl::histogram::get(), and get().

◆ operator bool()

gsl::histogram::pdf::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_histogram_pdf.

Definition at line 717 of file histogram.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::histogram::pdf::operator!= ( pdf const &  v) const
inline

Two pdf are different if their elements are not identical.

Parameters
vThe pdf to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 624 of file histogram.hpp.

References operator==().

◆ operator<()

bool gsl::histogram::pdf::operator< ( pdf const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a pdf is nonnegative.

Parameters
vThe pdf to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 636 of file histogram.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::histogram::pdf::operator<= ( pdf const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a pdf is nonnegative.

Parameters
vThe pdf to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 656 of file histogram.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

pdf & gsl::histogram::pdf::operator= ( pdf &&  v)
inline

Move operator.

Parameters
vThe pdf to move.
Returns
A reference to this.

Definition at line 603 of file histogram.hpp.

References pdf().

◆ operator=() [2/2]

pdf & gsl::histogram::pdf::operator= ( pdf const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe pdf to copy

Definition at line 568 of file histogram.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::histogram::pdf::operator== ( pdf const &  v) const
inline

Two pdf are identically equal if their elements are identical.

Parameters
vThe pdf to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 616 of file histogram.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::histogram::pdf::operator> ( pdf const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a pdf is nonnegative.

Parameters
vThe pdf to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 646 of file histogram.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::histogram::pdf::operator>= ( pdf const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a pdf is nonnegative.

Parameters
vThe pdf to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 666 of file histogram.hpp.

References ccgsl_pointer.

◆ sample()

double gsl::histogram::pdf::sample ( double  r)
inline

C++ version of gsl_histogram_pdf_sample().

Parameters
rA random number (between zero and 1)
Returns
A random variate from the histogram

Definition at line 731 of file histogram.hpp.

References get().

◆ swap()

void gsl::histogram::pdf::swap ( pdf v)
inline

Swap two pdf objects.

This works even if the pdf have different sizes because it swaps pointers.

Parameters
vThe pdf to swap with this.

Definition at line 678 of file histogram.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::histogram::pdf::unique ( ) const
inline

Find if this is the only object sharing the gsl_histogram_pdf.

Returns
true or falses according as this is the only pdf object sharing the gsl_histogram_pdf.

Definition at line 703 of file histogram.hpp.

References count.

◆ use_count()

size_t gsl::histogram::pdf::use_count ( ) const
inline

Find how many pdf objects share this pointer.

Returns
the number of pdf objects that share this pointer.

Definition at line 708 of file histogram.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

gsl_histogram_pdf* gsl::histogram::pdf::ccgsl_pointer
private

The shared pointer.

Definition at line 686 of file histogram.hpp.

Referenced by empty(), get(), operator bool(), operator<(), operator<=(), operator=(), operator==(), operator>(), operator>=(), pdf(), swap(), and ~pdf().

◆ count

size_t* gsl::histogram::pdf::count
private

The shared reference count.

Definition at line 690 of file histogram.hpp.

Referenced by operator=(), pdf(), swap(), unique(), use_count(), and ~pdf().


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