Do more. Code less. Free software for GPU computing.
<scroll to top>
Classes | Typedefs | Enumerations | Functions | Variables

af Namespace Reference

Classes

class  array
class  dim4
class  exception
class  seq
struct  timer
 Internal timer object. More...

Typedefs

typedef struct af::timer timer
 Internal timer object.

Enumerations

enum  dtype {
  f32, c32, f64, c64,
  b8, s32, u32
}
 

Tokens indicating data type.

More...
enum  af_source_t { afDevicePointer, afHostPointer }
 

Specify which address-space pointer belongs.

More...
enum  af_sparse_t { AF_SP_CSR, AF_SP_CSC, AF_SP_COO }
 

Specify which sparse storage type.

More...
enum  afSolve {
  af_solve_none = 0, af_solve_posdef = 1, af_solve_nonposdef = 2, af_solve_gaussian = 3,
  af_solve_pseudo = 4, af_solve_ctrans = 256, af_solve_trans = 512, af_solve_uppertri = 1024,
  af_solve_lowertri = 2048
}
enum  af_resize_t { AF_RSZ_Nearest = 0, AF_RSZ_Bilinear = 1 }
 

Resize interpolation method.

More...
enum  af_op_t { SUM_T = 0, PROD_T }

Functions

array mul (const array &, const array &)
 elementwise multiply
array mul (const array &, const double scalar)
 multiply array with scalar
array mul (const double scalar, const array &)
 multiply array with scalar
array getrow (int nrows, int *rows_idx, array sp)
array getcol (int ncols, int *cols_idx, array sp)
array convert (const array &, dtype type)
 convert array to another type
array sin (const array &x)
array sinh (const array &x)
array asin (const array &x)
array asinh (const array &x)
array cos (const array &x)
array cosh (const array &x)
array acos (const array &x)
array acosh (const array &x)
array tan (const array &x)
array tanh (const array &x)
array atan (const array &x)
array atanh (const array &x)
array isFinite (const array &x)
 True iff finite.
array isInfinite (const array &x)
 True iff infinity.
array isNan (const array &x)
 True iff NaN.
array sign (const array &x)
array sqrt (const array &x, bool isreal=false)
 Assume output will be real if isreal==true (faster), otherwise produce complex values if necessary (slower to check)
array root (const array &radicand, const array &n)
 Calculate n-th root of real-valued radicand.
array root (const array &radicand, const double n)
 Calculate n-th root of real-valued radicand.
array root (const double radicand, const array &n)
 Calculate n-th root of real-valued radicand.
array pow2 (const array &x)
 Two raised to power x (2^x)
array pow (const array &base, const array &power, bool isreal=false)
 base raised to power (exponent).
array pow (const array &base, const double power, bool isreal=false)
 base raised to power (exponent).
array pow (const double base, const array &power, bool isreal=false)
 base raised to power (exponent).
array ceil (const array &x)
 Smallest integral value not less than x (round toward inf)
array floor (const array &x)
 Largest integral value not greater than x (round toward negative inf)
array round (const array &x)
 Round to nearest integer (away from zero).
array trunc (const array &x)
 Round to nearest integer (towards zero).
array factorial (const array &x)
array min (const array &x, const array &y)
 Minimum between x and y at every position.
array min (const double x, const array &y)
 Minimum between x and every element of y.
array max (const array &x, const array &y)
 Maximum between x and y at every position.
array max (const double x, const array &y)
 Maximum between x and every element of y.
array log (const array &x, bool isreal=false)
 Assume output will be real if isreal==true (faster), otherwise produce complex values if necessary (slower to check)
array log2 (const array &x)
array log10 (const array &x)
array log1p (const array &x)
array exp (const array &x)
array expm1 (const array &x)
array gamma (const array &x)
array gammaln (const array &x)
array epsilon (const array &x)
array erf (const array &x)
array erfc (const array &x)
array erfinv (const array &x)
array erfcinv (const array &x)
array abs (const array &x)
 Absolute value of real or complex number (result is real)
array arg (const array &x)
 Phase angle (radians)
array conj (const array &x)
 Complex conjugate (no effect on real values)
array real (const array &x)
 Real component of array.
array imag (const array &x)
 Imaginary component of array.
array complex (const array &x)
 Form a complex result from one real input.
array complex (const array &real, const array &imaginary)
 Form a complex result from real and imaginary parts.
array complex (const array &real, const double imaginary)
 Form a complex result from real and imaginary parts.
array complex (const double real, const array &imaginary)
 Form a complex result from real and imaginary parts.
array atan2 (const array &, const array &)
 arc tangent function of two variables
array atan2 (const array &, const double)
 arc tangent function of two variables
array atan2 (const double, const array &)
 arc tangent function of two variables
array hypot (const array &, const array &)
 Euclidean distance function without undue overflow or underflow during intermediate steps.
array hypot (const array &, const double)
 Euclidean distance function without undue overflow or underflow during intermediate steps.
array hypot (const double, const array &)
 Euclidean distance function without undue overflow or underflow during intermediate steps.
array rem (const array &, const array &)
 remainder
array rem (const array &, const double)
 remainder
array rem (const double, const array &)
 remainder
array mod (const array &x, const array &y)
 Compute x-n*y where n is quotient of x/y.
array mod (const array &x, const double y)
 Compute x-n*y where n is quotient of x/y.
array mod (const double x, const array &y)
 Compute x-n*y where n is quotient of x/y.
void disp (const array exp, const char *expstr=NULL)
 Display the value of a variable (see print)
array lower (const array &input, int diagonal=0)
 Extract lower triangular matrix.
array upper (const array &input, int diagonal=0)
 Extract upper triangular matrix.
array diagonal (const array &input, int diag=0)
 Extract or form diagonal matrix.
array join (const array &A, const array &B, int dim=0)
 Join two arrays along dimension dim.
array newdims (const array &input, const dim4 &newdims)
 Adjust the dimensions of an N-D array (fast).
array newdims (const array &input, int dim0, int dim1=1, int dim2=1, int dim3=1)
 Adjust the dimensions of an N-D array (fast).
array flipv (const array &in)
 Flip matrix vertically.
array fliph (const array &in)
 Flip matrix vertically.
array flipdim (const array &in, unsigned dim)
 Flip array along a given dimension.
void sync ()
 Block until device has finished all queued operations.
array eval (array a)
 Evaluate an expression (nonblocking).
void eval (array a, array b)
void eval (array a, array b, array c)
void eval (array a, array b, array c, array d)
void eval (array a, array b, array c, array d, array e)
void eval (array a, array b, array c, array d, array e, array f)
template<typename ty >
ty norm (const array &in, float p=af::nan)
 Matrix or vector norm.
template<typename ty >
ty inner (const array &x, const array &y)
 Inner (scalar) product between two vectors.
array inner (const array &X, const array &Y, int dim=-1)
 Dot product along a dimension.
array lu (const array &in)
 LU factorization (packed)
void lu (array &lower, array &upper, const array &in)
 LU factorization.
void lu (array &lower, array &upper, array &pivot, const array &in)
 LU factorization (with pivoting)
array qr (const array &in)
 QR factorization (packed).
void qr (array &q, array &r, const array &in)
 QR factorization.
void qr (array &q, array &r, array &tau, const array &in)
 QR factorization with tau.
array cholesky (unsigned &info, const array &X, bool is_upper=true)
 Cholesky decomposition ("Y^T * Y == X").
array hessenberg (const array &in)
 Hessenberg matrix form.
void hessenberg (array &h, array &q, const array &in)
 Hessenberg matrix h with unitary permutation matrix q.
array eigen (const array &in, bool is_diag=false)
 Eigenvalues.
void eigen (array &values, array &vectors, const array &in)
 Eigenvalues and eigenvectors.
array svd (const array &in, bool is_diag=false)
 Singular values.
void svd (array &s, array &u, array &v, const array &in)
 Singular values with unitary bases: in = u * s * v.
array inv (const array &in)
 Matrix inversion.
array pinv (const array &in)
 Pseudo inverse.
array mpow (const array &base, double exponent)
 Matrix power.
unsigned rank (const array &in, double tolerance=1e-5)
 Rank of matrix.
template<typename T >
det (const array &in)
 Matrix determinant.
array solve (const array &A, const array &B, afSolve options=af_solve_none)
 Solve linear system.
array gfor (double n)
 Create gfor variable for sequence {0, 1, ..., n-1}
array gfor (double first, double last)
 Create gfor variable for sequence {first, first+1, first+2, ..., last}
array gfor (double first, double inc, double last)
 Create gfor variable for sequence {first, first+inc, first+2*inc, ..., last}
array local (const array &variable)
 Create local copy of variable for iteration.
bool gfor_toggle ()
handle trimesh (const float *d_X, const float *d_Y, const float *d_Z, const float *d_C, const unsigned npts)
array filter (const array &image, const array &kernel)
 Image Filter.
array rotate (const array &image, const float theta, bool iscrop=true)
 Image rotation.
array erode (const array &image, const array &mask)
 Image erosion.
array dilate (const array &image, const array &mask)
 Image dilation.
array morph (const array &image, af_morph_t type)
 Image morphology (binary)
array resize (const array &image, float scale, af_resize_t type=AF_RSZ_Nearest)
 Resize an image uniformly.
array resize (const array &image, float height, float width, af_resize_t type=AF_RSZ_Nearest)
 Resize an image.
array rgbtogray (const array &image)
 Image grayscale conversion.
array histogram (const array &data, unsigned nbins)
 Histogram of all values in data.
array histogram (const array &data, unsigned nbins, float min, float max)
 Histogram of all values in data.
array histequal (const array &data, const array &histogram)
 Data normalization via histogram equalization.
array medfilt (const array &image, const unsigned height=3, const unsigned width=3)
 Median filtering within window (default 3x3)
array diff1 (const array &in, int dim=-1)
 difference between elements along a dimension
array diff2 (const array &in, int dim=-1)
 difference between every other element along a dimension
void grad (array &dx, array &dy, const array &in)
 Gradient of a matrix (central differencing).
array tile (const array &A, unsigned d0, unsigned d1=1, unsigned d2=1)
 tile (repeat) array along specified dimensions
array tile (const array &A, const dim4 &dims)
 tile (repeat) array along specified dimensions
array flat (const array &A)
 Flatten an array into column vector.
void grid (array &x, array &y, const array &v1, const array &v2)
 Create a regular mesh grid.
array shift (const array &in, int dim0=0, int dim1=0, int dim2=0, int dim3=0)
 Shift the values of an array around dimension (wrap around).
array shift (const array &in, const array &shift)
 Shift the values of an array around dimension (wrap around).
array reorder (const array &in, int dim0=-1, int dim1=-1, int dim2=-1, int dim3=-1)
 Reorder dimensions of array.
array sort (const array &in, int dim=-1, bool isdescending=false)
 Sort array along dimension.
void sort (array &values, array &indices, const array &in, int dim=-1, bool isdescending=false)
 Sort array along dimension and return original indices of sorted values.
void sort (array &outkeys, array &outvalues, const array &keys, const array &values, bool isdescending=false)
 Sort array values based on keys along dimension.
array sortdim (const array &in, int dim)
 sort treating one dimension as keys.
array sortdim (const array &in, int dim, unsigned norder, const int *h_order)
 sort treating one dimension as keys in specific order.
array fft (const array &, unsigned pad=0)
 Fast Fourier Transform in one dimension.
array ifft (const array &, unsigned pad=0)
 Inverse Fast Fourier Transform in one dimension.
array fft2 (const array &, unsigned nx=0, unsigned ny=0)
 Fast Fourier Transform in two dimensions.
array ifft2 (const array &, unsigned nx=0, unsigned ny=0)
 Inverse Fast Fourier Transform in two dimensions.
array fft3 (const array &)
 Fast Fourier Transform in three dimensions.
array fft3 (const array &, const dim4 &dims)
 Fast Fourier Transform in three dimensions.
array ifft3 (const array &)
 Inverse Fast Fourier Transform in three dimensions.
