Crates.io | arr-rs |
lib.rs | arr-rs |
version | 0.6.0 |
source | src |
created_at | 2023-02-24 11:10:52.591868 |
updated_at | 2023-10-31 20:38:18.482457 |
description | arr-rs - rust arrays library |
homepage | https://github.com/pw-order-of-devs |
repository | https://github.com/pw-order-of-devs/arr-rs |
max_upload_size | |
id | 793477 |
size | 697,088 |
Implementation of numpy-inspired multidimensional, generic arrays.
Documentation of the crate is available here
[dependencies]
arr-rs = "0.6.0"
// import the crate
use arr_rs::prelude::*;
// create an array: (4 elements, 2 dimensions)
let arr = Array::<i32>::new(vec![1, 2, 3, 4], vec![2, 2]);
// create same array using macro:
let arr: Array::<i32> = array!([[1, 2], [3, 4]]);
// create random array with the same shape:
let arr = Array::<i32>::rand(vec![2, 2]);
// array supports display and pretty display
let arr: Array<f64> = array!([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);
println!("{arr}");
println!("{arr:#}");
// perform some chained operations on array:
let res = arr
.map(|item| item * 2)
.filter(|item| item % 3 == 0)
.ravel()
.slice(0..2);
Benchmark results can be found here
This project is licensed under either of the following licenses, at your option: