Numeric Rust
N-dimensional matrix class for Rust 1.0. It links to OpenBLAS and LAPACK to make tensor operations fast (such as matrix multiplications and linear solvers). It utilizes Rust's move semantics as much as possible to avoid unnecessary copies.
Documentation
Features
Some of the completed and planned features:
- Element-wise addition, subtraction, multiplication, division
- Matrix multiplication and scalar product
- Indexing
- Slicing
- Generic (anything from
Tensor<bool>
toTensor<f64>
) - Mathematical functions
- Linear solver
- Basic random number generation
- Creation macro
- Updating slices
- Strided slices
- Broadcasted axes
- Matrix inverse and SVD
Example
extern crate numeric;
use Tensor;
Output:
d =
7 4 4
0 6 0
[Tensor<f64> of shape 2x3]
e =
7 43
[Tensor<f64> of shape 2]
f =
7 4 4
0 6 0
[Tensor<f64> of shape 2x3]
g =
...
[Tensor<f64> of shape 2x3x4x5]
Acknowledgement
Borrowing shamelessly from the great projects Numpy and Torch7.