ArrayFire: constant (original) (raw)

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

Functions
template
array constant (T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype)
C++ Interface to generate an array with elements set to a specified value. More...
template
array constant (T val, const dim_t d0, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
C++ Interface to generate a 1-D array with elements set to a specified value. More...
template
array constant (T val, const dim_t d0, const dim_t d1, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype)
C++ Interface to generate a 2-D array with elements set to a specified value. More...
template
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)
C++ Interface to generate a 3-D array with elements set to a specified value. More...
template
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)
C++ Interface to generate a 4-D array with elements set to a specified value. More...
AFAPI af_err af_constant (af_array *arr, const double val, const unsigned ndims, const dim_t *const dims, const af_dtype type)
C Interface to generate an array with elements set to a specified value. More...
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)
C Interface to generate a complex array with elements set to a specified value. More...
AFAPI af_err af_constant_long (af_array *arr, const long long val, const unsigned ndims, const dim_t *const dims)
C Interface to generate an array with elements set to a specified value. More...
AFAPI af_err af_constant_ulong (af_array *arr, const unsigned long long val, const unsigned ndims, const dim_t *const dims)
C Interface to generate an array with elements set to a specified value. More...

Create an array from a scalar input value.

Generate an array with elements set to a specified value.


af_constant()

C Interface to generate an array with elements set to a specified value.

Parameters

[out] arr constant array
[in] val constant value
[in] ndims size of the dimension array
[in] dims dimensions of the array to be generated
[in] type type

Returns

AF_SUCCESS, if function returns successfully, else an af_err code is given

af_constant_complex()

C Interface to generate a complex array with elements set to a specified value.

Parameters

[out] arr constant complex array
[in] real real constant value
[in] imag imaginary constant value
[in] ndims size of the dimension array
[in] dims dimensions of the array to be generated
[in] type type, c32 or c64

Returns

AF_SUCCESS, if function returns successfully, else an af_err code is given

af_constant_long()

C Interface to generate an array with elements set to a specified value.

Output type is s64.

Parameters

[out] arr constant array
[in] val constant value
[in] ndims size of the dimension array
[in] dims dimensions of the array to be generated

Returns

AF_SUCCESS, if function returns successfully, else an af_err code is given

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
)

C Interface to generate an array with elements set to a specified value.

Output type is u64.

Parameters

[out] arr constant array
[in] val constant value
[in] ndims size of the dimension array
[in] dims dimensions of the array to be generated

Returns

AF_SUCCESS, if function returns successfully, else an af_err code is given

constant() [1/5]

constant() [2/5]

C++ Interface to generate a 1-D array with elements set to a specified value.

Parameters

[in] val constant value
[in] d0 size of the first dimension
[in] ty type

Returns

constant 1-D array

constant() [3/5]

C++ Interface to generate a 2-D array with elements set to a specified value.

Parameters

[in] val constant value
[in] d0 size of the first dimension
[in] d1 size of the second dimension
[in] ty type

Returns

constant 2-D array

constant() [4/5]

C++ Interface to generate a 3-D array with elements set to a specified value.

Parameters

[in] val constant value
[in] d0 size of the first dimension
[in] d1 size of the second dimension
[in] d2 size of the third dimension
[in] ty type

Returns

constant 3-D array

constant() [5/5]

C++ Interface to generate a 4-D array with elements set to a specified value.

Parameters

[in] val constant value
[in] d0 size of the first dimension
[in] d1 size of the second dimension
[in] d2 size of the third dimension
[in] d3 size of the fourth dimension
[in] ty type

Returns

constant 4-D array