Do more. Code less. Free software for GPU computing.
<scroll to top>

array Class Reference

#include <array.h>

List of all members.

Public Member Functions

array copy () const
 Create a deep-copy of another array for modification. See device() for example.
 array (ginternal *)
 ~array ()
 array ()
 Create non-dimensioned array (no data, undefined size).
 array (const dim4 &dims, dtype ty=f32)
 Allocate an array with undefined contents.
 array (int d0, int d1, dtype ty=f32)
 Allocate an array with undefined contents.
 array (int d0, int d1, int d2, dtype ty=f32)
 Allocate an array with undefined contents.
 array (int d0, int d1, int d2, int d3, dtype ty=f32)
 Allocate an array with undefined contents.
 array (const array &)
 Duplicate an existing array (copy constructor).
 array (const seq &s)
 Convert a seq object for use with arithmetic.
template<typename ty >
 array (unsigned dim0, const ty *pointer, af_source_t src=afHostPointer, unsigned ngfor=0)
 Create column vector from pointer.
template<typename ty >
 array (unsigned dim0, unsigned dim1, const ty *pointer, af_source_t src=afHostPointer, unsigned ngfor=0)
 Create matrix from pointer.
template<typename ty >
 array (unsigned dim0, unsigned dim1, unsigned dim2, const ty *pointer, af_source_t src=afHostPointer, unsigned ngfor=0)
 Create volume from pointer.
template<typename ty >
 array (unsigned dim0, unsigned dim1, unsigned dim2, unsigned dim3, const ty *pointer, af_source_t src=afHostPointer, unsigned ngfor=0)
 Create 4D array from pointer.
template<typename ty >
 array (const dim4 &dims, const ty *pointer, af_source_t src=afHostPointer, unsigned ngfor=0)
 Create array from pointer.
dim4 dims () const
 Fetch an object representing the dimensions of array.
int dims (unsigned) const
 Fetch size of specified dimension (zero-indexed).
int ndims () const
 How many dimensions (ignore trailing singletons)
int elements () const
 How many elements in array.
unsigned ngfor () const
 How many gfor() tiles (zero means none)
size_t bytes () const
 How many bytes (including all GFOR tiles) does this array occupy?
bool isempty () const
 Is empty (no elements)
bool isscalar () const
 Is scalar (one element)
bool isvector () const
 Is either row or column vector (or scalar), i.e. isrow() || iscolumn()
bool isrow () const
 Is row vector.
bool iscolumn () const
 Is column vector.
dtype type () const
 Type of array.
bool iscomplex () const
 Is complex-valued array?
bool isreal () const
 Is real-valued array?
bool issparse () const
void eval ()
 Evaluate an expression but do not block (wait) until complete.
void unlock () const
 Release pointers from device() after finished so can be garbage collected.
array row (int i) const
 Access row i to form row vector.
array col (int i) const
 Access column i to form column vector.
array slice (int i) const
 Access slice i to form a matrix.
array rows (int first, int last) const
 Access rows first through last to form a matrix.
array cols (int first, int last) const
 Access columns first through last to form a matrix.
array slices (int first, int last) const
 Access slices first through last to form a volume.
array operator- () const
 Arithmetic negation.
array operator! () const
 Logical negation (not binary compliment)
array operator* (const array &rhs) const
 Multiply two matrices.
array operator* (const double &scalar) const
 multiply array with scalar
array operator+ (const array &) const
array operator+ (const double &) const
array operator- (const array &) const
array operator- (const double &) const
array operator/ (const array &) const
array operator/ (const double &) const
array operator% (const array &) const
array operator% (const double &) const
arrayoperator+= (const array &)
arrayoperator+= (const double &)
arrayoperator-= (const array &)
arrayoperator-= (const double &)
arrayoperator*= (const array &)
arrayoperator*= (const double &)
arrayoperator/= (const array &)
arrayoperator/= (const double &)
arrayoperator%= (const array &)
arrayoperator%= (const double &)
arrayoperator++ ()
arrayoperator-- ()
array operator& (const array &) const
array operator&& (const array &) const
array operator&& (const bool &) const
array operator&& (const int &) const
array operator&& (const unsigned &) const
array operator&& (const double &) const
array operator| (const array &) const
array operator|| (const array &) const
array operator|| (const bool &) const
array operator|| (const int &) const
array operator|| (const unsigned &) const
array operator|| (const double &) const
array operator^ (const array &) const
array operator== (const array &) const
array operator== (const bool &) const
array operator== (const int &) const
array operator== (const double &) const
array operator!= (const array &) const
array operator!= (const bool &) const
array operator!= (const int &) const
array operator!= (const double &) const
array operator< (const array &) const
array operator< (const bool &) const
array operator< (const int &) const
array operator< (const double &) const
array operator<= (const array &) const
array operator<= (const bool &) const
array operator<= (const int &) const
array operator<= (const double &) const
array operator> (const array &) const
array operator> (const bool &) const
array operator> (const int &) const
array operator> (const double &) const
array operator>= (const array &) const
array operator>= (const bool &) const
array operator>= (const int &) const
array operator>= (const double &) const
template<typename ty >
arrayoperator= (const ty)
 scalar assignment
