Expand description
Provides a generic one-dimensional Array which wraps arrayfire::Array and supports
all number_general::NumberType variants. Array and ArrayExt support basic math like
Add, Sub, Mul, Div, and Rem, with hardware acceleration on systems which support CUDA
or OpenCL. ArrayExt<bool> supports common logical operations and, not, or, and xor.
N-dimensional array functionality can be implemented using Coords and Offsets, which
provide methods for indexing a one-dimensional Array or ArrayExt as an n-dimensional
tensor.
Array supports (de)serialization without type hinting. ArrayExt<T> supports serialization
for T: Serialize and deserialization for T: Deserialize.
Example usage:
let a = [1, 2, 3];
let b = [5];
let product = &Array::from(&a[..]) * &Array::from(&b[..]);
assert_eq!(product, Array::from_iter(vec![5, 10, 15]));
assert_eq!(product.sum(), Number::from(30))This crate depends on ArrayFire version 3.8. You will have to install ArrayFire separately by following the instructions at https://arrayfire.org/docs/installing.htm in order to build this crate.
You can find detailed instructions for building the Rust arrayfire crate from crates.io at
https://crates.io/crates/arrayfire.
Structs§
- Aggregate
- Aggregate a
Streamof numbers into aStreamofArrayExts. - Array
Error - The error type used for Array which may fail recoverably.
- Array
Ext - A wrapper around
af::Arraywhich defines common operations. - Coord
Blocks - A
StreamofCoords, as constructed from an input stream ofCoords. - Coord
Merge - Stream for merging two sorted
CoordBlocksstreams. - Coord
Unique - Return only the unique coordinates from a sorted stream of
Coords. - Coords
- A hardware-accelerated set of n-dimensional coordinates, all with the same dimension.
- Resize
- Struct for the
ArrayTryStream::resizemethod.
Enums§
- Array
- A generic one-dimensional array which supports all variants of
NumberType.
Traits§
- Array
Instance - Defines common access methods for instance of
ArrayExt. - Array
Instance Abs - Defines an absolute value method
abs. - Array
Instance AnyAll - Defines cumulative boolean operations
anyandall. - Array
Instance Compare - Defines element-wise comparison operations.
- Array
Instance Index - Indexing operations for
ArrayExt - Array
Instance Log - Defines a general logarithm.
- Array
Instance MinMax - Defines common reduction operations
minandmax. - Array
Instance Natural Log - Defines the natural logarithm.
- Array
Instance Pow - Defines an exponentiation method
pow. - Array
Instance Product - Defines common reduction operation
product. - Array
Instance Round - Defines a rounding method
round. - Array
Instance Sum - Defines common reduction operation
sum. - Array
Instance Trig - Array
Instance Unreal - Methods to check for infinite or non-numeric array elements.
- Array
MinMax TryStream - Trait to reduce the sum of a
StreamofArrayExts. - Array
Product TryStream - Trait to reduce the product of a
StreamofArrayExts. - Array
SumTry Stream - Trait to reduce the sum of a
StreamofArrayExts. - Array
TryStream - Methods for handling a
StreamofArrayExts. - HasArray
Ext - Convenience methods defining the base value of a reduce operation on an
ArrayExt. - Max
- Trait defining the maximum of two numbers.
- Min
- Trait defining the minimum of two numbers.
- Product
- Trait defining the product of two numbers.
- Sum
- Trait defining the sum of two numbers.
Functions§
- coord_
to_ offset - Convert a coordinate to a linear offset.
- print_
af_ info - Call
arrayfire::info. - product_
dtype - The
NumberTypeof the product of anArraywith the givenarray_dtype. - reduce_
max - Compute the maximum of each
strideof aStreamofArrays. - reduce_
min - Compute the minimum of each
strideof aStreamofArrays. - reduce_
product - Compute the product of each
strideof aStreamofArrays. - reduce_
sum - Compute the sum of each
strideof aStreamofArrays. - sum_
dtype - The
NumberTypeof the sum of anArraywith the givenarray_dtype.
Type Aliases§
- Complex
- A complex number (an alias for
num_complex::Complex. - Coord
- An n-dimensional coordinate.
- Offsets
- One-dimensional array indices corresponding to n-dimensional coordinates.
- Result
- The result of an
Arrayoperation which may fail recoverably.