Expand description
ArrayFire is a high performance software library for parallel computing with an easy-to-use API. ArrayFire abstracts away much of the details of programming parallel architectures by providing a high-level container object, the Array, that represents data stored on a CPU, GPU, FPGA, or other type of accelerator. This abstraction permits developers to write massively parallel applications in a high-level language where they need not be concerned about low-level optimizations that are frequently required to achieve high throughput on most parallel architectures. This crate provides Rust bindings for the ArrayFire library. Given below table shows the rust bindings compatability with ArrayFire upstream. If you find any bugs, please report them on github.
arrayfire-rust crate | ArrayFire Upstream |
---|---|
M.m.p1 | M.m.p2 |
Only, Major(M) & Minor(m) version numbers need to match. p1 and p2 are patch/fix updates
for arrayfire-rust
& ArrayFire
respectively, and they don’t need to match.
Please go through our tutorials book for more explanations on how to use ArrayFire to speedup your code.
Macros§
- af_
print - Print given message before printing out the Array to standard output
- constant
- Create an array of given shape filled with a single value a.k.a constant array
- dim4
- Create a dim4 object from provided dimensions
- eval
- Macro to evaluate individual Arrays or assignment operations
- join_
many - Join multiple Arrays along a given dimension
- mem_
info - Macro to print the current stats of ArrayFire’s memory manager.
- randn
- Create an array of given shape sampled from normal distribution
- randu
- Create an array of given shape sampled from uniform distribution
- seq
- Create a sequence object
- view
- Indexing into an existing Array
Structs§
- Array
- A multidimensional data container
- Callback
- Structure holding handle to callback function
- Dim4
- Dim4 is used to store Array dimensions
- Event
- RAII construct to manage ArrayFire events
- Features
- A set of Array objects (usually, used in Computer vision context)
- Indexer
- Struct to manage an array of resources of type
af_indexer_t
(ArrayFire C struct) - Random
Engine - Random number generator engine
- Seq
- Sequences are used for indexing Arrays
- Window
- Used to render Array objects
Enums§
- AfError
- Error codes
- Backend
- Compute/Acceleration Backend
- Binary
Op - Binary operation types for generalized scan functions
- Border
Type - Helps determine how to pad kernels along borders
- Canny
Threshold Type - Canny edge detector threshold operations types
- Color
Map - Dictates what color map is used for Image rendering
- Color
Space - Identify the color space of given image(Array)
- Connectivity
- Used by
regions
function to identify type of connectivity - Conv
Domain - Helps determine if convolution is in Spatial or Frequency domain
- Conv
Gradient Type - Gradient mode for convolution
- Conv
Mode - Helps determine the size of output of convolution
- Cublas
Math Mode - Gradient mode for convolution
- DType
- Types of Array data type
- Diffusion
Eq - Anisotropic diffusion flux equation types
- FluxFn
- Diffusion equation types
- Homography
Type - Homography type
- Interp
Type - Dictates the interpolation method to be used by a function
- Inverse
Deconv Algo - Inverse Deconvolution Algorithm
- Iterative
Deconv Algo - Iterative Deconvolution Algorithm
- Marker
Type - Plotting markers
- MatProp
- Helps determine the type of a Matrix
- Match
Type - Error metric used by
matchTemplate
function - Moment
Type - Image moment types
- Norm
Type - Norm type
- Random
Engine Type - Random engine types
- Scalar
- Scalar value types
- Sparse
Format - Sparse storage format type
- TopkFn
- topk function ordering
- Variance
Bias - Gradient mode for convolution
- YCCStd
- YCbCr Standards
Constants§
- DEFAULT_
RANDOM_ ENGINE - Default RandomEngine that defaults to PHILOX
- MERSENNE
- Default Mersenne RandomEngine that points to MERSENNE_GP11213
- PHILOX
- Default Philon RandomEngine that points to PHILOX_4X32_10
- THREEFRY
- Default Threefry RandomEngine that points to THREEFRY_2X32_16
Traits§
- Complex
Floating - Trait qualifier to accept complex data(numbers)
- ConfidenceCC
Input - Trait qualifier for confidence connected components input
- Const
Generator - Type Trait to generate a constant Array of given size
- Convertable
- Type Trait to convert to an Array
- Covariance
Computable - Trait qualifier for given type indicating computability of covariance
- Deconv
Input - Trait qualifier for confidence connected components input
- Edge
Computable - Trait qualifier for given type indicating if edge calculations such as derivates etc. can be performed
- Floating
Point - Trait qualifier to accept either real or complex typed data
- Fromf64
- Trait to convert reduction’s scalar output to appropriate output type
- GrayRGB
Convertible - Trait qualifier for given type indicating conversion capability between grayscale and RGB triplets of data
- HasAf
Enum - Types of the data that can be generated using ArrayFire data generation functions.
- Image
Filter Type - Trait qualifier for type of Array’s that are accepted by image processing functions especially filtering algorithms
- Image
Native Type - Trait qualifier for type of Array’s that are accepted by native image load/save functions.
- Implicit
Promote - This is an internal trait defined and implemented by ArrayFire create for rust’s built-in types to figure out the data type binary operation’s results.
- Indexable
- Trait bound indicating indexability
- Indexable
Type - Trait qualifier for the type of Arrays accepted by scan operations
- Integral
Type - Trait qualifier for given type indicating computability of covariance
- Median
Computable - Trait qualifier for given type indicating computability of Median
- Moments
Computable - Trait qualifier for given type indicating computability of Moments
- Real
Floating - Trait qualifier to accept real data(numbers)
- Real
Number - Trait qualifier indicating it can hold real numbers only
- Reduce
ByKey Input - Trait qualifier for Reduction Key type
- Scanable
- Trait qualifier for the type of Arrays accepted by scan operations
Functions§
- HANDLE_
ERROR - Default error handler for error code returned by ArrayFire FFI calls
- abs
- Computes absolute value
- accum
- Perform exclusive sum of elements along a given dimension
- acos
- Compute acos
- acosh
- Compute acosh
- add
- Addition of two Arrays
- all_
true - Find if all of the values along a given dimension in the Array are true
- all_
true_ all - Find if all values of Array are non-zero
- all_
true_ by_ key - Key based AND of elements along a given dimension
- alloc_
host - Allocates space using Arrayfire allocator in host memory
- alloc_
pinned ⚠ - Allocate non-pageable memory on HOST memory
- and
- Elementwise logical and operation of two Arrays
- anisotropic_
diffusion - Anisotropic smoothing filter
- any_
true - Find if any of the values along a given dimension in the Array are true
- any_
true_ all - Find if any value of Array is non-zero
- any_
true_ by_ key - Key based OR of elements along a given dimension
- approx1
- Perform signal interpolation for 1d signals
- approx2
- Perform signal interpolation for 2d signals
- approx1_
uniform - Perform signal interpolation for 1d signals along specified dimension
- approx1_
uniform_ v2 - Same as approx1_uniform but uses existing Array as output
- approx1_
v2 - Same as approx1 but uses existing Array as output
- approx2_
uniform - Perform signal interpolation for 2d signals along a specified dimension
- approx2_
uniform_ v2 - Same as approx2_uniform but uses existing Array as output
- approx2_
v2 - Same as approx2 but uses existing Array as output
- arg
- Computes phase value
- asin
- Compute asin
- asinh
- Compute asinh
- assign_
gen - Assign an Array to another after indexing it using any combination of Array’s and Sequence’s
- assign_
seq - Assign(copy) content of an Array to another Array indexed by Sequences
- atan
- Compute atan
- atan2
- Calculate atan2 of two Arrays
- atanh
- Compute atanh
- bilateral
- Bilateral Filter.
- bitand
- Elementwise AND(bit) operation of two Arrays
- bitnot
- Perform bitwise complement on all values of Array
- bitor
- Elementwise OR(bit) operation of two Arrays
- bitxor
- Elementwise XOR(bit) operation of two Arrays
- canny
- Canny edge detection operator
- cbrt
- Compute the cube root
- ceil
- Ceil the values in an Array
- cholesky
- Perform Cholesky decomposition
- cholesky_
inplace - Perform inplace Cholesky decomposition
- clamp
- Clamp the values of Array
- col
- Extract
col_num
col frominput
Array - color_
space - Color space conversion
- cols
- Get all cols from
first
tolast
in theinput
Array - confidence_
cc - Segment image based on similar pixel characteristics
- conjg
- Compute the complex conjugate
- constant
- Create an Array with constant value
- convolve1
- 1d convolution
- convolve2
- 2d convolution
- convolve3
- 3d convolution
- convolve2_
gradient_ nn - Backward pass gradient of 2D convolution
- convolve2_
nn - Convolution Integral for two dimensional data
- convolve2_
sep - Separable convolution for 2d signals
- corrcoef
- Compute correlation coefficient
- cos
- Compute cos
- cosh
- Compute cosh
- count
- Count number of non-zero elements along a given dimension
- count_
all - Count number of non-zero values in the Array
- count_
by_ key - Find total count of elements with similar keys along a given dimension
- cov
Deprecated - Compute covariance of two Arrays
- cov_v2
- Compute covariance of two Arrays
- cplx
- Create a complex Array from real Array
- cplx2
- Create complex array from two Arrays
- det
- Find the determinant of the matrix
- device_
count - Get total number of available devices
- device_
gc - Call the garbage collection routine
- device_
info - Gets the information about device and platform as strings.
- device_
mem_ info - Get memory information from the memory manager for the current active device
- diag_
create - Create a diagonal matrix
- diag_
extract - Extract diagonal from a given Matrix
- diff1
- Calculate first order numerical difference along a given dimension
- diff2
- Calculate second order numerical difference along a given dimension
- dilate
- Dilate an Image
- dilate3
- Dilate a Volume
- div
- Division of two Arrays
- dog
- Difference of Gaussians.
- dot
- Calculate the dot product of vectors.
- eq
- Perform
equals
comparison operation - erf
- Compute error function value
- erfc
- Compute the complementary error function value
- erode
- Erode an Image
- erode3
- Erode a Volume
- eval_
multiple - evaluate multiple arrays
- exp
- Compute e raised to the power of value
- expm1
- Compute e raised to the power of value -1
- factorial
- Compute the factorial
- fast
- Fast feature detector
- fft
- Fast fourier transform for 1d signals
- fft2
- Fast fourier transform for 2d signals
- fft3
- Fast fourier transform for 3d signals
- fft2_
c2r - 2d Complex to Real fast fourier transform
- fft2_
inplace - In place 2d dimensional Fast fourier transform
- fft2_
r2c - 2d Real to Complex fast fourier transform
- fft3_
c2r - 3d Complex to Real fast fourier transform
- fft3_
inplace - In place 3d dimensional Fast fourier transform
- fft3_
r2c - 3d Real to Complex fast fourier transform
- fft_c2r
- 1d Complex to Real fast fourier transform
- fft_
convolve1 - 1d convolution using fast-fourier transform
- fft_
convolve2 - 2d convolution using fast-fourier transform
- fft_
convolve3 - 3d convolution using fast-fourier transform
- fft_
inplace - In place 1d dimensional Fast fourier transform
- fft_r2c
- 1d Real to Complex fast fourier transform
- fir
- Finite impulse filter
- flat
- Flatten the multidimensional Array to an 1D Array
- flip
- Flip the Array
- floor
- Floor the values in an Array
- free_
host - Frees memory allocated by Arrayfire allocator in host memory
- free_
pinned ⚠ - Free the pointer returned by alloc_pinned
- gaussian_
kernel - Creates a Gaussian Kernel.
- ge
- Perform
greater than equals
comparison operation - gemm
- BLAS general matrix multiply (GEMM) of two Array objects
- get_
active_ backend - Get current active backend
- get_
available_ backends - Get the available backends
- get_
backend_ count - Get the available backend count
- get_
default_ random_ engine - Get default random engine
- get_
device - Get the current active device id
- get_
last_ error - Fetch last error description as String
- get_
mem_ step_ size - Get the minimum memory chunk size
- get_
revision - Get ArrayFire Revision (commit) information of the library.
- get_
seed - Get the seed of random number generator
- get_
size - Get size, in bytes, of the arrayfire native type
- get_
version - Get ArrayFire Version Number
- gradient
- Calculate the gradients
- gray2rgb
- Grayscale to Color(RGB) conversion
- gt
- Perform
greater than
comparison operation - hamming_
matcher - Hamming feature matcher
- handle_
error_ general - Default error handling callback provided by ArrayFire crate
- harris
- Harris corner detector.
- hist_
equal - Histogram Equalization
- histogram
- Compute Histogram of an Array
- homography
- Homography estimation
- hsv2rgb
- HSV to RGB color space conversion
- hypot
- Compute length of hypotenuse of two Arrays
- identity
- Create an identity array with 1’s in diagonal
- ifft
- Inverse fast fourier transform for 1d signals
- ifft2
- Inverse fast fourier transform for 2d signals
- ifft3
- Inverse fast fourier transform for 3d signals
- ifft2_
inplace - In place 2d dimensional inverse fast fourier transform
- ifft3_
inplace - In place 3d dimensional inverse fast fourier transform
- ifft_
inplace - In place 1d dimensional inverse fast fourier transform
- iir
- Infinite impulse response filter
- imag
- Extract imaginary values from a complex Array
- imax
- Find maximum value along given dimension and their corresponding indices
- imax_
all - Find maximum and it’s index in the whole Array
- imin
- Find minimum value along given dimension and their corresponding indices
- imin_
all - Find minimum and it’s index in the whole Array
- index
- Indexes the
input
Array usingseqs
Sequences - index_
gen - Index an Array using any combination of Array’s and Sequence’s
- info
- Print library meta-info
- info_
string - Return library meta-info as
String
- init
- Initialize ArrayFire library
- inverse
- Compute inverse of a matrix
- inverse_
deconv - Inverse deconvolution
- iota
- Create a range of values
- is_
double_ available - Check if a device has double support
- is_
eval_ manual - Get eval flag value
- is_
half_ available - Check if a device has half support
- is_
imageio_ available - Function to check if Image I/O is available
- is_
lapack_ available - Function to check if lapack support is available
- isinf
- Check if values are infinity
- isnan
- Check if values are NaN
- iszero
- Check if values are zero
- iterative_
deconv - Iterative Deconvolution
- join
- Join two arrays
- join_
many - Join multiple arrays
- le
- Perform
less than equals
comparison operation - lgamma
- Compute the logarithm of absolute values of gamma function
- load_
image - Load Image into Array
- load_
image_ native - Load Image into Array in it’s native type
- locate
- Locate the indices of non-zero elements.
- log
- Compute the natural logarithm
- log2
- Compute logarithm base 2
- log1p
- Compute the logarithm of input Array + 1
- log10
- Compute logarithm base 10
- lookup
- Lookup(hash) an Array using another Array
- lower
- Create lower triangular matrix
- lt
- Perform
less than
comparison operation - lu
- Perform LU decomposition
- lu_
inplace - Perform inplace LU decomposition
- match_
template - Image matching
- matmul
- Matrix multiple of two Arrays
- max
- Find maximum among elements of given dimension
- max_all
- Find maximum among all values of the Array
- max_
by_ key - Find maximum among values of similar keys along a given dimension
- max_
ragged - Max reduction along given axis as per ragged lengths provided
- maxfilt
- Box filter with maximum as box operation
- maxof
- Elementwise maximum operation of two Arrays
- mean
- Mean along specified dimension
- mean_
all - Compute mean of all data
- mean_
all_ weighted - Compute weighted mean of all data
- mean_
shift - Meanshift Filter.
- mean_
weighted - Weighted mean along specified dimension
- meanvar
- Calculate mean and variance in single API call
- medfilt
- Median filter
- medfilt1
- One dimensional median filter on image
- median
- Find the median along a given dimension
- median_
all - Compute median of all data
- min
- Find minimum among elements of given dimension
- min_all
- Find minimum among all values of the Array
- min_
by_ key - Find minimum among values of similar keys along a given dimension
- minfilt
- Box filter with minimum as box operation
- minof
- Elementwise minimum operation of two Arrays
- moddims
- Change the shape of the Array
- modulo
- Compute modulo of two Arrays
- moments
- Find Image moments
- moments_
all - Find Image moment for whole image
- mul
- Multiplication of two Arrays
- nearest_
neighbour - Nearest Neighbour.
- neq
- Elementwise not equals comparison of two Arrays
- norm
- Find the norm of a matrix
- or
- Elementwise logical or operation of two Arrays
- orb
- ORB feature descriptor
- pad
- Pad input Array along borders
- pinverse
- Psuedo Inverse of Matrix
- pow
- Computer power
- pow2
- Compute two raised to the power of value
- Print data in the Array
- print_
gen - Generalized Array print function
- print_
mem_ info - Print buffer details from the ArrayFire device manager
- product
- Compute product of elements along a given dimension
- product_
all - Product of all values of the Array
- product_
by_ key - Find product of all values with similar keys along a given dimension
- product_
by_ key_ nan - Compute product of all values with similar keys along a given dimension
- product_
nan - Product of elements along specific dimension using user specified value instead of
NAN
values - product_
nan_ all - Product of all values using user provided value for
NAN
- qr
- Perform QR decomposition
- qr_
inplace - Perform inplace QR decomposition
- randn
- Create random numbers from normal distribution
- random_
normal - Generate array of normal numbers using a random engine
- random_
uniform - Generate array of uniform numbers using a random engine
- randu
- Create random numbers from uniform distribution
- range
- Create a Range of values
- rank
- Find rank of a matrix
- real
- Extract real values from a complex Array
- regions
- Find blobs in given image.
- register_
error_ handler - Register user provided error handler
- rem
- Compute remainder from two Arrays
- reorder
Deprecated - Reorder the array in specified order
- reorder_
v2 - Reorder the array according to the new specified axes
- replace
- Inplace replace in Array based on a condition
- replace_
scalar - Inplace replace in Array based on a condition
- resize
- Resize an Image
- rgb2gray
- Color(RGB) to Grayscale conversion
- rgb2hsv
- RGB to HSV color space conversion
- rgb2ycbcr
- RGB to YCbCr colorspace converter.
- root
- Compute root
- rotate
- Rotate an Image
- round
- Round the values in an Array
- row
- Extract
row_num
row frominput
Array - rows
- Get an Array with all rows from
first
tolast
in theinput
Array - rsqrt
- Compute the reciprocal square root
- sat
- Summed area table of an Image
- save_
image - Save an Array to an image file
- save_
image_ native - Save an Array without modifications to an image file
- scale
- Scale an Image
- scan
- Generalized scan
- scan_
by_ key - Generalized scan by key
- select
- Element wise conditional operator for Arrays
- selectl
- Element wise conditional operator for Arrays
- selectr
- Element wise conditional operator for Arrays
- set_
backend - Toggle backends between cuda, opencl or cpu
- set_col
- Set
col_num
^th col ininout
Array to a new Arraynew_col
- set_
cols - Set cols from
first
tolast
ininout
Array with cols from Arraynew_cols
- set_
cublas_ mode - Sets the cuBLAS math mode for the internal handle.
- set_
default_ random_ engine_ type - Set the random engine type for default random number generator
- set_
device - Set active device
- set_
fft_ plan_ cache_ size - Set fft plan cache size
- set_
intersect - Find intersection of two sets
- set_
manual_ eval - Set eval flag value
- set_
mem_ step_ size - Set the minimum memory chunk size
- set_row
- Set
row_num
^th row ininout
Array to a new Arraynew_row
- set_
rows - Set rows from
first
tolast
ininout
Array with rows from Arraynew_rows
- set_
seed - Set seed for random number generation
- set_
slice - Set slice
slice_num
ininout
Array to a new Arraynew_slice
- set_
slices - Set
first
tolast
slices ofinout
Array to a new Arraynew_slices
- set_
union - Find union of two sets
- set_
unique - Find unique values from a Set
- shift
- “Circular shift of values along specified dimension
- shiftl
- Compute left shift
- shiftr
- Compute right shift
- sigmoid
- Compute sigmoid function
- sign
- Computes the sign of input Array values
- sin
- Compute sin
- sinh
- Compute sinh
- skew
- Skew an image
- slice
- Get
slice_num
^th slice frominput
Array - slices
- Get slices from
first
tolast
ininput
Array - sobel
- Sobel Operator
- solve
- Solve a system of equations
- solve_
lu - Solve a system of equations
- sort
- Sort the values in input Arrays
- sort_
by_ key - Sort the values in input Arrays
- sort_
index - Sort the values in input Arrays
- sparse
- Create sprase matrix from arrays
- sparse_
convert_ to - Convert between sparse formats
- sparse_
from_ dense - Convert dense array to sparse array
- sparse_
from_ host - Create sprase matrix from data on host memory
- sparse_
get_ col_ indices - Get cololumn indices Array
- sparse_
get_ format - Get sparse format
- sparse_
get_ info - Get sparse Array information
- sparse_
get_ nnz - Get number of non-zero elements in sparse array
- sparse_
get_ row_ indices - Get row indices Array
- sparse_
get_ values - Get values of sparse Array
- sparse_
to_ dense - Convert sparse array to dense array
- sqrt
- Compute the square root
- stdev
Deprecated - Standard deviation along specified axis
- stdev_
all - Compute standard deviation of all data
- stdev_
all_ v2 - Compute standard deviation of all data
- stdev_
v2 - Standard deviation along given axis
- sub
- Subtraction of two Arrays
- sum
- Sum elements along a given dimension
- sum_all
- Sum all values of the Array
- sum_
by_ key - Find sum of all values with similar keys along a given dimension
- sum_
by_ key_ nan - Compute sum of all values with similar keys along a given dimension
- sum_nan
- Sum along specific dimension using user specified value instead of
NAN
values - sum_
nan_ all - Sum all values using user provided value for
NAN
- susan
- SUSAN corner detector.
- svd
- Perform Singular Value Decomposition
- svd_
inplace - Perform Singular Value Decomposition inplace
- sync
- Sync all operations on given device
- tan
- Compute tan
- tanh
- Compute tanh
- tgamma
- Compute gamma function
- tile
- Tile the input array along specified dimension
- topk
- Find top k elements along a given dimension
- transform
- Transform(Affine) an Image
- transform_
coords - Transform input coordinates
- translate
- Translate an Image
- transpose
- Transpose of a matrix.
- transpose_
inplace - Inplace transpose of a matrix.
- trunc
- Truncate the values in an Array
- unwrap
- Generate an array with image windows as columns
- upper
- Create upper triangular matrix
- var
Deprecated - Compute Variance along a specific dimension
- var_all
Deprecated - Compute Variance of all elements
- var_
all_ v2 - Compute Variance of all elements
- var_
all_ weighted - Compute weighted variance of all data
- var_v2
- Compute Variance along a specific dimension
- var_
weighted - Weight variance along specified dimension
- wrap
- Converts unwrapped image to an image
- ycbcr2rgb
- YCbCr to RGB colorspace converter.
Type Aliases§
- Error
Callback - Signature of error handling callback function
- af_
array - ArrayFire FFI Type alias for af_array
- af_
event - ArrayFire FFI Type alias for af_event
- af_
features - ArrayFire FFI Type alias for af_features
- af_
index_ t - ArrayFire FFI Type alias for af_indexers_t
- af_
random_ engine - ArrayFire FFI Type alias for af_random_engine
- af_
window - ArrayFire FFI Type alias for af_window
- c32
- Short type alias for Complex single precision type
- c64
- Short type alias for Complex double precision type
- dim_t
- ArrayFire FFI Type alias for libc’s signed long long
- u64_t
- ArrayFire FFI Type alias for libc’s unsigned long long
- void_
ptr - ArrayFire FFI Type alias for libc’s void*