A high-performance scientific computation library written in Rust.
This getting started guide might change and should not be a source of absolute truth. Check the unit tests if you want to stay up to date with how things should be done. Some APIs will definetely be changed in the future.
[dependencies]
numru = "0.1.0"
And a simple code:
fn main() {
let a = array![1, 2, 3];
println!("{:?}", a);
let b = array![
[ [1,1,1], [2,2,2] ],
[ [3,3,3], [4,4,4] ]
];
println("{:?}", b);
}
Numru will offer a variety of different numerical operations and data types. It is intended to be a fundamental library for scientific computing with Rust.
- i64
- f64
- i8, i16, i32, i128
- u8, u16, u32, u64, u128
- f32
- bool
- String, &str
Note that currently we only show the numru equivalents as the ones that are planned. They do not exist yet.
Operation | NumPy Equivalent | Numru Equivalent |
---|---|---|
Create Array | np.array([1, 2, 3]) or np.array([ [1,2,3], [1,2,3], [[4,5,6], [4,5,6]] ]) |
array![1, 2, 3] or array![ [[1,2,3], [1,2,3]], [[4,5,6], [4,5,6]] ] |
Zeros Array | np.zeros((3, 3, 3)) |
zeros!(3, 3, 3) or a.zeros() |
Ones Array | np.ones((3, 3, 3)) |
ones!(3, 3, 3) or a.ones() |
Arange | np.arange(start, stop, step) |
arange!(start, stop, step) |
Linspace | np.linspace(start, stop, num) |
🚧 |
Mean | np.mean(a) |
a.mean() |
Min | np.min(a) |
a.min() |
Max | np.max(a) |
a.max() |
Exp | np.exp(a) |
🚧 |
Log | np.log(a) |
🚧 |
Sigmoid | 1 / (1 + np.exp(-a)) |
🚧 |
Dot Product | np.dot(a, b) |
dot!(a, b) |
Reshape | a.reshape((4, 3, 3)) |
a.reshape(4, 3, 3) |
Concatenate | np.concatenate([a, b], axis=0) |
🚧 |
Element-wise Add | a + b |
a + b |
Element-wise Sub | a - b |
a - b |
Element-wise Mul | a * b |
a * b |
Element-wise Div | a / b |
a / b |
Fancy Indexing | np.ones((3, 3, 3))[0, :] |
🚧 |
Fancy Flipping | np.array([1, 2, 3])[::-1] |
🚧 |
The MIT License.