OPTK  0.1.2
Toolkit for global optimisation algorithms
Public Member Functions | Public Attributes | Protected Attributes | List of all members
sspace::normal Class Reference

#include <types.hpp>

Inheritance diagram for sspace::normal:
sspace::param_t sspace::lognormal sspace::qnormal sspace::qlognormal

Public Member Functions

 normal (std::string n, double mu, double sigma)
 
 normal (std::string n, double mu, double sigma, pt t)
 
virtual double sample ()
 
- Public Member Functions inherited from sspace::param_t
 param_t (std::string n, pt t)
 
virtual ~param_t ()
 
virtual pt get_type ()
 
virtual std::string get_name ()
 

Public Attributes

double m_mu
 
double m_sigma
 

Protected Attributes

std::random_device rd
 
std::mt19937 generator
 
std::normal_distribution< double > dist
 

Detailed Description

This class is for normally-distributed parameters parametrised by mu and sigma; this is an unconstrained parameter.

Constructor & Destructor Documentation

◆ normal() [1/2]

sspace::normal::normal ( std::string  n,
double  mu,
double  sigma 
)

The constructor.

Parameters
nThe name of this parameter
muThe mean of the normal distribution from which to sample
varianceThe mean of the normal distribution.

◆ normal() [2/2]

sspace::normal::normal ( std::string  n,
double  mu,
double  sigma,
pt  t 
)

The polymorphic constructor which allows for inheriting classes to specify their types. Do not call.

Member Function Documentation

◆ sample()

double sspace::normal::sample ( )
virtual

Samples a double-precision floating point value from the normal probability distribution:

\[ p(x|\mu\,\sigma) \= \frac{1}{\sigma \sqrt{2 \pi}} e\^{- \frac{{x - \mu}\^ {2}}{2 \sigma \^ {2}} } \]

Returns
A single sapmled value.

Reimplemented in sspace::qlognormal, sspace::lognormal, and sspace::qnormal.

Member Data Documentation

◆ m_mu

double sspace::normal::m_mu

The parameters of the underlying normal distribution.


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