| |
- RTE(...)
- abs(...)
- acos(...)
- acosh(...)
- allfalse(...)
- Check if all the elements in the array along the given dimension are zero
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.allfalse(a, 1)
- alltrue(...)
- Check if all the elements in the array along the given dimension are non zero
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.alltrue(a, 1)
- areas(...)
- Get areas of regions in an image
Parameters:
-----------
image: Supports {Arrayfire array}
The input image. This is the output of regions function.
Usage:
------
img = scipy.misc.imread(img_name)
I = af.array(img)
R = af.regions(I)
A = af.areas(R)
- arrows(...)
- Plot of velocity fields
Parameters:
----------
x: Supports {array}
Locations along x axis
y: Supports {array}
Locations along y axis
u: Supports {array}
Velocities along x axis
v: Supports {array}
Velocities along y axis
- asin(...)
- asinh(...)
- atan(...)
- atanh(...)
- avg(...)
- Average of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.avg(a, 1)
- ceil(...)
- centroids(...)
- Get centroids of regions in an image
Parameters:
-----------
image: Supports {Arrayfire array}
The input image. This is the output of regions function.
Usage:
------
img = scipy.misc.imread(img_name)
I = af.array(img)
R = af.regions(I)
A = af.centroids(R)
- cholesky(...)
- Cholesky decomposition of input
Usage:
------
A = af.randu(5, 5)
P = A + A.T() + af.identity(5) * 10.0 # Generate positive definite
C = af.cholesky(P)
- complex(...)
- conj(...)
- convolve(...)
- Signal / Image Convolution
Parameters:
-----------
signal: Supports {Arrayfire array}
The input signal
kernel: Supports {Arrayfire array}
The kernel for convolution
mode: Supports {str}, Default: full
Convolution mode. Options: {full, same, valid}
Usage:
------
img = scipy.misc.imread(image_name)
tmp = scipy.misc.imread(template_name)
signal = af.array(img)
kernel = af.array(tmp)
result = af.convolve(signal, kernel)
- convolve2(...)
- Seperable Convolution
Parameters:
-----------
x: Supports {Arrayfire array}
The horizontal kernel
y: Supports {Arrayfire array}
The vertical kernel
signal: Supports {Arrayfire array}
The input signal
mode: Supports {str}, Default: full
Convolution mode. Options: {full, same, valid}
Usage:
------
img = scipy.misc.imread(image_name)
tmp = scipy.misc.imread(template_name)
signal = af.array(img)
kernel = af.array(tmp)
result = af.convolve(signal, kernel)
- cos(...)
- cosh(...)
- current(...)
- Get the current device number
Usage:
------
curr_device = af.current()
- devices(...)
- Get the number of devices
Usage:
------
num_devices = af.devices()
- diagonal(...)
- Extract the diagonal of a matrix
Usage:
------
a = af.randu(5,5)
b = diagonal(a)
- diff1(...)
- First order differentiation
Parameters:
-----------
data: Supports {array}
The input arrayfire array
dim: Supports {int, long}, Default: 0
The dimension along which the differentiation is perfomed
Usage:
------
a = af.randu(5,5)
b = diff1(a, 0)
c = diff1(a, 1)
- diff2(...)
- Second order differentiation
Parameters:
-----------
data: Supports {array}
The input arrayfire array
dim: Supports {int, long}, Default: -1
The dimension along which the differentiation is perfomed
Usage:
------
a = af.randu(5,5)
b = diff2(a, 0)
c = diff2(a, 1)
- dilate(...)
- Image dilation
Parameters:
-----------
image: Supports {Arrayfire array}
The image to be dilated
kernel: Supports {Arrayfire array}
The kernel for dilating
Usage:
------
img = af.randu(1024, 1024)
ker = af.ones(3, 3)
res = af.dilate(img, ker)
- eigen(...)
- Eigen value decomposition of input
Usage:
------
A = af.randu(5,5)
eigvals = af.eigen(A)
- erf(...)
- erode(...)
- Image erosion
Parameters:
-----------
image: Supports {Arrayfire array}
The image to be eroded
kernel: Supports {Arrayfire array}
The kernel for eroding
Usage:
------
img = af.randu(1024, 1024)
ker = af.ones(3, 3)
res = af.erode(img, ker)
- eval(...)
- Force evaluation (Do not wait for lazy evaluation)
Usage:
------
x = af.randu(100000,1)
y = af.randu(100000,1)
af.tic()
z = af.sin(af.mul(x, x)) + af.cos(af.mul(y,y))
# Use eval and sync while benchmarking only
af.eval(z) # Force evaluation
af.sync() # Wait for syncronization
elapsed = af.toc() #
- exp(...)
- fft(...)
- Fast fourier transform (1D)
Parameters:
-----------
signal: Supports {Arrayfire array}
The input signal
n: Supports {int, long}, Default: 0
Size of output signal. (0 meaning, dont change)
Usage:
------
a = af.randu(1000, 1)
b = af.fft(a)
c = af.fft(a, 1024) # Pad input to size 1024
- fft2(...)
- Fast fourier transform (1D)
Parameters:
-----------
signal: Supports {Arrayfire array}
The input signal
m: Supports {int, long}, Default: 0
Rows in output signal. (0 meaning, dont change)
n: Supports {int, long}, Default: 0
Columns in output signal. (0 meaning, dont change)
Usage:
------
a = af.randu(500, 500)
b = af.fft2(a)
c = af.fft2(a, 512, 512) # Pad input to size 512x512
- filter(...)
- Image filtering
Parameters:
-----------
image: Supports {Arrayfire array}
The image to be filtered
kernel: Supports {Arrayfire array}
The kernel for filtering
Usage:
------
img = af.randu(1024, 1024)
k = np.array([1. 0. -1.])
ker = af.array(k)
res = af.filter(img, ker)
- fir(...)
- Finite impulse response filter
Parameters:
-----------
kernel: Supports {Arrayfire array}
The kernel for filtering
signal: Supports {Arrayfire array}
The input signal
Usage:
------
ker = af.randu(100, 1)
sig = af.randu(10000, 1)
res = af.fir(ker, sig)
- flat(...)
- Flatten the input array
- fliph(...)
- Flip a matrix vertically
Usage:
------
a = af.randu(5,5)
b = flipv(a)
- flipv(...)
- Flip a matrix horizontally
Usage:
------
a = af.randu(5,5)
b = fliph(a)
- floor(...)
- grid(...)
- Generate a grid from x and y values
Parameters:
-----------
xvals: Supports {array}
The range of the first dimension
yvals: Supports {array}
The range of the second dimension
Usage:
------
xvals = af.range(10)
yvals = af.range(10, 20)
X,Y = grid(xvals, yvals)
- hessenberg(...)
- Hessenberg factorization of input
Usage:
------
A = af.randu(5,5)
H = af.hessenberg(A)
- histogram(...)
- Image histogram
Parameters:
-----------
image: Supports {Arrayfire array}
The input image
bins: Supports {int, long}, Default: 32
The desired number of bins
mn: Supports {float, double}, Default: None
The lower limit for bin centroids (uses min(image) if None)
mx: Supports {float, double}, Default: None
The upper limit for bin centroids (uses max(image) if None)
Usage:
------
img = af.randu(1024, 1024)
res = af.histogram(img) # Histogram of 32 bins
res = af.histogram(img, 100) # Histogram of 100 bins
res = af.histogram(img, 100, 0.0, 255.0)
- identity(...)
- Generate an identity matrix
Prameters:
---------
x: Supports {int, long}, Default: 1
Number of rows for output array
y: Supports {int, long}, Default: 1
NUmber of columns for output array
dtype: Supports {str}, Default: float32
Datatype of output array
Usage:
-----
a = af.identity(x,y)
- ifft(...)
- Inverse fast fourier transform (1D)
Parameters:
-----------
signal: Supports {Arrayfire array}
The input signal
n: Supports {int, long}, Default: 0
Size of output signal. (0 meaning, dont change)
Usage:
------
a = af.randu(1000, 1)
b = af.ifft(a)
c = af.ifft(a, 1024) # Pad input to size 1024
- ifft2(...)
- Inverse, fast fourier transform (1D)
Parameters:
-----------
signal: Supports {Arrayfire array}
The input signal
m: Supports {int, long}, Default: 0
Rows in output signal. (0 meaning, dont change)
n: Supports {int, long}, Default: 0
Columns in output signal. (0 meaning, dont change)
Usage:
------
a = af.randu(500, 500)
b = af.ifft2(a)
c = af.ifft2(a, 512, 512) # Pad input to size 512x512
- iir(...)
- Infinite impulse response filter
Parameters:
-----------
feedback: Supports {Arrayfire array}
Feedback kernel
feedfwd: Supports {Arrayfire array}
Feedforward kernel
signal: Supports {Arrayfire array}
The input signal
Usage:
------
bak = af.randu(100, 1)
fwd = af.randu(100, 1)
sig = af.randu(10000, 1)
res = af.iir(bak, fwd, sig)
- imag(...)
- imgplot(...)
- Display a Grayscale image
Usage:
------
img = scipy.misc.imread(image_name)
imgarr = af.array(img)
imgplot(imgarr)
- info(...)
- Display device and install information
Usage:
------
af.info()
- inv(...)
- Inverting a square matrix
Usage:
-----
A = af.randu(5, 5)
IA = af.inv(A)
- log(...)
- lower(...)
- Extract the lower triangle of a matrix
Usage:
------
a = af.randu(5,5)
b = lower(a)
- lu(...)
- LU factorization of input
Usage:
------
A = af.randu(5,5)
LU = af.lu(A)
- max(...)
- Maximum of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.max(a, 1)
- medfilt(...)
- Median filter of an image
Parameters:
-----------
image: Supports {Arrayfire array}
The input image
m: Supports {int, long}, Default: 3
The filter height
n: Supports {int, long}, Default: 3
The filter width
Usage:
------
img = scipy.misc.imread(img_name)
I = af.array(img)
Res_33 = af.medfilt(I) # 3x3 median filter
Res_55 = af.medfilt(I, 5, 5) # 5x5 median filter
- median(...)
- Median of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.median(a, 1)
- min(...)
- Minimum of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.min(a, 1)
- mpow(...)
- matrix power of input
Usage:
------
A = af.randu(5, 5)
e = 2.0
F = mpow(A, e)
- mul(...)
- Element wise multiplication of two objects
Parameters:
-----------
left: Supports {array}
An arrayfire array class object
right: Supprts {array, int, float, long, double)
An arrayfire array or a regular scalar
Usage:
-----
a = af.randu(5, 5)
b = af.randu(5, 5)
c = mul(a, b) # multiply two arrays
d = mul(c, 0.35) # multiply an array and a scalar
- ones(...)
- Generate an array of all ones
Prameters:
---------
x: Supports {int, long}, Default: 1
Number of rows for output array
y: Supports {int, long}, Default: 1
NUmber of columns for output array
dtype: Supports {str}, Default: float32
Datatype of output array
Usage:
-----
a = af.ones(x,y)
- pinv(...)
- Pseudoinverse of a rectangular input
Usage:
------
A = af.randu(5, 3)
P = af.pinv(A)
- plot(...)
- Line plot of the input data
Usage:
------
data = af.randu(5, 5)
plot(data)
- plot3d(...)
- Surface plot of input data
Usage:
------
data = af.randu(5, 5)
plot3d(data)
- points(...)
- 3D Scatter plot
Parameters:
----------
x: Supports {array}
Locations along x axis
y: Supports {array}
Locations along y axis
y: Supports {array}
Locations along z axis
Usage:
------
x = af.randu(5,1)
y = af.randu(5,1)
z = af.randu(5,1)
points(x, y, z)
- pow(...)
- prod(...)
- Product of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.prod(a, 1)
- qr(...)
- QR decomposition of input
Usage:
------
A = af.randu(5,5)
QR = af.lu(A)
- randn(...)
- Generate an array from normal random distribution
Prameters:
---------
x: Supports {int, long}, Default: 1
Number of rows for output array
y: Supports {int, long}, Default: 1
NUmber of columns for output array
dtype: Supports {str}, Default: float32
Datatype of output array
Usage:
-----
a = af.randn(x,y)
- randu(...)
- Generate an array from uniform random distribution
Prameters:
---------
x: Supports {int, long}, Default: 1
Number of rows for output array
y: Supports {int, long}, Default: 1
NUmber of columns for output array
dtype: Supports {str}, Default: float32
Datatype of output array
Usage:
-----
a = af.randu(x,y)
- range(...)
- Generates a range of values
Usage:
------
a = af.range(10) # Generate numbers between 0 (inclusive) and 10 (exclusive)
b = af.range(10, 20) # Generate numbers between 10 (inclusive) and 20 (exclusive)
c = af.range(100, 1000, 200) # Generate the numbers between 100 and 1000 in steps of 200
- rank(...)
- Rank of the input matrix
Usage:
------
a = af.randu(5, 3)
b = af.rank(af)
- real(...)
- regions(...)
- Get regions in an image
Parameters:
-----------
image: Supports {Arrayfire array}
The input image
conn: Supports {int}, Default: 4
Neighborhood connectivity. Has to be 4 or 8.
Usage:
------
img = scipy.misc.imread(img_name)
I = af.array(img)
R1 = af.regions(I)
R2 = af.regions(I, 8)
- resize(...)
- Image resizing
Parameters:
-----------
image: Supports {Arrayfire array}
The image to be resized
scale: Supports {float, double}
The scale factor
Usage:
------
img = af.randu(1024, 1024)
scale = 0.5
res = af.resize(img, scale)
- rotate(...)
- Image rotation
Parameters:
-----------
image: Supports {Arrayfire array}
The image to be rotated
angle: Supports {float, double}
The angle of rotation (in radians)
Usage:
------
img = af.randu(1024, 1024)
angle = 45 * PI / 180
res = af.rotate(img, angle)
- round(...)
- select(...)
- Select a specified device
Usage:
------
af.select(curr_device + 1)
- shift(...)
- Shift the rows and columns of input array
Parameters:
-----------
data: Supports {array}
The input arrayfire array
m: Supports {int, long}
Shifts along the first dimension
n: Supports {int, long}, Default: 1
Shifts along the second dimension
Usage:
------
a = af.randu(5,5)
b = shift(a, 3)
c = shift(a, 4, 4)
- sin(...)
- sinh(...)
- solve(...)
- Solve a system of equations AX=B
Parameters:
----------
A: Supports{array}
State matrix for the set of equations
B: Supports{array}
Observed results for the set of equations
Usage:
------
A = af.randu(5,5)
X0 = af.randu(5,1)
B = A * X0
X = solve(A, B)
af.max(af.abs(X - X0)) # Displays error
- sort(...)
- Sort the input array
Parameters:
-----------
data: Supports {array}
The input arrayfire array
dim: Supports {int, long}, Default: -1
The dimension along which array needs to be sorted
desc: Supports {bool, int, long}, Default: False
True (non zero) if sort needs to be in descending order
Usage:
------
a = af.randu(5,5)
b = sort(a) # Ascending sort along first non-singleton
c = sort(a, 1) # Ascending sort along the rows
d = sort(a, 0, True) # Descending sort along the columns
- sqrt(...)
- sum(...)
- Sum of elements in the array along the given dimension
Parameters:
-----------
a: Supports {array}
The input array
dim: Supports {int, long}, Default: -1
The dimension along which the reduction takes place
Usage:
------
a = af.randu(5, 3)
b = af.sum(a, 1)
- svd(...)
- Singular value decomposition of input
Usage:
------
A = af.randu(5, 5)
S = svd(A)
- sync(...)
- Force evaluation (Do not wait for lazy evaluation)
Usage:
------
x = af.randu(100000,1)
y = af.randu(100000,1)
af.tic()
z = af.sin(af.mul(x, x)) + af.cos(af.mul(y,y))
# Use eval and sync while benchmarking only
af.eval(z) # Force evaluation
af.sync() # Wait for syncronization
elapsed = af.toc() #
- tan(...)
- tanh(...)
- tic(...)
- Starts a timer
Returns:
--------
A handle of the timer
Usage:
------
a = af.tic()
- tile(...)
- Create tiles of the input data
Parameters:
-----------
data: Supports {array}
The input arrayfire array
m: Supports {int, long}
Tiles along the first dimension
n: Supports {int, long}, Default: 1
Tiles along the second dimension
Usage:
------
a = af.randu(5,5)
b = tile(a, 3) # b is now 15 x 5
c = tile(a, 4, 4) # C is now 20 x 20
- toc(...)
- Stop a timer, return elapsed time
Parameters:
-----------
val: Supports {long}, Default: None
val should be handle returned by af.tic()
Returns:
--------
Elapsed time
Usage:
------
a = af.randu(1024, 1024)
b = af.randu(32, 32)
af.tic()
c = af.convolve(a, b)
elapsed = af.toc()
- upper(...)
- Extract the upper triangle of a matrix
Usage:
------
a = af.randu(5,5)
b = upper(a)
- zeros(...)
- Generate an array of all zeros
Prameters:
---------
x: Supports {int, long}, Default: 1
Number of rows for output array
y: Supports {int, long}, Default: 1
NUmber of columns for output array
dtype: Supports {str}, Default: float32
Datatype of output array
Usage:
-----
a = af.zeros(x,y)
|