shark::Uniform< RngType > Class Template Reference

Implements a continuous uniform distribution. More...

#include <shark/Rng/Uniform.h>

+ Inheritance diagram for shark::Uniform< RngType >:

Public Member Functions

 Uniform (RngType &rng, double low_=0., double high_=1.)
 Default c'tor. Initializes the sampling interval and associates this distribution with the supplied RNG. More...
 
double operator() (double low_, double high_)
 Resets the distribution to the supplied interval and samples a random number. More...
 
double low () const
 Accesses the lower bound of the interval. More...
 
double high () const
 Accesses the upper bound of the interval. More...
 
void setRange (double low_, double high_)
 Adjusts the interval of the distribution. More...
 
double p (double x) const
 Calculates the probability of x. More...
 
- Public Member Functions inherited from shark::AbstractDistribution
virtual ~AbstractDistribution ()
 Dtor. More...
 
virtual double logP (double x) const
 

Detailed Description

template<typename RngType = DefaultRngType>
class shark::Uniform< RngType >

Implements a continuous uniform distribution.

Definition at line 46 of file Uniform.h.

Constructor & Destructor Documentation

◆ Uniform()

template<typename RngType = DefaultRngType>
shark::Uniform< RngType >::Uniform ( RngType &  rng,
double  low_ = 0.,
double  high_ = 1. 
)
inline

Default c'tor. Initializes the sampling interval and associates this distribution with the supplied RNG.

Parameters
[in,out]rngThe RNG to associate this distribution with.
[in]low_The lower bound of the sampling interval.
[in]high_The upper bound of the sampling interval.

Definition at line 64 of file Uniform.h.

Member Function Documentation

◆ high()

template<typename RngType = DefaultRngType>
double shark::Uniform< RngType >::high ( ) const
inline

Accesses the upper bound of the interval.

Definition at line 96 of file Uniform.h.

Referenced by shark::Uniform< RngType >::p().

◆ low()

template<typename RngType = DefaultRngType>
double shark::Uniform< RngType >::low ( ) const
inline

Accesses the lower bound of the interval.

Definition at line 88 of file Uniform.h.

Referenced by shark::Uniform< RngType >::p().

◆ operator()()

template<typename RngType = DefaultRngType>
double shark::Uniform< RngType >::operator() ( double  low_,
double  high_ 
)
inline

Resets the distribution to the supplied interval and samples a random number.

Parameters
[in]low_The lower bound of the interval.
[in]high_The upper bound of the interval.

Definition at line 78 of file Uniform.h.

References remora::max(), and remora::min().

◆ p()

template<typename RngType = DefaultRngType>
double shark::Uniform< RngType >::p ( double  x) const
inlinevirtual

Calculates the probability of x.

Parameters
[in]xThe observation.

Implements shark::AbstractDistribution.

Definition at line 116 of file Uniform.h.

References shark::Uniform< RngType >::high(), and shark::Uniform< RngType >::low().

◆ setRange()

template<typename RngType = DefaultRngType>
void shark::Uniform< RngType >::setRange ( double  low_,
double  high_ 
)
inline

Adjusts the interval of the distribution.

Parameters
[in]low_The lower bound of the interval.
[in]high_The upper bound of the interval.

Definition at line 106 of file Uniform.h.

References remora::max(), and remora::min().


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