Create a array from a scalar input value.
More...
|
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) |
|
Create a array from a scalar input value.
The array created has the same value at all locations
◆ af_constant()
- Parameters
-
[out] | arr | is the generated array of given type |
[in] | val | is the value of each element in the generated array |
[in] | ndims | is size of dimension array dims |
[in] | dims | is the array containing sizes of the dimension |
[in] | type | is the type of array to generate |
◆ af_constant_complex()
- Parameters
-
[out] | arr | is the generated array of type c32 or c64 |
[in] | real | is the real value of each element in the generated array |
[in] | imag | is the imaginary value of each element in the generated array |
[in] | ndims | is size of dimension array dims |
[in] | dims | is the array containing sizes of the dimension |
[in] | type | is the type of array to generate |
◆ af_constant_long()
- Parameters
-
[out] | arr | is the generated array of type s64 |
[in] | val | is a complex value of each element in the generated array |
[in] | ndims | is size of dimension array dims |
[in] | dims | is 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] | arr | is the generated array of type u64 |
[in] | val | is a complex value of each element in the generated array |
[in] | ndims | is size of dimension array dims |
[in] | dims | is the array containing sizes of the dimension |
◆ constant() [1/5]
◆ constant() [2/5]
- Parameters
-
[in] | val | is the value of each element of the array to be generated |
[in] | d0 | is the size of the array to be generated |
[in] | ty | is the type of the array |
- Returns
- array of size
d0
◆ constant() [3/5]
- Parameters
-
[in] | val | is the value of each element of the array to be generated |
[in] | d0 | is the number of rows of the array to be generated |
[in] | d1 | is the number of columns of the array to be generated |
[in] | ty | is the type of the array |
- Returns
- array of size
d0
x d1
◆ constant() [4/5]
- Parameters
-
[in] | val | is the value of each element of the array to be generated |
[in] | d0 | is the size of the 1st dimension of the array to be generated |
[in] | d1 | is the size of the 2nd dimension of the array to be generated |
[in] | d2 | is the size of the 3rd dimension of the array to be generated |
[in] | ty | is the type of the array |
- Returns
- array of size
d0
x d1 x d2
◆ constant() [5/5]
- Parameters
-
[in] | val | is the value of each element of the array to be generated |
[in] | d0 | is the size of the 1st dimension of the array to be generated |
[in] | d1 | is the size of the 2nd dimension of the array to be generated |
[in] | d2 | is the size of the 3rd dimension of the array to be generated |
[in] | d3 | is the size of the 4rd dimension of the array to be generated |
[in] | ty | is the type of the array |
- Returns
- array of size
d0
x d1 x d2 x d3