MCKL
Monte Carlo Kernel Library
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mckl::MKLEngine< BRNG, Bits > Class Template Reference

Use MKL BRNG as RNG engine. More...

#include <mckl/random/mkl.hpp>

Public Types

using result_type = typename internal::MKLUniformBits< BRNG, Bits >::result_type
 

Public Member Functions

 MKLEngine (result_type s=1)
 
template<typename SeedSeq >
 MKLEngine (SeedSeq &seq, std::enable_if_t< is_seed_seq< SeedSeq >::value > *=nullptr)
 
 MKLEngine (MKL_INT offset, result_type s)
 
template<typename SeedSeq >
 MKLEngine (MKL_INT offset, SeedSeq &seq, std::enable_if_t< is_seed_seq< SeedSeq >::value > *=nullptr)
 
std::size_t discard ()
 Discard the result. More...
 
void discard (long long nskip)
 
result_type operator() ()
 
void operator() (std::size_t n, result_type *r)
 
void seed (result_type s)
 
template<typename SeedSeq >
void seed (SeedSeq &seq, std::enable_if_t< is_seed_seq< SeedSeq >::value > *=nullptr)
 
void seed (MKL_INT offset, result_type s)
 
template<typename SeedSeq >
void seed (MKL_INT offset, SeedSeq &seq, std::enable_if_t< is_seed_seq< SeedSeq >::value > *=nullptr)
 
MKLStreamstream ()
 
const MKLStreamstream () const
 

Static Public Member Functions

static constexpr result_type max ()
 
static constexpr result_type min ()
 

Friends

bool operator!= (const MKLEngine< BRNG, Bits > &eng1, const MKLEngine< BRNG, Bits > &eng2)
 eng1 != eng2 is a necessary condition for subsequent call of operator() output different results. But it is not a sufficient condition. More...
 
template<typename CharT , typename Traits >
std::basic_ostream< CharT, Traits > & operator<< (std::basic_ostream< CharT, Traits > &os, const MKLEngine< BRNG, Bits > &eng)
 
bool operator== (const MKLEngine< BRNG, Bits > &eng1, const MKLEngine< BRNG, Bits > &eng2)
 eng1 == eng2 is a sufficent condition for subsequent call of operator() output the same results. But it is not a necessary condition. More...
 
template<typename CharT , typename Traits >
std::basic_istream< CharT, Traits > & operator>> (std::basic_istream< CharT, Traits > &is, MKLEngine< BRNG, Bits > &eng)
 

Detailed Description

template<MKL_INT BRNG, int Bits>
class mckl::MKLEngine< BRNG, Bits >

Use MKL BRNG as RNG engine.

Template Parameters
BRNGA MKL BRNG. It need to support either viRngUniformBits32 or viRngUniformBits64.
BitsThe number of bits in the output unsigned integer
  • It can be 32 if and only if viRngUniformBits32 is supported
  • It can be 64 if and only if viRngUniformBits64 is supported

Definition at line 795 of file mkl.hpp.

Member Typedef Documentation

◆ result_type

template<MKL_INT BRNG, int Bits>
using mckl::MKLEngine< BRNG, Bits >::result_type = typename internal::MKLUniformBits<BRNG, Bits>::result_type

Definition at line 802 of file mkl.hpp.

Constructor & Destructor Documentation

◆ MKLEngine() [1/4]

template<MKL_INT BRNG, int Bits>
mckl::MKLEngine< BRNG, Bits >::MKLEngine ( result_type  s = 1)
inlineexplicit

Definition at line 809 of file mkl.hpp.

◆ MKLEngine() [2/4]

template<MKL_INT BRNG, int Bits>
template<typename SeedSeq >
mckl::MKLEngine< BRNG, Bits >::MKLEngine ( SeedSeq &  seq,
std::enable_if_t< is_seed_seq< SeedSeq >::value > *  = nullptr 
)
inlineexplicit

Definition at line 812 of file mkl.hpp.

◆ MKLEngine() [3/4]

template<MKL_INT BRNG, int Bits>
mckl::MKLEngine< BRNG, Bits >::MKLEngine ( MKL_INT  offset,
result_type  s 
)
inline

Definition at line 819 of file mkl.hpp.

◆ MKLEngine() [4/4]

template<MKL_INT BRNG, int Bits>
template<typename SeedSeq >
mckl::MKLEngine< BRNG, Bits >::MKLEngine ( MKL_INT  offset,
SeedSeq &  seq,
std::enable_if_t< is_seed_seq< SeedSeq >::value > *  = nullptr 
)
inlineexplicit

