rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations
https://docs.rs/ndarray/
Apache License 2.0
3.44k stars 296 forks source link

Provide more direct mutable access to shape, strides, and owned Vec #429

Open jturner314 opened 6 years ago

jturner314 commented 6 years ago

It would useful in some cases to have more direct mutable access to the shape, strides, and data representation. This could be resolved with setters that perform safety checks instead of just providing &mut references to the fields themselves. See #425, in particular this comment for some ideas. This does warrant some more discussion, so I'm creating this issue.

bluss commented 6 years ago

Vec -> We have a hard time exposing a Vec by reference. Ideally we should be able to use our own allocator (let's imagine one where we could request a 64-byte alignment for the data, or something like that).

Sounds good. With strides we have the issue of moving to the more type correct isize values for strides. (What we have today is isize values stored in usize memory.)