A high-performance general-purpose compute library

Create a random array sampled from normal distribution. More...

Functions

AFAPI array randn (const dim4 &dims, const dtype ty, randomEngine &r)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI array randn (const dim4 &dims, const dtype ty=f32)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI array randn (const dim_t d0, const dtype ty=f32)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI array randn (const dim_t d0, const dim_t d1, const dtype ty=f32)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI array randn (const dim_t d0, const dim_t d1, const dim_t d2, const dtype ty=f32)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI array randn (const dim_t d0, const dim_t d1, const dim_t d2, const dim_t d3, const dtype ty=f32)
 C++ Interface to create an array of random numbers normally distributed. More...
 
AFAPI af_err af_random_normal (af_array *out, const unsigned ndims, const dim_t *const dims, const af_dtype type, af_random_engine engine)
 C Interface to create an array of normal numbers using a random engine. More...
 
AFAPI af_err af_randn (af_array *out, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 

Detailed Description

Create a random array sampled from normal distribution.

The type of engine used is defined by af::randomEngine.

The data is centered around 0.


Function Documentation

◆ af_randn()

AFAPI af_err af_randn ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)
Parameters
[out]outgenerated array
[in]ndimsnumber of dimensions
[in]dimsarray containing sizes of the dimension
[in]typetype of array to generate
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_random_normal()

AFAPI af_err af_random_normal ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type,
af_random_engine  engine 
)

C Interface to create an array of normal numbers using a random engine.

Parameters
[out]outpointer to the returned object
[in]ndimsnumber of dimensions
[in]dimsC pointer with ndims elements; each value represents the size of that dimension
[in]typetype of the af_array object
[in]enginerandom engine object
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ randn() [1/6]

AFAPI array randn ( const dim4 dims,
const dtype  ty,
randomEngine r 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]dimsdimensions of the array to be generated
[in]tytype of the array
[in]rrandom engine object
Returns
random number array of size dims
Examples
graphics/gravity_sim.cpp.

◆ randn() [2/6]

AFAPI array randn ( const dim4 dims,
const dtype  ty = f32 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]dimsdimensions of the array to be generated
[in]tytype of the array
Returns
random number array of size dims

◆ randn() [3/6]

AFAPI array randn ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dim_t  d3,
const dtype  ty = f32 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]d0size of the first dimension
[in]d1size of the second dimension
[in]d2size of the third dimension
[in]d3size of the fourth dimension
[in]tytype of the array
Returns
random number array of size d0 x d1 x d2 x d3

◆ randn() [4/6]

AFAPI array randn ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dtype  ty = f32 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]d0size of the first dimension
[in]d1size of the second dimension
[in]d2size of the third dimension
[in]tytype of the array
Returns
random number array of size d0 x d1 x d2

◆ randn() [5/6]

AFAPI array randn ( const dim_t  d0,
const dim_t  d1,
const dtype  ty = f32 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]d0size of the first dimension
[in]d1size of the second dimension
[in]tytype of the array
Returns
random number array of size d0 x d1

◆ randn() [6/6]

AFAPI array randn ( const dim_t  d0,
const dtype  ty = f32 
)

C++ Interface to create an array of random numbers normally distributed.

Parameters
[in]d0size of the first dimension
[in]tytype of the array
Returns
random number array of size d0