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
Stream
of numbers into aStream
ofArrayExt
s. - Array
Error - The error type used for Array which may fail recoverably.
- Array
Ext - A wrapper around
af::Array
which defines common operations. - Coord
Blocks - A
Stream
ofCoords
, as constructed from an input stream ofCoord
s. - Coord
Merge - Stream for merging two sorted
CoordBlocks
streams. - 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::resize
method.
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
any
andall
. - 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
min
andmax
. - 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
Stream
ofArrayExt
s. - Array
Product TryStream - Trait to reduce the product of a
Stream
ofArrayExt
s. - Array
SumTry Stream - Trait to reduce the sum of a
Stream
ofArrayExt
s. - Array
TryStream - Methods for handling a
Stream
ofArrayExt
s. - 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
NumberType
of the product of anArray
with the givenarray_dtype
. - reduce_
max - Compute the maximum of each
stride
of aStream
ofArray
s. - reduce_
min - Compute the minimum of each
stride
of aStream
ofArray
s. - reduce_
product - Compute the product of each
stride
of aStream
ofArray
s. - reduce_
sum - Compute the sum of each
stride
of aStream
ofArray
s. - sum_
dtype - The
NumberType
of the sum of anArray
with 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
Array
operation which may fail recoverably.