array ifft3 (const array &, const dim4 &dims)
 Inverse Fast Fourier Transform in three dimensions.
array fir (int nb, const float *h_b, const array &x)
 Finite impulse response filtering.
array fir (const array &b, const array &x)
 Finite impulse response filtering.
array iir (int nb, const float *h_b, int na, const float *h_a, const array &x)
 Infinite impulse response filter (transposed Direct Form II implementation).
array iir (const array &b, const array &a, const array &x)
 Infinite impulse response filter (transposed Direct Form II implementation).
array convolve (const array &f1, const array &f2, const array &signal, afConv shape=afConvFull)
 Separable convolution (2D) with device arrays.
template<typename ty >
array convolve (unsigned n1, const ty *f1, unsigned n2, const ty *f2, const array &signal, afConv shape=afConvFull)
 Separable convolution (2D) with host arrays.
array convolve (const array &signal, const array &filter, afConv shape=afConvFull)
 Convolution (1D,2D,3D).
template<typename ty >
array convolve (const array &signal, unsigned ndims, unsigned *dims, const ty *h_kernel, afConv shape=afConvFull)
 Convolution (1D,2D,3D) with host filter.
array interp (array &X, array &Y, array &Xi, unsigned method=0)
 Interpolation in one dimension (1D).
array interp (array &X, array &Y, array &Xi, float init, unsigned method=0)
 Interpolation in one dimension (1D).
array interp (array &X, array &Y, array &Z, array &Xi, array &Yi, unsigned method=0)
 Interpolation in two dimensions (2D).
array interp (array &X, array &Y, array &Z, array &Xi, array &Yi, float init, unsigned method=0)
 Interpolation in two dimensions (2D).
double timeit (void(*fn)())
 Robust timing of a function (both CPU or GPU).
array setunique (const array &input)
 unique values
void setunique (array &values, array &indices, array &locations, const array &input)
 unique elements in a vector and their indicies
array setunion (const array &A, const array &B)
 union of two vectors
void setunion (array &U, array &IA, array &IB, const array &A, const array &B)
 union of two vectors and their indices
array setintersect (const array &A, const array &B)
 intersection of two vectors
void setintersect (array &U, array &IA, array &IB, const array &A, const array &B)
 intersection of two vectors and their indices
