ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::rstat::workspace Class Reference

Workspace for running statistics. More...

#include <rstat.hpp>

Collaboration diagram for gsl::rstat::workspace:
Collaboration graph

Public Member Functions

 workspace ()
 The default constructor creates a new workspace. More...
 
 workspace (gsl_rstat_workspace *v)
 Could construct from a gsl_rstat_workspace*. More...
 
 workspace (workspace const &v)
 The copy constructor. More...
 
workspaceoperator= (workspace const &v)
 The assignment operator. More...
 
 ~workspace ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 workspace (workspace &&v)
 Move constructor. More...
 
workspaceoperator= (workspace &&v)
 Move operator. More...
 
bool operator== (workspace const &v) const
 Two workspace are identically equal if their elements are identical. More...
 
bool operator!= (workspace const &v) const
 Two workspace are different if their elements are not identical. More...
 
bool operator< (workspace const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (workspace const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (workspace const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (workspace const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the workspace is empty. More...
 
void swap (workspace &v)
 Swap two workspace objects. More...
 
gsl_rstat_workspace * get () const
 Get the gsl_rstat_workspace. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_rstat_workspace. More...
 
size_t use_count () const
 Find how many workspace objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 
size_t n () const
 C++ version of gsl_rstat_n(). More...
 
int add (double const x)
 C++ version of gsl_rstat_add(). More...
 
double min () const
 C++ version of gsl_rstat_min(). More...
 
double max () const
 C++ version of gsl_rstat_max(). More...
 
double mean () const
 C++ version of gsl_rstat_mean(). More...
 
double variance () const
 C++ version of gsl_rstat_variance(). More...
 
double sd () const
 C++ version of gsl_rstat_sd(). More...
 
double rms () const
 C++ version of gsl_rstat_rms(). More...
 
double sd_mean () const
 C++ version of gsl_rstat_sd_mean(). More...
 
double median () const
 C++ version of gsl_rstat_median(). More...
 
double skew () const
 C++ version of gsl_rstat_skew(). More...
 
double kurtosis () const
 C++ version of gsl_rstat_kurtosis(). More...
 
int reset ()
 C++ version of gsl_rstat_reset(). More...
 

Private Attributes

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

Detailed Description

Workspace for running statistics.

Definition at line 35 of file rstat.hpp.

Constructor & Destructor Documentation

◆ workspace() [1/4]

gsl::rstat::workspace::workspace ( )
inlineexplicit

The default constructor creates a new workspace.

Definition at line 40 of file rstat.hpp.

References ccgsl_pointer, and count.

Referenced by operator=().

◆ workspace() [2/4]

gsl::rstat::workspace::workspace ( gsl_rstat_workspace *  v)
inlineexplicit

Could construct from a gsl_rstat_workspace*.

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

Parameters
vThe workspace

Definition at line 56 of file rstat.hpp.

References ccgsl_pointer, and count.

◆ workspace() [3/4]

gsl::rstat::workspace::workspace ( workspace const &  v)
inline

The copy constructor.

This creates a new reference to the workspace.

Parameters
vThe workspace to copy.

Definition at line 67 of file rstat.hpp.

References ccgsl_pointer, and count.

◆ ~workspace()

gsl::rstat::workspace::~workspace ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 87 of file rstat.hpp.

References ccgsl_pointer, and count.

◆ workspace() [4/4]

gsl::rstat::workspace::workspace ( workspace &&  v)
inline

Move constructor.

Parameters
vThe workspace to move.

Definition at line 99 of file rstat.hpp.

References count.

Member Function Documentation

◆ add()

int gsl::rstat::workspace::add ( double const  x)
inline

C++ version of gsl_rstat_add().

Parameters
xA new data point
Returns
Error code on failure

Definition at line 235 of file rstat.hpp.

References get().

◆ empty()

bool gsl::rstat::workspace::empty ( ) const
inline

Find if the workspace is empty.

Returns
true if has size zero; otherwise false

Definition at line 176 of file rstat.hpp.

References ccgsl_pointer.

◆ get()

gsl_rstat_workspace * gsl::rstat::workspace::get ( ) const
inline

◆ kurtosis()

double gsl::rstat::workspace::kurtosis ( ) const
inline

C++ version of gsl_rstat_kurtosis().

Returns
Current value of kurtosis

Definition at line 286 of file rstat.hpp.

References get().

◆ max()

double gsl::rstat::workspace::max ( ) const
inline

C++ version of gsl_rstat_max().

Returns
Current value of maximum

Definition at line 246 of file rstat.hpp.

References get().

◆ mean()

double gsl::rstat::workspace::mean ( ) const
inline

C++ version of gsl_rstat_mean().

Returns
Current value of mean

Definition at line 251 of file rstat.hpp.

References get().

◆ median()

double gsl::rstat::workspace::median ( ) const
inline

C++ version of gsl_rstat_median().

Returns
Current value of median

Definition at line 276 of file rstat.hpp.

References get().

◆ min()

double gsl::rstat::workspace::min ( ) const
inline

C++ version of gsl_rstat_min().

Returns
Current value of minimum

Definition at line 240 of file rstat.hpp.

References get().

◆ n()

size_t gsl::rstat::workspace::n ( ) const
inline

C++ version of gsl_rstat_n().

Returns
Number of data added

Definition at line 229 of file rstat.hpp.

References get().

◆ operator bool()

gsl::rstat::workspace::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

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

Definition at line 222 of file rstat.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::rstat::workspace::operator!= ( workspace const &  v) const
inline

Two workspace are different if their elements are not identical.

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

Definition at line 129 of file rstat.hpp.

References operator==().

◆ operator<()

bool gsl::rstat::workspace::operator< ( workspace 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 workspace is nonnegative.

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

Definition at line 141 of file rstat.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::rstat::workspace::operator<= ( workspace 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 workspace is nonnegative.

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

Definition at line 161 of file rstat.hpp.

References ccgsl_pointer.

◆ operator=() [1/2]

workspace & gsl::rstat::workspace::operator= ( workspace &&  v)
inline

Move operator.

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

Definition at line 108 of file rstat.hpp.

References workspace().

◆ operator=() [2/2]

workspace & gsl::rstat::workspace::operator= ( workspace const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe workspace to copy

Definition at line 74 of file rstat.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::rstat::workspace::operator== ( workspace const &  v) const
inline

Two workspace are identically equal if their elements are identical.

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

Definition at line 121 of file rstat.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::rstat::workspace::operator> ( workspace 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 workspace is nonnegative.

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

Definition at line 151 of file rstat.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::rstat::workspace::operator>= ( workspace 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 workspace is nonnegative.

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

Definition at line 171 of file rstat.hpp.

References ccgsl_pointer.

◆ reset()

int gsl::rstat::workspace::reset ( )
inline

C++ version of gsl_rstat_reset().

Returns
Error code on failure

Definition at line 291 of file rstat.hpp.

References get().

◆ rms()

double gsl::rstat::workspace::rms ( ) const
inline

C++ version of gsl_rstat_rms().

Returns
Current value of root mean square of data

Definition at line 266 of file rstat.hpp.

References get().

◆ sd()

double gsl::rstat::workspace::sd ( ) const
inline

C++ version of gsl_rstat_sd().

Returns
Current value of standard deviation

Definition at line 261 of file rstat.hpp.

References get().

◆ sd_mean()

double gsl::rstat::workspace::sd_mean ( ) const
inline

C++ version of gsl_rstat_sd_mean().

Returns
Current value of standard deviation of the mean

Definition at line 271 of file rstat.hpp.

References get().

◆ skew()

double gsl::rstat::workspace::skew ( ) const
inline

C++ version of gsl_rstat_skew().

Returns
Current value of skewness

Definition at line 281 of file rstat.hpp.

References get().

◆ swap()

void gsl::rstat::workspace::swap ( workspace v)
inline

Swap two workspace objects.

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

Parameters
vThe workspace to swap with this.

Definition at line 183 of file rstat.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::rstat::workspace::unique ( ) const
inline

Find if this is the only object sharing the gsl_rstat_workspace.

Returns
true or falses according as this is the only workspace object sharing the gsl_rstat_workspace.

Definition at line 208 of file rstat.hpp.

References count.

◆ use_count()

size_t gsl::rstat::workspace::use_count ( ) const
inline

Find how many workspace objects share this pointer.

Returns
the number of workspace objects that share this pointer.

Definition at line 213 of file rstat.hpp.

References count.

◆ variance()

double gsl::rstat::workspace::variance ( ) const
inline

C++ version of gsl_rstat_variance().

Returns
Current value of variance

Definition at line 256 of file rstat.hpp.

References get().

Member Data Documentation

◆ ccgsl_pointer

gsl_rstat_workspace* gsl::rstat::workspace::ccgsl_pointer
private

The shared pointer.

Definition at line 191 of file rstat.hpp.

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

◆ count

size_t* gsl::rstat::workspace::count
private

The shared reference count.

Definition at line 195 of file rstat.hpp.

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


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