NumRst
NumRst is a Rust implementation of multi-dimensional arrays (NdArray) and numerical computation, inspired by NumPy.
It provides a rich set of numerical operations, including broadcasting, indexing, matrix operations, reductions, logical and comparison ops, aiming to build a high-performance numerical computing tool in the Rust ecosystem.
🚀Features
-
Data types supported:
Bool, U8, I8, U16, I16, U32, I32, USize, F32, F64 -
Operators & Arithmetic:
- Basic ops:
+ - / minimum maximum - Comparison:
eq ne lt le gt ge - Logic:
and or xor - Float functions:
exp sin cos sqrt tanh floor ceil round abs neg ln
- Basic ops:
-
NdArray operations:
- Shape manipulation:
reshape,transpose,squeeze,unsqueeze,narrow,narrow_range,repeat,flatten,split - Concatenation/stacking:
cat,stack
- Shape manipulation:
-
Broadcasting: NumPy-like broadcasting (
broadcast_add,broadcast_sub, etc.) -
Reductions:
- Global:
sum,product,min,max,mean,var,std - Along axis:
sum_axis,max_axis,argmax_axis, etc.
- Global:
-
Array creation:
zeros,ones,arange,rand,randn,trues,falsesfrom_vec,full,new
-
Indexing & slicing:
- Single index:
arr.index(2)? - Range:
arr.index(rng!(1:3))? - Mixed multi-dim:
arr.index((rng!(1:3), .., 1..2))?
- Single index:
-
Matrix operations:
matmul
-
File format:
- Support operate with .npy and .npz
- Custom file format .nrst and .nrsz
-
View:
- Matrix view:
MatrixViewandMatrixViewMut - Matrix view:
MatrixViewandMatrixViewMut - Unsafe view:
MatrixViewUsfandVectorViewUsfare unsafe view, use ptr as storage
- Matrix view:
-
Linear algebra:
- basic:
dot,matmul,trace,det,rank - norm: frobenius, infinity, spectral, nuclear, pl
- decompose:
lu,qr,cholesky,bidiagonal - solve:
lu,qr,cholesky,eig(only support symmetric),svd - inv:
plu_inv,qr_inv,cholesky_invandinv(using solve)
- basic:
Quick Start
use *;
License
MIT