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

Functions

AFAPI array randu (const dim4 &dims, const dtype ty, randomEngine &r)
 
AFAPI array randu (const dim4 &dims, const dtype ty=f32)
 
AFAPI array randu (const dim_t d0, const dtype ty=f32)
 
AFAPI array randu (const dim_t d0, const dim_t d1, const dtype ty=f32)
 
AFAPI array randu (const dim_t d0, const dim_t d1, const dim_t d2, const dtype ty=f32)
 
AFAPI array randu (const dim_t d0, const dim_t d1, const dim_t d2, const dim_t d3, const dtype ty=f32)
 
AFAPI af_err af_random_uniform (af_array *out, const unsigned ndims, const dim_t *const dims, const af_dtype type, af_random_engine engine)
 C Interface for creating an array of uniform numbers using a random engine. More...
 
AFAPI af_err af_randu (af_array *out, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 

Detailed Description

Create a random array sampled from uniform distribution.

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

The data is uniformly distributed between [0, 1].


Function Documentation

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

C Interface for creating an array of uniform numbers using a random engine.

Parameters
[out]outThe pointer to the returned object.
[in]ndimsThe number of dimensions read from the dims parameter
[in]dimsA C pointer with ndims elements. Each value represents the size of that dimension
[in]typeThe type of the af_array object
[in]engineThe random engine object
Returns
AF_SUCCESS if the execution completes properly
AFAPI af_err af_randu ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)
Parameters
[out]outThe generated array
[in]ndimsSize of dimension array dims
[in]dimsThe array containing sizes of the dimension
[in]typeThe type of array to generate
AFAPI array af::randu ( const dim4 dims,
const dtype  ty = f32 
)
Parameters
[in]dimsThe dimensions of the array to be generated
[in]tyThe type of the array
Returns
array of size dims
AFAPI array af::randu ( const dim_t  d0,
const dtype  ty = f32 
)
Parameters
[in]d0The size of the first dimension
[in]tyThe type of the array
Returns
array of size d0
AFAPI array af::randu ( const dim_t  d0,
const dim_t  d1,
const dtype  ty = f32 
)
Parameters
[in]d0The size of the first dimension
[in]d1The size of the second dimension
[in]tyThe type of the array
Returns
array of size d0 x d1
AFAPI array af::randu ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dtype  ty = f32 
)
Parameters
[in]d0The size of the first dimension
[in]d1The size of the second dimension
[in]d2The size of the third dimension
[in]tyThe type of the array
Returns
array of size d0 x d1 x d2
AFAPI array af::randu ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dim_t  d3,
const dtype  ty = f32 
)
Parameters
[in]d0The size of the first dimension
[in]d1The size of the second dimension
[in]d2The size of the third dimension
[in]d3The size of the fourth dimension
[in]tyThe type of the array
Returns
array of size d0 x d1 x d2 x d3