|
A multi dimensional data container. More...
#include <array.h>
Data Structures | |
class | array_proxy |
Intermediate data class. More... | |
Public Member Functions | |
void | set (af_array tmp) |
Updates the internal af_array object. More... | |
template<typename T > | |
T * | device () const |
array::array_proxy | operator() (const index &s0) |
This operator returns a reference of the original array at a given coordinate. More... | |
const array::array_proxy | operator() (const index &s0) const |
This operator returns a reference of the original array at a given coordinate. More... | |
array::array_proxy | operator() (const index &s0, const index &s1, const index &s2=span, const index &s3=span) |
This operator returns a reference of the original array at a given coordinate. More... | |
const array::array_proxy | operator() (const index &s0, const index &s1, const index &s2=span, const index &s3=span) const |
This operator returns a reference of the original array at a given coordinate. More... | |
const array | as (dtype type) const |
Converts the array into another type. More... | |
~array () | |
array | T () const |
Get the transposed the array. More... | |
array | H () const |
Get the conjugate-transpose of the current array. More... | |
array | operator- () const |
Negates the values of the array. More... | |
array | operator! () const |
Performs a not operation on the values of the array. More... | |
int | nonzeros () const |
Get the count of non-zero elements in the array. More... | |
void | lock () const |
Locks the device buffer in the memory manager. More... | |
void | unlock () const |
Unlocks the device buffer in the memory manager. More... | |
template<> | |
AFAPI cl_mem * | device () const |
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... | |
af_array | get () |
get the af_array handle More... | |
af_array | get () const |
get the af_array handle More... | |
dim_t | elements () const |
get the number of elements in array More... | |
template<typename T > | |
T * | host () const |
Copy array data to host and return host pointer. More... | |
void | host (void *ptr) const |
Copy array data to existing host pointer. More... | |
template<typename T > | |
void | write (const T *ptr, const size_t bytes, af::source src=afHost) |
Perform deep copy from host/device pointer to an existing array. More... | |
dtype | type () const |
Get array data type. More... | |
dim4 | dims () const |
Get dimensions of the array. More... | |
dim_t | dims (unsigned dim) const |
Get dimensions of the array. More... | |
unsigned | numdims () const |
Get the number of dimensions of the array. More... | |
size_t | bytes () const |
Get the size of the array in bytes. More... | |
array | copy () const |
Perform deep copy of the array. More... | |
bool | isempty () const |
Returns true of the array is empty. More... | |
bool | isscalar () const |
Returns true of the array contains only one value. More... | |
bool | isvector () const |
Returns true if only one of the array dimensions has more than one element. More... | |
bool | isrow () const |
Returns true if only the second dimension has more than one element. More... | |
bool | iscolumn () const |
Returns true if only the first dimension has more than one element. More... | |
bool | iscomplex () const |
Returns true if the array type is c32 or c64. More... | |
bool | isreal () const |
Returns true if the array type is neither c32 nor c64. More... | |
bool | isdouble () const |
Returns true if the array type is f64 or c64. More... | |
bool | issingle () const |
Returns true if the array type is neither f64 nor c64. More... | |
bool | isrealfloating () const |
Returns true if the array type is f32 or f64. More... | |
bool | isfloating () const |
Returns true if the array type is f32, f64, c32 or c64. More... | |
bool | isinteger () const |
Returns true if the array type is u8, b8, s32 u32, s64, u64, s16, u16. More... | |
bool | isbool () const |
Returns true if the array type is b8. More... | |
void | eval () const |
Evaluate any JIT expressions to generate data for the array. More... | |
template<typename T > | |
T | scalar () const |
Get the first element of the array as a scalar. More... | |
array::array_proxy | row (int index) |
Returns a reference to a row. More... | |
const array::array_proxy | row (int index) const |
Returns a reference to a row. More... | |
array::array_proxy | rows (int first, int last) |
Returns a reference to sequence of rows. More... | |
const array::array_proxy | rows (int first, int last) const |
Returns a reference to sequence of rows. More... | |
array::array_proxy | col (int index) |
Returns a reference to a col. More... | |
const array::array_proxy | col (int index) const |
Returns a reference to a col. More... | |
array::array_proxy | cols (int first, int last) |
Returns a reference to sequence of columns. More... | |
const array::array_proxy | cols (int first, int last) const |
Returns a reference to sequence of columns. More... | |
array::array_proxy | slice (int index) |
Returns a reference to a matrix in a volume. More... | |
const array::array_proxy | slice (int index) const |
Returns a reference to a matrix in a volume. More... | |
array::array_proxy | slices (int first, int last) |
Returns a reference to a matrix in a volume. More... | |
const array::array_proxy | slices (int first, int last) const |
Returns a reference to a matrix in a volume. More... | |
array & | operator= (const array &val) |
Assignes the value(s) of val to the elements of the array. More... | |
array & | operator= (const double &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const cdouble &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const cfloat &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const float &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const int &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const unsigned &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const bool &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const char &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const unsigned char &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const long &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const unsigned long &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const long long &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const unsigned long long &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const short &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator= (const unsigned short &val) |
Assignes the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const array &val) |
Adds the value(s) of val to the elements of the array. More... | |
array & | operator+= (const double &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const cdouble &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const cfloat &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const float &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const int &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const unsigned &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const bool &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const char &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const unsigned char &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const long &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const unsigned long &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const long long &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const unsigned long long &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const short &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator+= (const unsigned short &val) |
Adds the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const array &val) |
Subtracts the value(s) of val to the elements of the array. More... | |
array & | operator-= (const double &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const cdouble &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const cfloat &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const float &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const int &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const unsigned &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const bool &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const char &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const unsigned char &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const long &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const unsigned long &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const long long &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const unsigned long long &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const short &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator-= (const unsigned short &val) |
Subtracts the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const array &val) |
Multiplies the value(s) of val to the elements of the array. More... | |
array & | operator*= (const double &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const cdouble &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const cfloat &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const float &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const int &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const unsigned &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const bool &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const char &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const unsigned char &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const long &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const unsigned long &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const long long &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const unsigned long long &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const short &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator*= (const unsigned short &val) |
Multiplies the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const array &val) |
Divides the value(s) of val to the elements of the array. More... | |
array & | operator/= (const double &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const cdouble &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const cfloat &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const float &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const int &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const unsigned &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const bool &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const char &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const unsigned char &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const long &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const unsigned long &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const long long &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const unsigned long long &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const short &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
array & | operator/= (const unsigned short &val) |
Divides the value(s) of val to the elements of the array. (const array &) More... | |
A multi dimensional data container.
~array | ( | ) |
AFAPI cl_mem* device | ( | ) | const |
void lock | ( | ) | const |
Locks the device buffer in the memory manager.
This method can be called to take control of the device pointer from the memory manager. While a buffer is locked, the memory manager doesn't free the memory until unlock() is invoked.
int nonzeros | ( | ) | const |
Get the count of non-zero elements in the array.
For dense matrix, this is the same as count<int>(arr);
void set | ( | af_array | tmp | ) |
void unlock | ( | ) | const |
Unlocks the device buffer in the memory manager.
This method can be called after called after calling array::lock() Calling this method gives back the control of the device pointer to the memory manager.