array dot (const array &, const double)
array dot (const double, const array &)
array dot (const array &, const array &)
Generate column vector
array ones (unsigned nx, dtype ty=f32)
array zeros (unsigned nx, dtype ty=f32)
array identity (unsigned nx, dtype ty=f32)
array randu (unsigned nx, dtype ty=f32)
array randn (unsigned nx, dtype ty=f32)
Generate matrix
array ones (unsigned nx, unsigned ny, dtype ty=f32)
array zeros (unsigned nx, unsigned ny, dtype ty=f32)
array identity (unsigned nx, unsigned ny, dtype ty=f32)
array randu (unsigned nx, unsigned ny, dtype ty=f32)
array randn (unsigned nx, unsigned ny, dtype ty=f32)
Generate volume
array ones (unsigned nx, unsigned ny, unsigned nz, dtype ty=f32)
array zeros (unsigned nx, unsigned ny, unsigned nz, dtype ty=f32)
array identity (unsigned nx, unsigned ny, unsigned nz, dtype ty=f32)
array randu (unsigned nx, unsigned ny, unsigned nz, dtype ty=f32)
array randn (unsigned nx, unsigned ny, unsigned nz, dtype ty=f32)
Generate 4D array
array ones (unsigned d0, unsigned d1, unsigned d2, unsigned d3, dtype ty=f32)
array zeros (unsigned d0, unsigned d1, unsigned d2, unsigned d3, dtype ty=f32)
array identity (unsigned d0, unsigned d1, unsigned d2, unsigned d3, dtype ty=f32)
array randu (unsigned d0, unsigned d1, unsigned d2, unsigned d3, dtype ty=f32)
array randn (unsigned d0, unsigned d1, unsigned d2, unsigned d3, dtype ty=f32)
Generate array
array ones (const dim4 &dims, dtype ty=f32)
array zeros (const dim4 &dims, dtype ty=f32)
array identity (const dim4 &dims, dtype ty=f32)
array randu (const dim4 &dims, dtype ty=f32)
array randn (const dim4 &dims, dtype ty=f32)
Construct sparse matrix from pointers
Parameters:
[in]rowsNumber of rows in the matrix
[in]colsNumber of columns in the Matrix
[in]nnzNumber of non zero elements
[in]valuesArray containing nonzero values
[in]rowptrRow indices in CSR format
[in]colindColumn indices in CSR format
[in]srcSpecify if pointers are from Host (default) or device
[in]ngforThe gfor tile size (default 0)
Returns:
out A sparse array of size(m, n). out.dims(2) returns nnz;
array sparse (int rows, int cols, int nnz, const float *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const double *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const cuComplex *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
array sparse (int rows, int cols, int nnz, const cuDComplex *values, const int *rowptr, const int *colind, af_source_t src=afHostPointer, unsigned ngfor=0)
Construct sparse matrix from Dense
Parameters:
[in]denseMatrix stored as dense
Returns:
out A sparse matrix stored in CSR format
array sparse (array dense)
Construct sparse matrix from arrays
Parameters:
[in]IArray containing row indices
[in]JArray containing column indices
[in]valArray containing non zero values
[in]rowsNumber of rows (default -1. Uses max(I) for COO, I.elements() - 1 for CSR)
[in]colsNumber of columns (default -1. Uses max(J))
[in]formatThe format of I, J, val (default: COO)
array sparse (array &I, array &J, array &val, int rows=-1, int cols=-1, af_sparse_t format=AF_SP_COO)
Create dense matrix from sparse matrix
Parameters:
[in]sparseSparse matrix generated by arrayfire
Returns:
dense matrix
array dense (array sparse)
Parameters:
[in]spThe sparse matrix
[in]formatThe required output format
[out]IThe row indices
[out]JThe column indices
[out]ValThe non zero values
afError where (array &I, array &J, array &Val, array sp, af_sparse_t format=AF_SP_COO)
AFAPI void info ()
 Print diagnostic information on driver, runtime, memory, and devices.
AFAPI void deviceset (int index)
 Switch to specified device.
AFAPI int deviceget ()
 Return the index of current device.
AFAPI int devicecount ()
 Returns the number of available devices.
Matrix Interface: Surface plot of 2D data.
Parameters:
[in]X2D matrix with which to draw simple surface plot
handle plot3d (const af::array &X)
Matrix Interface: Visualize 2D velocity field with an array of arrows
Parameters:
[in]Xmatrix containing horizontal base positions for arrows
[in]Ymatrix containing vertical base positions for arrows
[in]Umatrix containing horizontal velocity components
[in]Vmatrix containing vertical velocity components
handle arrows (const af::array &X, const af::array &Y, const af::array &U, const af::array &V)
Matrix Interface: Visualize 1D data as a line plot
Parameters:
[in]Xmatrix containing data to be visualized
[in]linestyleoptional string indicating desired characteristics of plot
handle plot (const af::array &X)
handle plot (const af::array &X, const char *linestyle)
Matrix Interface: Visualize 2D data as a line plot
Parameters:
[in]Xmatrix containing horizontal data to be visualized
[in]Ymatrix containing vertical data to be visualized
[in]linestyleoptional string indicating desired characteristics of plot
handle plot (const array &X, const array &Y)
handle plot (const array &X, const array &Y, const char *linestyle)
Matrix Interface: Visualize 3D data as scatter plot
Parameters:
[in]Xmatrix containing X data to be visualized
[in]Ymatrix containing Y data to be visualized
[in]Zmatrix containing Z data to be visualized
handle points (const af::array &X, const af::array &Y, const af::array &Z)
Matrix Interface: Visualize 3D data volume
Parameters:
[in]X3D array to be volume rendered
handle volume (const af::array &X)
Matrix Interface: Visualize 2D data as single scale image
Parameters:
[in]X2D matrix to be visualized
handle imgplot (const af::array &X)
Matrix Interface: Visualize 2D data as color image
Parameters:
[in]X3D matrix to be visualized in the following format,

  • X(span,span,0) - Red component
  • X(span,span,1) - Blue component
  • X(span,span,2) - Green component
handle rgbplot (const af::array &X)
Device pointer interface: Surface plot of 2D data.
Parameters:
[in]d_a2D device pointer to data with which to draw surface plot
[in]d_wWidth of data and surface plot
[in]d_hHeight of data and surface plot
handle plot3d (const float *d_a, const unsigned w, const unsigned h)
Device pointer interface: Visualize 2D velocity field with an array of arrows
Parameters:
[in]d_Xdevice pointer to X data containing horizontal base positions for arrows
[in]d_Ydevice pointer to Y data containing vertical base positions for arrows
[in]d_Udevice pointer to data containing horizontal velocity components
[in]d_Vdevice pointer to data containing vertical velocity components
[in]cntnumber of arrows to render in velocity plot
handle arrows (const float *d_X, const float *d_Y, const float *d_U, const float *d_V, const int cnt)
Device pointer interface: Visualize 1D data as a line plot
Parameters:
[in]d_Adevice pointer to data to be visualized
[in]lenThe length of the data to be visualized
[in]optionalparameter specifying the visual characteristics of the line plot
handle plot (const float *d_A, const unsigned len)
handle plot (const float *d_A, const unsigned len, const char *linestyle)
Device pointer interface: Visualize 3D data as a line plot
Parameters:
[in]d_Xdevice pointer to X data to be visualized
[in]d_Ydevice pointer to Y data to be visualized
[in]d_Zdevice pointer to Z data to be visualized
[in]nptsThe length of the data to be visualized
[in]linestyleOptional parameter determining the visual characteristics of the line plot
handle plot (const float *d_X, const float *d_Y, const float *d_Z, const unsigned npts)
handle plot (const float *d_X, const float *d_Y, const float *d_Z, const unsigned npts, const char *linestyle)
Device pointer interface: Visualize 3D data as a volume rendering
Parameters:
[in]d_Xdevice pointer to 3D data to be visualized
[in]wThe width of the data to be visualized
[in]hThe height of the data to be visualized
[in]dThe depth of the data to be visualized
handle volume (const float *d_X, const unsigned w, const unsigned h, const unsigned d)
Device pointer interface: Visualize 3D data as scatter plot
Parameters:
[in]d_Xdevice pointer to X component of data to be visualized
[in]d_Ydevice pointer to Y component of data to be visualized
[in]d_Zdevice pointer to Z component of data to be visualized
[in]nptsThe number of 3D points to visualize
handle points (const float *d_X, const float *d_Y, const float *d_Z, const unsigned npts)
Device pointer interface: Visualize 3D data as a colored scatter plot
Parameters:
[in]d_Xdevice pointer to X component of data to be visualized
[in]d_Ydevice pointer to Y component of data to be visualized
[in]d_Zdevice pointer to Z component of data to be visualized
[in]d_Rdevice pointer to red color component data to be visualized
[in]d_Gdevice pointer to green color component data to be visualized
[in]d_Bdevice pointer to blue color component data to be visualized
[in]nptsThe number of 3D points to visualize
handle scattercolors (const float *d_X, const float *d_Y, const float *d_Z, const float *d_R, const float *d_G, const float *d_B, const unsigned npts)
Device pointer interface: Visualize 2D data as single scale image
Parameters:
[in]d_XDevice pointer to 2D matrix to be visualized
[in]wwidth of 2D matrix to be visualized
[in]hheight of 2D matrix to be visualized
handle imgplot (const float *d_X, const unsigned w, const unsigned h)
Device pointer interface: Visualize 2D data as color image
Parameters:
[in]d_XDevice pointer to 2D matrix to be visualized.
[in]wwidth of 2D matrix to be visualized
[in]hheight of 2D matrix to be visualized
handle rgbplot (const float *d_X, const unsigned w, const unsigned h)
Enable graphics overlay plotting for composition of plots on same axis
afError keep_on ()
Disable graphics overlay plotting for composition of plots on same axis
afError keep_off ()
Create a subplot within the figure window for compositions of plots
Parameters:
[in]wHorizontal number of subfigures
[in]hVertical number of subfigures
[in]idxIndex of subfigure to activate
afError subfigure (unsigned w, unsigned h, unsigned idx)
Set global color palette
Parameters:
[in]mapString indicating the colormap to be used. May be any of the following,

  • colors
  • orange
  • gray
  • blue
  • brown
  • pink
  • white
  • sixteenbit
  • heatmap
  • magento
afError palette (const char *map)
Clear the current figure
afError clearfig ()
Force drawing of the current figure (blocking)
afError draw ()
Display a figure window
handle figure ()
Set the title of the current figure or subfigure
Parameters:
[in]strC string representing the title of the figure or subfigure
handle title (const char *str)
Display the current figure with given geometry
Parameters:
[in]xThe horizontal position of the upper left corner of the figure
[in]yThe vertical position of the upper left corner of the figure
[in]wThe width of the figure
[in]hThe height of the figure
handle figure (int x, int y, int w, int h)
Forcibly close the current figure
afError close ()
array sum (const array &input, int dim=-1)
 sum of the elements along a dimension in matrix
template<typename ty >
ty sum (const array &input)
 summation of all elements in array
array prod (const array &input, int dim=-1)
 product (multiplication) of elements along a dimension in matrix
template<typename ty >
ty prod (const array &input)
 product (multiplication) of all elements in array
array min (const array &input, int dim=-1)
 minimum of the elements along a dimension in matrix
void min (array &values, array &indices, const array &input, int dim=-1)
 minimum value and index found along dimension
template<typename ty >
ty min (const array &input)
 minimum value among all elements in array
template<typename ty >
void min (ty *value, int *index, const array &input)
 minimum value and index among all elements in array
array max (const array &input, int dim=-1)
 maximum of the elements along a dimension in matrix
void max (array &values, array &indices, const array &input, int dim=-1)
 maximum value and index found along dimension
template<typename ty >
ty max (const array &input)
 maximum value among all elements in array
template<typename ty >
void max (ty *value, int *index, const array &input)
 maximum value and index among all elements in array
array minmax_packed (const array &input, int dim=-1)
 minimum and maximum (packed) of the elements along a dimension in matrix
void minmax (array &minvalues, array &maxvalues, const array &input, int dim=-1)
 minimum and maximum of the elements along a dimension in matrix
template<typename ty >
ty minmax (const array &input)
 minimum (out.x) and maximum (out.y) values among all elements in array
array alltrue (const array &input, int dim=-1)
 test if all elements are true (nonzero) along a dimension in input
template<typename ty >
ty alltrue (const array &input)
 test if all elements are true (nonzero) in entire array
array allfalse (const array &input, int dim=-1)
 test if all elements are false (zero) along a dimension in input
template<typename ty >
ty allfalse (const array &input)
 test if all elements are false (zero) in entire array
array where (const array &input)
 indices where nonzero
void where (array &row, array &column, const array &input)
 row and column indices of nonzero elements in input
unsigned count (const array &input)
 count nonzero elements in input
array segsum (const array &input, const array &keys)
 Segmented sum.
array accum (const array &input, int dim=-1, af_op_t op=SUM_T, bool isupcast=false)
 accumulated sum
array avg (const array &input, int dim=-1)
 average along a dimension
template<typename ty >
ty avg (const array &input)
 average of all elements in array
array var (const array &input, bool isbiased=false, int dim=-1)
 variance along a dimension
array var (const array &input, const array weights, int dim=-1)
 weighted variance along a dimension
template<typename ty >
ty var (const array &input, bool isbiased=false)
 variance of all elements in array
template<typename ty >
ty var (const array &input, const array weights)
 weighted variance of all elements in array
array cov (const array &input, bool isbiased=false)
 covariance of row observations
array cov (const array &X, const array &Y, bool isbiased=false)
 covariance between two jointly distributed random variables
array std (const array &in, bool isbiased=false, int dim=-1)
 standard deviation along a dimension.
template<typename ty >
ty std (const array &input, bool isbiased=false)
 standard deviation of all elements in a vector.
array median (const array &input, int dim=-1)
 median along a dimension
template<typename ty >
ty median (const array &input)
 median of all elements in array
template<typename ty >
ty corrcoef (const array &x, const array &y)
 Correlation coefficient between vectors x and y.

Variables

const double nan
 representation for not-a-number
const double inf
 representation for positive infinity
const double pi
 representation for Pi (3.1415926535897931)
const cuComplex i
 representation for imaginary unit 0+1i
int end
 Reference last element in dimension.
seq span
 Reference entire dimension.

enum  af_rprops_t { AF_RP_Area = 0, AF_RP_Centroid = 1, AF_RP_Orientation = 2, AF_RP_AxisLengths = 4 }
array regions (const array &image, unsigned connectivity)
 Connected component labeling of a binary image.
array areas (const array &regions)
 Calculate area of each numbered component in regions.
array centroids (const array &regions)
 Calculate centroid of each numbered component in regions.
array moments (const array &regions, af_rprops_t property)
 Calculate property for each numbered component in regions.
void moments (array &areas, array &centroids, const array &regions)
 Calculate both area and centroid for each numbered component in regions.
void moments (array &areas, array &centroids, array &axes, array &orientations, const array &regions)
 Calculate various properties for each numbered component in regions.

Typedef Documentation

typedef struct af::timer timer

Internal timer object.


Enumeration Type Documentation

enum dtype

Tokens indicating data type.

Enumerator:
f32 

floating point (32-bit single-precision)

c32 

complex-valued floating point (32-bit single-precision real and imaginary components)

f64 

floating point (64-bit double-precision)

c64 

complex-valued floating point (64-bit double-precision real and imaginary components)

b8 

boolean (8-bit: nonzero=true, zero=false)

s32 

signed 32-bit integer

u32 

unsigned 32-bit integer

Specify which address-space pointer belongs.

Enumerator:
afDevicePointer 

Device-memory pointer.

afHostPointer 

Host-memory pointer.

Specify which sparse storage type.

Enumerator:
AF_SP_CSR 

CSR format.

AF_SP_CSC 

CSC format.

AF_SP_COO 

COO format.

enum af_op_t
Enumerator:
SUM_T 
PROD_T 

Function Documentation

array af::getrow ( int  nrows,
int *  rows_idx,
array  sp 
)
array af::getcol ( int  ncols,
int *  cols_idx,
array  sp 
)
void af::sync ( )

Block until device has finished all queued operations.

Examples:
examples/blackscholes/blackscholes.cpp, examples/misc/blas.cpp, and examples/multiGPU/multiGPU_Gemv.cpp.
array af::eval ( array  a) [inline]

Evaluate an expression (nonblocking).

Examples:
examples/blackscholes/blackscholes.cpp, and examples/misc/blas.cpp.
void af::eval ( array  a,
array  b 
) [inline]
void af::eval ( array  a,
array  b,
array  c 
) [inline]
void af::eval ( array  a,
array  b,
array  c,
array  d 
) [inline]
void af::eval ( array  a,
array  b,
array  c,
array  d,
array  e 
) [inline]
void af::eval ( array  a,
array  b,
array  c,
array  d,
array  e,
array  f 
) [inline]
bool af::gfor_toggle ( )
handle af::trimesh ( const float *  d_X,
const float *  d_Y,
const float *  d_Z,
const float *  d_C,
const unsigned  npts 
)
double af::timeit ( void(*)()  fn)

Robust timing of a function (both CPU or GPU).

Parameters:
[in]fnvoid function pointer referencing code to time.

See Timing your code for example usage.

Examples:
examples/misc/convolve.cpp, examples/misc/gfor.cpp, and examples/pi/pi.cpp.

Variable Documentation

const double nan

representation for not-a-number

const double inf

representation for positive infinity

const double pi

representation for Pi (3.1415926535897931)

Examples:
examples/pi/pi_cuda.cu, and examples/vortex/vortex.cpp.
const cuComplex i
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines