rust-ndarray / ndarray

ndarray: an N-dimensional array with array views, multidimensional slicing, and efficient operations

Home Page:https://docs.rs/ndarray/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there any function similar to `numpy.memmap`

Boltzmachine opened this issue · comments

I think to do this, you will need to use the memmap2 crate and unsafely create an array view over the memory map (the creation of which is already highly unsafe).

For better integration, we would need an alternative to OwnedRepr that is baked by a memory map instead a heap allocation.

Do you mean it is possible to implement this in my code through the current ndarray crate?

Yes, you can for example use e.g. ArrayView(Mut)::from_slice_ptr and MmapRaw but you wont be able to freely pass this around and instead manually need to ensure that the MmapRaw stays alive long enough so that your array views are valid.

Thanks. Will try