GitXplorerGitXplorer
L

mudi

public
4 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
9ed2042c93f5920f8e1a67990f70b7d8c4210215

Add badges to README

committed 9 years ago
Unverified
d3be343d8c14b967d4d10b9a442703b909d29e81

Build and push docs on travis

committed 9 years ago
Unverified
37c10b455c0f99524af52a30cc1f8923d85e982d

Improve documentation and add README/LICENSE

committed 9 years ago
Unverified
ddef9f37c6eed1e9c80db01741b835464fdf6492

Implement Dimensions up to 7-dimensional tuple

committed 9 years ago
Unverified
0a1d49637c78749ffaa70153faac4680798ead9e

array! macro to be used like vec!

committed 9 years ago
Unverified
324bb8ab908eb5dde5a4023a7cb1bd166277a177

Better out of bounds messages

committed 9 years ago

README

The README file for this repository.

Mudi: Rust multi-dimensional arrays

Build Status Code Coverage

Mudi provides multi-dimensional arrays to store data. The aim of this library is not to provide complex algorithms, but powerful indexing scheme. The Mudi array type is closer to a Fortran array than to Numpy's ndarray.

For example, Mudi allow to use range dimensions (10..30 or even -42..42) and negative indexing for negatives ranges.

Creating arrays

The array! macro can be used to create an array. It is used like the standard vec! macro, but with an addition dimensions parameter.

#[macro_use]
extern crate mudi;

// Create a 3-dimensional array, filled with 0
let a = array!(0.0; (3, 4, -10..10));

// Create a 2-dimensional array, with values from the list
let a = array!(1.0, 0.0, 0.0, 0.0,
               0.0, 2.0, 1.0, 0.0,
               0.0, 0.0, 3.0, 0.0,
               0.0, 0.0, 0.0, 4.0; (4, 4));

Dimensions and indexing

Dimensions are represented by tuples of either single usize value, or ranges. 3 and 10..30 are dimensions for 1-dimensional arrays, and (3, 4, 5) or (-20..20, 5, 6..8) are dimensions for 3-dimensional arrays. Indexing is implemented for tuple dimensions up to 7-dimensional arrays.

let mut a = array!(0.0; (3, 4, -10..10));

// Use tuples for indexing
assert_eq!(a[(0, 0, 0)], 0.0);
// Negatives indexes in negative range dimensions
a[(1, 2, -6)] = 42.0;
assert_eq!(a[(1, 2, -6)], 42.0);

License

Mudi is licensed under either of Apache License Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.