Definition at line 828 of file mkl.hpp.

Member Function Documentation

◆ discard() [1/2]

template<MKL_INT BRNG, int Bits>
std::size_t mckl::MKLEngine< BRNG, Bits >::discard ( )
inline

Discard the result.

Returns
The number of results discarded

Definition at line 915 of file mkl.hpp.

◆ discard() [2/2]

template<MKL_INT BRNG, int Bits>
void mckl::MKLEngine< BRNG, Bits >::discard ( long long  nskip)
inline

Definition at line 923 of file mkl.hpp.

◆ max()

template<MKL_INT BRNG, int Bits>
static constexpr result_type mckl::MKLEngine< BRNG, Bits >::max ( )
inlinestatic

Definition at line 992 of file mkl.hpp.

◆ min()

template<MKL_INT BRNG, int Bits>
static constexpr result_type mckl::MKLEngine< BRNG, Bits >::min ( )
inlinestatic

Definition at line 987 of file mkl.hpp.

◆ operator()() [1/2]

template<MKL_INT BRNG, int Bits>
result_type mckl::MKLEngine< BRNG, Bits >::operator() ( )
inline

Definition at line 882 of file mkl.hpp.

◆ operator()() [2/2]

template<MKL_INT BRNG, int Bits>
void mckl::MKLEngine< BRNG, Bits >::operator() ( std::size_t  n,
result_type r 
)
inline

Definition at line 892 of file mkl.hpp.

◆ seed() [1/4]

template<MKL_INT BRNG, int Bits>
void mckl::MKLEngine< BRNG, Bits >::seed ( result_type  s)
inline

Definition at line 838 of file mkl.hpp.

◆ seed() [2/4]

template<MKL_INT BRNG, int Bits>
template<typename SeedSeq >
void mckl::MKLEngine< BRNG, Bits >::seed ( SeedSeq &  seq,
std::enable_if_t< is_seed_seq< SeedSeq >::value > *  = nullptr 
)
inline

Definition at line 847 of file mkl.hpp.

◆ seed() [3/4]

template<MKL_INT BRNG, int Bits>
void mckl::MKLEngine< BRNG, Bits >::seed ( MKL_INT  offset,
result_type  s 
)
inline

Definition at line 857 of file mkl.hpp.

◆ seed() [4/4]

template<MKL_INT BRNG, int Bits>
template<typename SeedSeq >
void mckl::MKLEngine< BRNG, Bits >::seed ( MKL_INT  offset,
SeedSeq &  seq,
std::enable_if_t< is_seed_seq< SeedSeq >::value > *  = nullptr 
)
inline

Definition at line 869 of file mkl.hpp.

◆ stream() [1/2]

template<MKL_INT BRNG, int Bits>
MKLStream& mckl::MKLEngine< BRNG, Bits >::stream ( )
inline

Definition at line 997 of file mkl.hpp.

◆ stream() [2/2]

template<MKL_INT BRNG, int Bits>
const MKLStream& mckl::MKLEngine< BRNG, Bits >::stream ( ) const
inline

Definition at line 998 of file mkl.hpp.

Friends And Related Function Documentation

◆ operator!=

template<MKL_INT BRNG, int Bits>
bool operator!= ( const MKLEngine< BRNG, Bits > &  eng1,
const MKLEngine< BRNG, Bits > &  eng2 
)
friend

eng1 != eng2 is a necessary condition for subsequent call of operator() output different results. But it is not a sufficient condition.

Definition at line 1021 of file mkl.hpp.

◆ operator<<

template<MKL_INT BRNG, int Bits>
template<typename CharT , typename Traits >
std::basic_ostream<CharT, Traits>& operator<< ( std::basic_ostream< CharT, Traits > &  os,
const MKLEngine< BRNG, Bits > &  eng 
)
friend

Definition at line 1028 of file mkl.hpp.

◆ operator==

template<MKL_INT BRNG, int Bits>
bool operator== ( const MKLEngine< BRNG, Bits > &  eng1,
const MKLEngine< BRNG, Bits > &  eng2 
)
friend

eng1 == eng2 is a sufficent condition for subsequent call of operator() output the same results. But it is not a necessary condition.

Definition at line 1003 of file mkl.hpp.

◆ operator>>

template<MKL_INT BRNG, int Bits>
template<typename CharT , typename Traits >
std::basic_istream<CharT, Traits>& operator>> ( std::basic_istream< CharT, Traits > &  is,
MKLEngine< BRNG, Bits > &  eng 
)
friend

Definition at line 1044 of file mkl.hpp.