Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Public Member Functions
TSQR::Random::NormalGenerator< Ordinal, Scalar > Class Template Reference

(Pseudo)random normal(0,1) floating-point number generator. More...

#include <Tsqr_Random_NormalGenerator.hpp>

Inheritance diagram for TSQR::Random::NormalGenerator< Ordinal, Scalar >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 NormalGenerator (const std::vector< int > &iseed, const int bufferLength=defaultBufferLength())
 Constructor with custom seed.
 NormalGenerator (const int bufferLength=defaultBufferLength())
 Constructor with default seed.
Scalar operator() ()
 Get the next pseudorandom number.
void getSeed (std::vector< int > &iseed) const
 Get the current seed.

Detailed Description

template<class Ordinal, class Scalar>
class TSQR::Random::NormalGenerator< Ordinal, Scalar >

(Pseudo)random normal(0,1) floating-point number generator.

Implemented using LAPACK's _LARNV routines.

Definition at line 61 of file Tsqr_Random_NormalGenerator.hpp.


Constructor & Destructor Documentation

template<class Ordinal, class Scalar>
TSQR::Random::NormalGenerator< Ordinal, Scalar >::NormalGenerator ( const std::vector< int > &  iseed,
const int  bufferLength = defaultBufferLength() 
) [inline]

Constructor with custom seed.

Parameters:
iseed[in] Array of four integers, representing the seed. See documentation of LAPACK's _LARNV routines for requirements. In particular, the array elements must be in [0,4095], and the last element (iseed[3]) must be odd.
bufferLength[in] How many entries we keep buffered at one time. If you know how many outputs you want, set this accordingly, so that all the expense of generation happens at construction.

Definition at line 82 of file Tsqr_Random_NormalGenerator.hpp.

template<class Ordinal, class Scalar>
TSQR::Random::NormalGenerator< Ordinal, Scalar >::NormalGenerator ( const int  bufferLength = defaultBufferLength()) [inline]

Constructor with default seed.

The four-integer seed is set to [0, 0, 0, 1], which is a valid seed and which ensures a reproducible sequence.

Parameters:
bufferLength[in] How many entries we keep buffered at one time. If you know how many outputs you want, set this accordingly, so that all the expense of generation happens at construction.

Definition at line 103 of file Tsqr_Random_NormalGenerator.hpp.


Member Function Documentation

template<class Ordinal, class Scalar>
Scalar TSQR::Random::NormalGenerator< Ordinal, Scalar >::operator() ( ) [inline]

Get the next pseudorandom number.

If the buffer length is > 0, the buffer is first filled with newly generated values if it's empty, and then the value is fetched from the buffer. Depending on the buffer length, filling it may take a while, which means that calling this function may on occasion take longer than you expect. If you don't like this behavior, use a buffer length of 1.

Definition at line 124 of file Tsqr_Random_NormalGenerator.hpp.

template<class Ordinal, class Scalar>
void TSQR::Random::NormalGenerator< Ordinal, Scalar >::getSeed ( std::vector< int > &  iseed) const [inline]

Get the current seed.

The seed consists of four integers, according to the requirements of LAPACK's _LARNV routines. This can be used to restart the generator, but only if you account for the buffered values.

Parameters:
iseed[out] Vector of length exactly four. Resized if necessary.

Definition at line 136 of file Tsqr_Random_NormalGenerator.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends