normal_distribution< RealType > Class Template Reference

normal_distribution&lt; RealType &gt; Class Template Reference#

API library: rocrand_cpp::normal_distribution< RealType > Class Template Reference
rocrand_cpp::normal_distribution< RealType > Class Template Reference

Produces random numbers according to a normal distribution. More...

#include <rocrand.hpp>

Classes

class  param_type
 The type of the distribution parameter set. More...
 

Public Types

typedef RealType result_type
 See description for RealType template parameter.
 

Public Member Functions

 normal_distribution (RealType mean=0.0, RealType stddev=1.0)
 Constructs a new distribution object. More...
 
 normal_distribution (const param_type &params)
 Constructs a new distribution object. More...
 
RealType mean () const
 Returns the mean distribution parameter. More...
 
RealType stddev () const
 Returns the standard deviation distribution parameter. More...
 
param_type param () const
 Returns the distribution parameter object.
 
void param (const param_type &params)
 Sets the distribution parameter object.
 
template<class Generator >
void operator() (Generator &g, RealType *output, size_t size)
 Fills output with normally distributed random floating-point values. More...
 
bool operator== (const normal_distribution< RealType > &other) const
 Returns true if the distribution is the same as other. More...
 
bool operator!= (const normal_distribution< RealType > &other) const
 Returns true if the distribution is different from other. More...
 

Static Public Member Functions

static void reset ()
 Resets distribution's internal state if there is any.
 
static constexpr RealType min ()
 Returns the smallest possible value that can be generated.
 
static constexpr RealType max ()
 Returns the largest possible value that can be generated.
 

Detailed Description

template<class RealType = float>
class rocrand_cpp::normal_distribution< RealType >

Produces random numbers according to a normal distribution.

Template Parameters
RealType- type of generated values. Only float, double and half types are supported.

Constructor & Destructor Documentation

◆ normal_distribution() [1/2]

template<class RealType = float>
rocrand_cpp::normal_distribution< RealType >::normal_distribution ( RealType  mean = 0.0,
RealType  stddev = 1.0 
)
inline

Constructs a new distribution object.

Parameters
mean- A mean distribution parameter
stddev- A standard deviation distribution parameter

◆ normal_distribution() [2/2]

template<class RealType = float>
rocrand_cpp::normal_distribution< RealType >::normal_distribution ( const param_type params)
inlineexplicit

Constructs a new distribution object.

Parameters
params- Distribution parameters

Member Function Documentation

◆ mean()

template<class RealType = float>
RealType rocrand_cpp::normal_distribution< RealType >::mean ( ) const
inline

Returns the mean distribution parameter.

The mean specifies the location of the peak. The default value is 0.0.

◆ operator!=()

template<class RealType = float>
bool rocrand_cpp::normal_distribution< RealType >::operator!= ( const normal_distribution< RealType > &  other) const
inline

Returns true if the distribution is different from other.

Two distribution are equal, if their parameters are equal.

◆ operator()()

template<class RealType = float>
template<class Generator >
void rocrand_cpp::normal_distribution< RealType >::operator() ( Generator &  g,
RealType *  output,
size_t  size 
)
inline

Fills output with normally distributed random floating-point values.

Generates size random floating-point values distributed according to a normal distribution, and stores them into the device memory referenced by output pointer.

Parameters
g- An uniform random number generator object
output- Pointer to device memory to store results
size- Number of values to generate

Requirements:

  • The device memory pointed by output must have been previously allocated and be large enough to store at least size values of RealType type.
  • Pointer output must be aligned to 2 * sizeof(RealType) bytes.
  • size must be even.
  • If generator g is a quasi-random number generator (rocrand_cpp::sobol32_engine), then size must be a multiple of that generator's dimension.

See also: rocrand_generate_normal(), rocrand_generate_normal_double(), rocrand_generate_normal_half()

◆ operator==()

template<class RealType = float>
bool rocrand_cpp::normal_distribution< RealType >::operator== ( const normal_distribution< RealType > &  other) const
inline

Returns true if the distribution is the same as other.

Two distribution are equal, if their parameters are equal.

◆ stddev()

template<class RealType = float>
RealType rocrand_cpp::normal_distribution< RealType >::stddev ( ) const
inline

Returns the standard deviation distribution parameter.

The default value is 1.0.


The documentation for this class was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocrand/checkouts/latest/library/include/rocrand/rocrand.hpp