Create, release, copy, fetch-properties of af_array. More...

Functions

AFAPI af_err af_device_array (af_array *arr, void *data, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 Create array from device memory. More...
 
AFAPI af_err af_create_array (af_array *arr, const void *const data, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 Create an af_array handle initialized with user defined data. More...
 
AFAPI af_err af_create_handle (af_array *arr, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 Create af_array handle. More...
 
AFAPI af_err af_copy_array (af_array *arr, const af_array in)
 Deep copy an array to another. More...
 
AFAPI af_err af_write_array (af_array arr, const void *data, const size_t bytes, af_source src)
 Copy data from a C pointer (host/device) to an existing array. More...
 
AFAPI af_err af_get_data_ptr (void *data, const af_array arr)
 Copy data from an af_array to a C pointer. More...
 
AFAPI af_err af_release_array (af_array arr)
 Reduce the reference count of the af_array. More...
 
AFAPI af_err af_retain_array (af_array *out, const af_array in)
 Increments an af_array reference count. More...
 
AFAPI af_err af_get_data_ref_count (int *use_count, const af_array in)
 Get the reference count of af_array. More...
 
AFAPI af_err af_eval (af_array in)
 Evaluate any expressions in the Array. More...
 
AFAPI af_err af_eval_multiple (const int num, af_array *arrays)
 Evaluate multiple arrays together. More...
 
AFAPI af_err af_set_manual_eval_flag (bool flag)
 Turn the manual eval flag on or off. More...
 
AFAPI af_err af_get_manual_eval_flag (bool *flag)
 Get the manual eval flag. More...
 
AFAPI af_err af_get_elements (dim_t *elems, const af_array arr)
 Get the total number of elements across all dimensions of the array. More...
 
AFAPI af_err af_get_type (af_dtype *type, const af_array arr)
 Gets the type of an array. More...
 
AFAPI af_err af_get_dims (dim_t *d0, dim_t *d1, dim_t *d2, dim_t *d3, const af_array arr)
 Gets the dimensions of an array. More...
 
AFAPI af_err af_get_numdims (unsigned *result, const af_array arr)
 Gets the number of dimensions of an array. More...
 
AFAPI af_err af_is_empty (bool *result, const af_array arr)
 Check if an array is empty. More...
 
AFAPI af_err af_is_scalar (bool *result, const af_array arr)
 Check if an array is scalar, ie. More...
 
AFAPI af_err af_is_row (bool *result, const af_array arr)
 Check if an array is row vector. More...
 
AFAPI af_err af_is_column (bool *result, const af_array arr)
 Check if an array is a column vector. More...
 
AFAPI af_err af_is_vector (bool *result, const af_array arr)
 Check if an array is a vector. More...
 
AFAPI af_err af_is_complex (bool *result, const af_array arr)
 Check if an array is complex type. More...
 
AFAPI af_err af_is_real (bool *result, const af_array arr)
 Check if an array is real type. More...
 
AFAPI af_err af_is_double (bool *result, const af_array arr)
 Check if an array is double precision type. More...
 
AFAPI af_err af_is_single (bool *result, const af_array arr)
 Check if an array is single precision type. More...
 
AFAPI af_err af_is_half (bool *result, const af_array arr)
 Check if an array is 16 bit floating point type. More...
 
AFAPI af_err af_is_realfloating (bool *result, const af_array arr)
 Check if an array is real floating point type. More...
 
AFAPI af_err af_is_floating (bool *result, const af_array arr)
 Check if an array is floating precision type. More...
 
AFAPI af_err af_is_integer (bool *result, const af_array arr)
 Check if an array is integer type. More...
 
AFAPI af_err af_is_bool (bool *result, const af_array arr)
 Check if an array is bool type. More...
 
AFAPI af_err af_is_sparse (bool *result, const af_array arr)
 Check if an array is sparse. More...
 
AFAPI af_err af_get_scalar (void *output_value, const af_array arr)
 Get first element from an array. More...
 

Detailed Description

Create, release, copy, fetch-properties of af_array.

Function Documentation

◆ af_copy_array()

AFAPI af_err af_copy_array ( af_array arr,
const af_array  in 
)

Deep copy an array to another.

◆ af_create_array()

AFAPI af_err af_create_array ( af_array arr,
const void *const  data,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)

Create an af_array handle initialized with user defined data.

This function will create an af_array handle from the memory provided in data.

Parameters
[out]arrThe pointer to the returned object.
[in]dataThe data which will be loaded into the array
[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
Returns
AF_SUCCESS if the operation was a success

◆ af_create_handle()

AFAPI af_err af_create_handle ( af_array arr,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)

Create af_array handle.

To release the memory allocated by this call you would have to call af_release_array once your use of this af_array is complete.

Parameters
[out]arrThe pointer to the retured 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
Returns
AF_SUCCESS if the operation was a success

◆ af_device_array()

AFAPI af_err af_device_array ( af_array arr,
void *  data,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)

Create array from device memory.

◆ af_eval()

AFAPI af_err af_eval ( af_array  in)

Evaluate any expressions in the Array.

◆ af_eval_multiple()

AFAPI af_err af_eval_multiple ( const int  num,
af_array arrays 
)

Evaluate multiple arrays together.

◆ af_get_data_ptr()

AFAPI af_err af_get_data_ptr ( void *  data,
const af_array  arr 
)

Copy data from an af_array to a C pointer.

Needs to used in conjunction with the two functions above

◆ af_get_data_ref_count()

AFAPI af_err af_get_data_ref_count ( int *  use_count,
const af_array  in 
)

Get the reference count of af_array.

◆ af_get_dims()

AFAPI af_err af_get_dims ( dim_t d0,
dim_t d1,
dim_t d2,
dim_t d3,
const af_array  arr 
)

Gets the dimensions of an array.

Parameters
[out]d0is the output that contains the size of first dimension of arr
[out]d1is the output that contains the size of second dimension of arr
[out]d2is the output that contains the size of third dimension of arr
[out]d3is the output that contains the size of fourth dimension of arr
[in]arris the input array
Returns
error codes

◆ af_get_elements()

AFAPI af_err af_get_elements ( dim_t elems,
const af_array  arr 
)

Get the total number of elements across all dimensions of the array.

Parameters
[out]elemsis the output that contains number of elements of arr
[in]arris the input array
Returns
error codes

◆ af_get_manual_eval_flag()

AFAPI af_err af_get_manual_eval_flag ( bool *  flag)

Get the manual eval flag.

◆ af_get_numdims()

AFAPI af_err af_get_numdims ( unsigned *  result,
const af_array  arr 
)

Gets the number of dimensions of an array.

Parameters
[out]resultis the output that contains the number of dims of arr
[in]arris the input array
Returns
error codes

◆ af_get_scalar()

AFAPI af_err af_get_scalar ( void *  output_value,
const af_array  arr 
)

Get first element from an array.

Parameters
[out]output_valueis the element requested
[in]arris the input array
Returns
AF_SUCCESS if the execution completes properly

◆ af_get_type()

AFAPI af_err af_get_type ( af_dtype type,
const af_array  arr 
)

Gets the type of an array.

Parameters
[out]typeis the output that contains the type of arr
[in]arris the input array
Returns
error codes

◆ af_is_bool()

AFAPI af_err af_is_bool ( bool *  result,
const af_array  arr 
)

Check if an array is bool type.

Parameters
[out]resultis true if arr is of b8 type, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_column()

AFAPI af_err af_is_column ( bool *  result,
const af_array  arr 
)

Check if an array is a column vector.

Parameters
[out]resultis true if arr has dims [x 1 1 1], false otherwise
[in]arris the input array
Returns
error codes

◆ af_is_complex()

AFAPI af_err af_is_complex ( bool *  result,
const af_array  arr 
)

Check if an array is complex type.

Parameters
[out]resultis true if arr is of type c32 or c64, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_double()

AFAPI af_err af_is_double ( bool *  result,
const af_array  arr 
)

Check if an array is double precision type.

Parameters
[out]resultis true if arr is of type f64 or c64, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_empty()

AFAPI af_err af_is_empty ( bool *  result,
const af_array  arr 
)

Check if an array is empty.

Parameters
[out]resultis true if elements of arr is 0, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_floating()

AFAPI af_err af_is_floating ( bool *  result,
const af_array  arr 
)

Check if an array is floating precision type.

This is a combination of af_is_realfloating and af_is_complex

Parameters
[out]resultis true if arr is of type f16 f32, f64, c32 or c64, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_half()

AFAPI af_err af_is_half ( bool *  result,
const af_array  arr 
)

Check if an array is 16 bit floating point type.

Parameters
[out]resultis true if arr is of type f16 otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_integer()

AFAPI af_err af_is_integer ( bool *  result,
const af_array  arr 
)

Check if an array is integer type.

Parameters
[out]resultis true if arr is of integer types, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_real()

AFAPI af_err af_is_real ( bool *  result,
const af_array  arr 
)

Check if an array is real type.

This is mutually exclusive to af_is_complex

Parameters
[out]resultis true if arr is NOT c32 or c64, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_realfloating()

AFAPI af_err af_is_realfloating ( bool *  result,
const af_array  arr 
)

Check if an array is real floating point type.

Parameters
[out]resultis true if arr is of type f32 or f64, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_row()

AFAPI af_err af_is_row ( bool *  result,
const af_array  arr 
)

Check if an array is row vector.

Parameters
[out]resultis true if arr has dims [1 x 1 1], false otherwise
[in]arris the input array
Returns
error codes

◆ af_is_scalar()

AFAPI af_err af_is_scalar ( bool *  result,
const af_array  arr 
)

Check if an array is scalar, ie.

single element.

Parameters
[out]resultis true if elements of arr is 1, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_single()

AFAPI af_err af_is_single ( bool *  result,
const af_array  arr 
)

Check if an array is single precision type.

Parameters
[out]resultis true if arr is of type f32 or c32, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_sparse()

AFAPI af_err af_is_sparse ( bool *  result,
const af_array  arr 
)

Check if an array is sparse.

Parameters
[out]resultis true if arr is sparse, otherwise false
[in]arris the input array
Returns
error codes

◆ af_is_vector()

AFAPI af_err af_is_vector ( bool *  result,
const af_array  arr 
)

Check if an array is a vector.

A vector is any array that has exactly 1 dimension not equal to 1.

Parameters
[out]resultis true if arr is a vector, false otherwise
[in]arris the input array
Returns
error codes

◆ af_release_array()

AFAPI af_err af_release_array ( af_array  arr)

Reduce the reference count of the af_array.

Note
Zero initialized af_arrays can be accepted after version 3.7

◆ af_retain_array()

AFAPI af_err af_retain_array ( af_array out,
const af_array  in 
)

Increments an af_array reference count.

◆ af_set_manual_eval_flag()

AFAPI af_err af_set_manual_eval_flag ( bool  flag)

Turn the manual eval flag on or off.

◆ af_write_array()

AFAPI af_err af_write_array ( af_array  arr,
const void *  data,
const size_t  bytes,
af_source  src 
)

Copy data from a C pointer (host/device) to an existing array.