Project Alice
Loading...
Searching...
No Matches
r123 Namespace Reference

Classes

struct  double2
 
struct  Engine
 
struct  float2
 
class  MicroURNG
 
struct  ReinterpretCtr
 

Functions

R123_CUDA_DEVICE R123_STATIC_INLINE void sincospif (float x, float *s, float *c)
 
R123_CUDA_DEVICE R123_STATIC_INLINE void sincospi (double x, double *s, double *c)
 
R123_CUDA_DEVICE R123_STATIC_INLINE float2 boxmuller (uint32_t u0, uint32_t u1)
 
R123_CUDA_DEVICE R123_STATIC_INLINE double2 boxmuller (uint64_t u0, uint64_t u1)
 
template<typename Ftype , typename Itype >
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype u01 (Itype in)
 Return a uniform real value in (0, 1]. More...
 
template<typename Ftype , typename Itype >
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype uneg11 (Itype in)
 Return a signed value in [-1,1]. More...
 
template<typename Ftype , typename Itype >
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype u01fixedpt (Itype in)
 Return a value in (0,1) chosen from a set of equally spaced fixed-point values. More...
 

Detailed Description

Most of the Random123 C++ API is contained in the r123 namespace.

Function Documentation

◆ boxmuller() [1/2]

R123_CUDA_DEVICE R123_STATIC_INLINE float2 r123::boxmuller ( uint32_t  u0,
uint32_t  u1 
)

Definition at line 117 of file boxmuller.hpp.

Here is the call graph for this function:

◆ boxmuller() [2/2]

R123_CUDA_DEVICE R123_STATIC_INLINE double2 r123::boxmuller ( uint64_t  u0,
uint64_t  u1 
)

Definition at line 131 of file boxmuller.hpp.

Here is the call graph for this function:

◆ sincospi()

R123_CUDA_DEVICE R123_STATIC_INLINE void r123::sincospi ( double  x,
double *  s,
double *  c 
)

Definition at line 107 of file boxmuller.hpp.

Here is the caller graph for this function:

◆ sincospif()

R123_CUDA_DEVICE R123_STATIC_INLINE void r123::sincospif ( float  x,
float *  s,
float *  c 
)

Definition at line 102 of file boxmuller.hpp.

Here is the caller graph for this function:

◆ u01()

template<typename Ftype , typename Itype >
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype r123::u01 ( Itype  in)

Return a uniform real value in (0, 1].

@ingroup uniform
 Input is a W-bit integer (signed or unsigned).  It is cast to
 a W-bit unsigned integer, multiplied by Ftype(2^-W) and added to
 Ftype(2^(-W-1)).  A good compiler should optimize it down to an
 int-to-float conversion followed by a multiply and an add, which
 might be fused, depending on the architecture.

If the input is a uniformly distributed integer, and if Ftype
arithmetic follows IEEE754 round-to-nearest rules, then the
result is a uniformly distributed floating point number in (0, 1].
  • The result is never exactly 0.0.
  • The smallest value returned is 2^-(W-1).
  • Let M be the number of mantissa bits in Ftype (typically 24 or 53).
    • If W>M then the largest value retured is 1.0.
    • If W<=M then the largest value returned is Ftype(1.0 - 2^(-W-1)).

Definition at line 189 of file uniform.hpp.

◆ uneg11()

template<typename Ftype , typename Itype >
R123_CUDA_DEVICE R123_STATIC_INLINE Ftype r123::uneg11 ( Itype  in)

Return a signed value in [-1,1].

@ingroup uniform
 The argument is converted to a W-bit signed integer, multiplied by Ftype(2^-(W-1)) and
 then added to Ftype(2^-W).  A good compiler should optimize
 it down to an int-to-float conversion followed by a multiply and
 an add, which might be fused, depending on the architecture.

If the input is a uniformly distributed integer, and if Ftype arithmetic follows IEEE754 round-to-nearest rules, then the output is a uniformly distributed floating point number in [-1, 1].

  • The result is never exactly 0.0.
  • The smallest absolute value returned is 2^-W
  • Let M be the number of mantissa bits in Ftype.
    • If W>M then the largest value retured is 1.0 and the smallest is -1.0.
    • If W<=M then the largest value returned is the Ftype(1.0 - 2^-W) and the smallest value returned is -Ftype(1.0 - 2^-W).

Definition at line 221 of file uniform.hpp.