mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
mx::math::laplace_distribution< _RealType > Class Template Reference

template<typename _RealType = double>
class mx::math::laplace_distribution< _RealType >

The Laplace (double exponential) continuous distribution for random numbers.

The formula for the exponential probability density function is \(p(x|\lambda) = \frac{\lambda}{2} e^{-\lambda x}\).

Distribution Statistics
Mean\(0\)
Median\(0\)
Mode\(0\)
Range\([-\infty, \infty]\)
Standard Deviation\(\frac{\sqrt{2}}{\lambda}\)

This is based on the implementation of the exponential distribution in the GNU ISO C++ Library version 4.6.

Test:
Verify compilation and basic operation of randomT with the Laplace distribution [test doc]

Definition at line 136 of file randomT.hpp.

#include <math/randomT.hpp>

Classes

struct  param_type
 

Public Types

typedef _RealType result_type
 

Public Member Functions

 laplace_distribution (const result_type &__lambda=result_type(1))
 Constructs a Laplace (double exponential) distribution with inverse scale parameter \(\lambda\). More...
 
void reset ()
 Resets the distribution state. More...
 
_RealType lambda () const
 Returns the inverse scale parameter of the distribution. More...
 
param_type param () const
 Returns the parameter set of the distribution. More...
 
void param (const param_type &__param)
 Sets the parameter set of the distribution. More...
 
result_type min () const
 Returns the greatest lower bound value of the distribution. More...
 
result_type max () const
 Returns the least upper bound value of the distribution. More...
 
template<typename _UniformRandomNumberGenerator >
result_type operator() (_UniformRandomNumberGenerator &__urng)
 Generating functions. More...
 

Member Typedef Documentation

◆ result_type

template<typename _RealType = double>
typedef _RealType mx::math::laplace_distribution< _RealType >::result_type

The type of the range of the distribution.

Definition at line 142 of file randomT.hpp.

Constructor & Destructor Documentation

◆ laplace_distribution()

template<typename _RealType = double>
mx::math::laplace_distribution< _RealType >::laplace_distribution ( const result_type __lambda = result_type(1))
inlineexplicit

Constructs a Laplace (double exponential) distribution with inverse scale parameter \(\lambda\).

Definition at line 171 of file randomT.hpp.

Member Function Documentation

◆ lambda()

template<typename _RealType = double>
_RealType mx::math::laplace_distribution< _RealType >::lambda ( ) const
inline

Returns the inverse scale parameter of the distribution.

Definition at line 185 of file randomT.hpp.

◆ max()

template<typename _RealType = double>
result_type mx::math::laplace_distribution< _RealType >::max ( ) const
inline

Returns the least upper bound value of the distribution.

Definition at line 218 of file randomT.hpp.

◆ min()

template<typename _RealType = double>
result_type mx::math::laplace_distribution< _RealType >::min ( ) const
inline

Returns the greatest lower bound value of the distribution.

Definition at line 210 of file randomT.hpp.

◆ operator()()

template<typename _RealType = double>
template<typename _UniformRandomNumberGenerator >
result_type mx::math::laplace_distribution< _RealType >::operator() ( _UniformRandomNumberGenerator &  __urng)
inline

Generating functions.

Definition at line 226 of file randomT.hpp.

References mx::math::laplace_distribution< _RealType >::param().

◆ param() [1/2]

template<typename _RealType = double>
param_type mx::math::laplace_distribution< _RealType >::param ( ) const
inline

Returns the parameter set of the distribution.

Definition at line 193 of file randomT.hpp.

Referenced by mx::math::laplace_distribution< _RealType >::operator()(), and mx::math::operator==().

◆ param() [2/2]

template<typename _RealType = double>
void mx::math::laplace_distribution< _RealType >::param ( const param_type __param)
inline

Sets the parameter set of the distribution.

Parameters
__paramThe new parameter set of the distribution.

Definition at line 202 of file randomT.hpp.

◆ reset()

template<typename _RealType = double>
void mx::math::laplace_distribution< _RealType >::reset ( )
inline

Resets the distribution state.

Has no effect on Laplace distributions.

Definition at line 180 of file randomT.hpp.


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