MIRA
Public Types | Public Member Functions | List of all members
NormalRandomGenerator< D, T > Class Template Reference

Random generator for drawing samples from univariate or multivariate normal distributions. More...

#include <math/NormalRandomGenerator.h>

Inheritance diagram for NormalRandomGenerator< D, T >:
Inheritance graph
[legend]

Public Types

typedef NormalRandomDistribution< D, T > ::result_type result_type
 

Public Member Functions

 NormalRandomGenerator ()
 
result_type operator() ()
 Draws a sample from the random distribution. More...
 
void seed ()
 Seeds the random generator using the current system time. More...
 
void seed (uint32 value)
 Seeds the random generator with the given seed. More...
 
NormalRandomDistribution< D, T > * operator-> ()
 Provides direct access to the underlying random distribution. More...
 
const NormalRandomDistribution< D, T > * operator-> () const
 Provides direct access to the underlying random distribution. More...
 
NormalRandomDistribution< D, T > & distribution ()
 Provides direct access to the underlying random distribution. More...
 
const NormalRandomDistribution< D, T > & distribution () const
 Provides direct access to the underlying random distribution. More...
 
boost::mt19937 & engine ()
 Provides direct access to the underlying random generator engine. More...
 
const boost::mt19937 & engine () const
 Provides direct access to the underlying random generator engine. More...
 

Detailed Description

template<int D, typename T = float>
class mira::NormalRandomGenerator< D, T >

Random generator for drawing samples from univariate or multivariate normal distributions.

This class template models a zero-mean normal distribution of the specified dimension D (univariate if D==1 or multivariate if D>1).

Example:

Eigen::Matrix2f sigma;
sigma << 2.0f, 1.0f,
1.0f, 3.0f;
NormalRandomGenerator<2> rnd(sigma);
// draw a sample:
Eigen::Vector2f sample = rnd();

To produce non-zero mean samples you can simply add the mean to the returned samples.

Member Typedef Documentation

◆ result_type

typedef NormalRandomDistribution< D, T > ::result_type result_type
inherited

Constructor & Destructor Documentation

◆ NormalRandomGenerator()

Member Function Documentation

◆ operator()()

result_type operator() ( )
inlineinherited

Draws a sample from the random distribution.

◆ seed() [1/2]

void seed ( )
inlineinherited

Seeds the random generator using the current system time.

Hence, after calling this method, the random generator will generate different sequences of random numbers each time.

◆ seed() [2/2]

void seed ( uint32  value)
inlineinherited

Seeds the random generator with the given seed.

The random generator will produce the same sequence of random numbers if the same seed is used.

◆ operator->() [1/2]

NormalRandomDistribution< D, T > * operator-> ( )
inlineinherited

Provides direct access to the underlying random distribution.

◆ operator->() [2/2]

const NormalRandomDistribution< D, T > * operator-> ( ) const
inlineinherited

Provides direct access to the underlying random distribution.

◆ distribution() [1/2]

NormalRandomDistribution< D, T > & distribution ( )
inlineinherited

Provides direct access to the underlying random distribution.

◆ distribution() [2/2]

const NormalRandomDistribution< D, T > & distribution ( ) const
inlineinherited

Provides direct access to the underlying random distribution.

◆ engine() [1/2]

boost::mt19937 & engine ( )
inlineinherited

Provides direct access to the underlying random generator engine.

◆ engine() [2/2]

const boost::mt19937 & engine ( ) const
inlineinherited

Provides direct access to the underlying random generator engine.


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