Crate arr_rs

Source
Expand description

arr-rs - implementation of multidimensional array in Rust

§Examples

// 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!("{array}");
println!("{array:#}");

// perform some chained operations on array:
let res = arr
    .map(|item| item * 2)
    .filter(|item| item % 3 == 0)
    .ravel()
    .slice(0..2);

§Crate Features

  • macros - create array macro (enabled by default)

Modules§

alphanumeric
alphanumeric module implementation
boolean
boolean module implementation
core
core functionality - common for modules
errors
array error definitions
linalg
linear algebra module implementation
macros
create array macro implementation
math
math module implementation
numeric
numeric module implementation
prelude
prelude module - imports facade

Macros§

array
Create an array
array_arange
Create new 2d array with ones on the diagonal and zeros elsewhere
array_char
Wrapper for char array_create!
array_eye
Create new 2d array with ones on the diagonal and zeros elsewhere
array_flat
Create a flat array
array_full
Create an array of fill_value
array_identity
Create new 2d array with ones on the diagonal and zeros elsewhere
array_list
Wrapper for List array_create!
array_ones
Create an array of ones
array_parse_input
Parse input string and escape special chars array creation
array_parse_shape
Calculate shape for array creation
array_rand
Create a rand array
array_single
Create a single array
array_string
Wrapper for String array_create!
array_tuple
Wrapper for Tuple array_create!
array_zeros
Create an array of zeros