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

array.h File Reference

#include <cuComplex.h>
#include "dims.h"
#include "index.h"
#include "gfor.h"

Go to the source code of this file.

Classes

class  array

Namespaces

namespace  af

Defines

#define NOMINMAX
#define REST
#define group(...)
#define CONSTR(what, dims,...)
#define SELF(op)
#define BIN(op)
#define LOGIC(op)
#define COMPARISON(op)
#define GEN(what,...)
#define SPARSE(ty)
#define UNARY(fn)
#define UNARY_REAL(fn)
#define BINARY_EXTRA(fn, a, b, comment,...)
#define BINARY_NAMED(fn, a, b, comment)   BINARY_EXTRA(fn,a,b,comment,)
#define BINARY(fn, comment)
#define EXTREMUM(fn, OP)
#define print(exp)
 Show expression and its contents.

Typedefs

typedef cuDoubleComplex cuDComplex

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...

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)
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)

Define Documentation

#define NOMINMAX
#define REST
#define group (   ...)
#define CONSTR (   what,
  dims,
  ... 
)
Value:
                                 \
        template<typename ty> array(dims, const ty __VA_ARGS__);
#define SELF (   op)
#define BIN (   op)
#define LOGIC (   op)
#define COMPARISON (   op)
#define GEN (   what,
  ... 
)
#define SPARSE (   ty)
#define UNARY (   fn)
#define UNARY_REAL (   fn)
#define BINARY_EXTRA (   fn,
  a,
  b,
  comment,
  ... 
)
#define BINARY_NAMED (   fn,
  a,
  b,
  comment 
)    BINARY_EXTRA(fn,a,b,comment,)
#define BINARY (   fn,
  comment 
)
#define EXTREMUM (   fn,
  OP 
)

Typedef Documentation

typedef cuDoubleComplex cuDComplex
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines