A high-performance general-purpose compute library

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 long long val, const unsigned ndims, const dim_t *const dims)
 
AFAPI af_err af_constant_ulong (af_array *arr, const unsigned long long 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

◆ af_constant()

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

◆ af_constant_complex()

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

◆ af_constant_long()

AFAPI af_err af_constant_long ( af_array arr,
const long long  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

◆ af_constant_ulong()

AFAPI af_err af_constant_ulong ( af_array arr,
const unsigned long long  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

◆ constant() [1/5]

array constant ( val,
const dim4 dims,
const dtype  ty = (af_dtypedtype_traits< T >::ctype 
)
Parameters
[in]valis the value of each element of the array be genrated
[in]dimsis the dimensions of the array to be generated
[in]tyis the type of the array
Returns
array of size dims
Examples
financial/heston_model.cpp, graphics/gravity_sim.cpp, and unified/basic.cpp.

◆ constant() [2/5]

array 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

◆ constant() [3/5]

array 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

◆ constant() [4/5]

array 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

◆ constant() [5/5]

array 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