|
Construct an array object. More...
Functions | |
AFAPI af_err | af_device_array (af_array *arr, const 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... | |
array () | |
Create undimensioned array (no data, undefined size) More... | |
array (const af_array handle) | |
Creates an array from an af_array handle. More... | |
array (const array &in) | |
Creates a copy to the in array. More... | |
array (dim_t dim0, dtype ty=f32) | |
Allocate a one-dimensional array of a specified size with undefined contents. More... | |
array (dim_t dim0, dim_t dim1, dtype ty=f32) | |
Allocate a two-dimensional array of a specified size with undefined contents. More... | |
array (dim_t dim0, dim_t dim1, dim_t dim2, dtype ty=f32) | |
Allocate a three-dimensional (3D) array of a specified size with undefined contents. More... | |
array (dim_t dim0, dim_t dim1, dim_t dim2, dim_t dim3, dtype ty=f32) | |
Allocate a four-dimensional (4D) array of a specified size with undefined contents. More... | |
array (const dim4 &dims, dtype ty=f32) | |
Allocate an array of a specified size with undefined contents. More... | |
template<typename T > | |
array (dim_t dim0, const T *pointer, af::source src=afHost) | |
Create a column vector on the device using a host/device pointer. More... | |
template<typename T > | |
array (dim_t dim0, dim_t dim1, const T *pointer, af::source src=afHost) | |
Create a 2D array on the device using a host/device pointer. More... | |
template<typename T > | |
array (dim_t dim0, dim_t dim1, dim_t dim2, const T *pointer, af::source src=afHost) | |
Create a 3D array on the device using a host/device pointer. More... | |
template<typename T > | |
array (dim_t dim0, dim_t dim1, dim_t dim2, dim_t dim3, const T *pointer, af::source src=afHost) | |
Create a 4D array on the device using a host/device pointer. More... | |
template<typename T > | |
array (const dim4 &dims, const T *pointer, af::source src=afHost) | |
Create an array of specified size on the device using a host/device pointer. More... | |
array (const array &input, const dim4 &dims) | |
Adjust the dimensions of an N-D array (fast). More... | |
array (const array &input, const dim_t dim0, const dim_t dim1=1, const dim_t dim2=1, const dim_t dim3=1) | |
Adjust the dimensions of an N-D array (fast). More... | |
Construct an array object.
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
[out] | arr | The pointer to the returned object. |
[in] | data | The data which will be loaded into the array |
[in] | ndims | The number of dimensions read from the dims parameter |
[in] | dims | A C pointer with ndims elements. Each value represents the size of that dimension |
[in] | type | The type of the af_array object |
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.
[out] | arr | The pointer to the retured object. |
[in] | ndims | The number of dimensions read from the dims parameter |
[in] | dims | A C pointer with ndims elements. Each value represents the size of that dimension |
[in] | type | The type of the af_array object |
AFAPI af_err af_device_array | ( | af_array * | arr, |
const void * | data, | ||
const unsigned | ndims, | ||
const dim_t *const | dims, | ||
const af_dtype | type | ||
) |
Create array from device memory.
array | ( | ) |
Create undimensioned array (no data, undefined size)
|
explicit |
Creates an array from an af_array handle.
handle | the af_array object. |
Allocate a one-dimensional array of a specified size with undefined contents.
Declare a two-dimensional array by passing the number of rows and the number of columns as the first two parameters. The (optional) second parameter is the type of the array. The default type is f32 or 4-byte single-precision floating-point numbers.
[in] | dim0 | number of columns in the array |
[in] | ty | optional label describing the data type (default is f32) |
Allocate a two-dimensional array of a specified size with undefined contents.
Declare a two-dimensional array by passing the number of rows and the number of columns as the first two parameters. The (optional) third parameter is the type of the array. The default type is f32 or 4-byte single-precision floating-point numbers.
[in] | dim0 | number of columns in the array |
[in] | dim1 | number of rows in the array |
[in] | ty | optional label describing the data type (default is f32) |
Allocate a three-dimensional (3D) array of a specified size with undefined contents.
This is useful to quickly declare a three-dimensional array by passing the size as the first three parameters. The (optional) fourth parameter is the type of the array. The default type is f32 or 4-byte single-precision floating point numbers.
[in] | dim0 | first dimension of the array |
[in] | dim1 | second dimension of the array |
[in] | dim2 | third dimension of the array |
[in] | ty | optional label describing the data type (default is f32) |
Allocate a four-dimensional (4D) array of a specified size with undefined contents.
This is useful to quickly declare a four-dimensional array by passing the size as the first four parameters. The (optional) fifth parameter is the type of the array. The default type is f32 or 4-byte floating point numbers.
[in] | dim0 | first dimension of the array |
[in] | dim1 | second dimension of the array |
[in] | dim2 | third dimension of the array |
[in] | dim3 | fourth dimension of the array |
[in] | ty | optional label describing the data type (default is f32) |
Allocate an array of a specified size with undefined contents.
This can be useful when the dimensions of the array are calculated somewhere else within the code. The first parameter specifies the size of the array via dim4(). The second parameter is the type of the array. The default type is f32 or 4-byte single-precision floating point numbers.
[in] | dims | size of the array |
[in] | ty | optional label describing the data type (default is f32) |
array | ( | dim_t | dim0, |
const T * | pointer, | ||
af::source | src = afHost |
||
) |
Create a column vector on the device using a host/device pointer.
[in] | dim0 | number of elements in the column vector |
[in] | pointer | pointer (points to a buffer on the host/device) |
[in] | src | source of the data (default is afHost, can also be afDevice) |
array | ( | dim_t | dim0, |
dim_t | dim1, | ||
const T * | pointer, | ||
af::source | src = afHost |
||
) |
Create a 2D array on the device using a host/device pointer.
[in] | dim0 | number of rows |
[in] | dim1 | number of columns |
[in] | pointer | pointer (points to a buffer on the host/device) |
[in] | src | source of the data (default is afHost, can also be afDevice) |
Create a 3D array on the device using a host/device pointer.
[in] | dim0 | first dimension |
[in] | dim1 | second dimension |
[in] | dim2 | third dimension |
[in] | pointer | pointer (points to a buffer on the host/device) |
[in] | src | source of the data (default is afHost, can also be afDevice) |
src
is afHost, the first dim0
* dim1
* dim2
elements are copied. If src
is afDevice, no copy is done; the array object just wraps the device pointer. The data is treated as column major format when performing linear algebra operations.array | ( | dim_t | dim0, |
dim_t | dim1, | ||
dim_t | dim2, | ||
dim_t | dim3, | ||
const T * | pointer, | ||
af::source | src = afHost |
||
) |
Create a 4D array on the device using a host/device pointer.
[in] | dim0 | first dimension |
[in] | dim1 | second dimension |
[in] | dim2 | third dimension |
[in] | dim3 | fourth dimension |
[in] | pointer | pointer (points to a buffer on the host/device) |
[in] | src | source of the data (default is afHost, can also be afDevice) |
|
explicit |
Create an array of specified size on the device using a host/device pointer.
This function copies data from the location specified by the pointer to a 1D/2D/3D/4D array on the device. The data is arranged in "column-major" format (similar to that used by FORTRAN).
Adjust the dimensions of an N-D array (fast).
This operation simply rearranges the description of the array. No memory transfers or transformations are performed. The total number of elements must not change.
[in] | input | |
[in] | dims | total number of elements must not change. |
array | ( | const array & | input, |
const dim_t | dim0, | ||
const dim_t | dim1 = 1 , |
||
const dim_t | dim2 = 1 , |
||
const dim_t | dim3 = 1 |
||
) |
Adjust the dimensions of an N-D array (fast).
This operation simply rearranges the description of the array. No memory transfers or transformations are performed. The total number of elements must not change.
[in] | input | |
[in] | dim0 | first dimension |
[in] | dim1 | second dimension |
[in] | dim2 | third dimension |
[in] | dim3 | fourth dimension |