Create a array from a scalar input value. More...

Functions

template<typename T >
array constant (T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype)
 
template<typename T >
array constant (T val, const dim_t d0, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
 
template<typename T >
array constant (T val, const dim_t d0, const dim_t d1, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
 
template<typename T >
array constant (T val, const dim_t d0, const dim_t d1, const dim_t d2, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
 
template<typename T >
array constant (T val, const dim_t d0, const dim_t d1, const dim_t d2, const dim_t d3, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
 
AFAPI af_err af_constant (af_array *arr, const double val, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 
AFAPI af_err af_constant_complex (af_array *arr, const double real, const double imag, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 
AFAPI af_err af_constant_long (af_array *arr, const intl val, const unsigned ndims, const dim_t *const dims)
 
AFAPI af_err af_constant_ulong (af_array *arr, const uintl val, const unsigned ndims, const dim_t *const dims)
 

Detailed Description

Create a array from a scalar input value.

The array created has the same value at all locations


Function Documentation

AFAPI af_err af_constant ( af_array arr,
const double  val,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)
Parameters
[out]arris the generated array of given type
[in]valis the value of each element in the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
[in]typeis the type of array to generate
AFAPI af_err af_constant_complex ( af_array arr,
const double  real,
const double  imag,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)
Parameters
[out]arris the generated array of type c32 or c64
[in]realis the real value of each element in the generated array
[in]imagis the imaginary value of each element in the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
[in]typeis the type of array to generate
AFAPI af_err af_constant_long ( af_array arr,
const intl  val,
const unsigned  ndims,
const dim_t *const  dims 
)
Parameters
[out]arris the generated array of type s64
[in]valis a complex value of each element in the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
AFAPI af_err af_constant_ulong ( af_array arr,
const uintl  val,
const unsigned  ndims,
const dim_t *const  dims 
)
Parameters
[out]arris the generated array of type u64
[in]valis a complex value of each element in the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
array af::constant ( val,
const dim_t  d0,
const af_dtype  ty = (af_dtypedtype_traits< T >::ctype 
)
Parameters
[in]valis the value of each element of the array to be generated
[in]d0is the size of the array to be generated
[in]tyis the type of the array
Returns
array of size d0
array af::constant ( val,
const dim_t  d0,
const dim_t  d1,
const af_dtype  ty = (af_dtypedtype_traits< T >::ctype 
)
Parameters
[in]valis the value of each element of the array to be generated
[in]d0is the number of rows of the array to be generated
[in]d1is the number of columns of the array to be generated
[in]tyis the type of the array
Returns
array of size d0 x d1
array af::constant ( val,
const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const af_dtype  ty = (af_dtypedtype_traits< T >::ctype 
)
Parameters
[in]valis the value of each element of the array to be generated
[in]d0is the size of the 1st dimension of the array to be generated
[in]d1is the size of the 2nd dimension of the array to be generated
[in]d2is the size of the 3rd dimension of the array to be generated
[in]tyis the type of the array
Returns
array of size d0 x d1 x d2
array af::constant ( val,
const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dim_t  d3,
const af_dtype  ty = (af_dtypedtype_traits< T >::ctype 
)
Parameters
[in]valis the value of each element of the array to be generated
[in]d0is the size of the 1st dimension of the array to be generated
[in]d1is the size of the 2nd dimension of the array to be generated
[in]d2is the size of the 3rd dimension of the array to be generated
[in]d3is the size of the 4rd dimension of the array to be generated
[in]tyis the type of the array
Returns
array of size d0 x d1 x d2 x d3