arrayoperator= (const array &)
 array assignment
array T () const
 Transpose matrix or vector.
array H () const
 Conjugate transpose (i.e.
One subscript
array operator() (int x) const
 Access linear element x.
array operator() (const seq &) const
 Access linear sequence of elements.
array operator() (array indices) const
 Use indices (integer values or boolean mask)
Two subscripts
array operator() (const seq &, const seq &) const
 Access submatrix.
array operator() (int row, int col) const
 Access linear element at row and col.
array operator() (int row, const seq &y) const
 Access linear sequence of elements along row.
array operator() (int row, array columns) const
 Elements along row and columns.
array operator() (const seq &x, int column) const
 Access linear sequence of elements along column.
array operator() (const seq &rows, array columns) const
 Elements along rows and columns.
array operator() (array rows, int column) const
 Elements along rows and column.
array operator() (array rows, const seq &columns) const
 Elements along rows and columns.
array operator() (array rows, array columns) const
 Elements along rows and columns.
Three subscripts
array operator() (const seq &, const seq &, const seq &) const
 Access volume.
array operator() (int x, int y, int z) const
 Access element.
array operator() (const seq &x, int y, int z) const
 Access vector.
array operator() (int x, const seq &y, int z) const
 Access vector.
array operator() (int x, int y, const seq &z) const
 Access vector.
array operator() (int x, const seq &y, const seq &z) const
 Access matrix.
array operator() (const seq &x, const seq &y, int z) const
 Access matrix.
array operator() (const seq &x, int y, const seq &z) const
 Access matrix.
array operator() (array rows, array cols, const seq &slices) const
 Elements along rows, columns, slices.
array operator() (array rows, array cols, int slice) const
 Elements along rows, cols, slice.
array operator() (array rows, const seq &cols, const seq &slices) const
 Elements along rows, columns, slices.
array operator() (array rows, const seq &cols, int slice) const
 Elements along rows, cols, slice.
array operator() (const seq &rows, array cols, const seq &slices) const
 Elements along rows, columns, slices.
array operator() (const seq &, const seq &, array) const
 Access submatrix.
Four subscripts
array operator() (const seq &w, const seq &x, const seq &y, const seq &z) const
 Access volume.
array operator() (const seq &w, const seq &x, const seq &y, int z) const
 Access volume.
array operator() (const seq &w, const seq &x, int y, int z) const
 Access matrix.

Static Public Member Functions

template<typename ty >
static array scalar (const ty)
 Push scalar value to the device.
template<typename T >
static T * alloc (size_t elements)
 Allocate an array of elements (see free()).
static void free (void *)
 Free data allocated by alloc()

Public Attributes

ginternal * m_internal

Friends

class ginternal
array operator* (const double &scalar, const array &)
 multiply array with scalar
array operator+ (const double &, const array &)
array operator- (const double &, const array &)
array operator/ (const double &, const array &)
array operator% (const double &, const array &)
array operator&& (const bool &, const array &)
array operator&& (const int &, const array &)
array operator&& (const unsigned &, const array &)
array operator|| (const bool &, const array &)
array operator|| (const int &, const array &)
array operator|| (const unsigned &, const array &)
array operator== (const bool &, const array &)
array operator== (const int &, const array &)
array operator== (const double &, const array &)
array operator!= (const bool &, const array &)
array operator!= (const int &, const array &)
array operator!= (const double &, const array &)
array operator< (const bool &, const array &)
array operator< (const int &, const array &)
array operator< (const double &, const array &)
array operator<= (const bool &, const array &)
array operator<= (const int &, const array &)
array operator<= (const double &, const array &)
array operator> (const bool &, const array &)
array operator> (const int &, const array &)
array operator> (const double &, const array &)
array operator>= (const bool &, const array &)
array operator>= (const int &, const array &)
array operator>= (const double &, const array &)

template<typename T >
scalar () const
 Returns host-side scalar of first component of data.
template<typename T >
T * device () const
 Device-side pointer to matrix data.
template<typename T >
T * host () const
 Host-side pointer to matrix data.
template<typename T >
static void hostFree (const T *)
 Releases host-side memory allocated for data by host()

Detailed Description


Constructor & Destructor Documentation

array ( ginternal *  )
~array ( )

Member Function Documentation

array copy ( ) const

Create a deep-copy of another array for modification. See device() for example.

void eval ( )

Evaluate an expression but do not block (wait) until complete.

Examples:
examples/misc/gfor.cpp.
void unlock ( ) const

Release pointers from device() after finished so can be garbage collected.


Friends And Related Function Documentation

friend class ginternal [friend]

Member Data Documentation

ginternal* m_internal [mutable]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines