ndarray icon indicating copy to clipboard operation
ndarray copied to clipboard

Support for no alloc

Open vadixidav opened this issue 4 years ago • 5 comments

This may seem like a strange ask, but in the computer vision community we are currently working on trying to develop an abstraction over various color models for images. A very effective way to work with images is to create ArrayView2 for each layer/channel of the image, especially for images which have interpolated components (like YUV420). At least one person (@astraw) in the Rust CV org is working with microcontrollers where alloc is not currently available. Since we are only interested in ArrayView2 specifically, we theoretically should be able to use that without alloc, but currently ndarray unconditionally brings in the alloc crate.

So, the ask is this: if I put in the work and set up a PR, can we add a new alloc feature, where without that feature extern crate alloc; is gated out, and all of the types which require alloc (like Array2) are no longer included? Thanks!

vadixidav avatar Jul 30 '21 05:07 vadixidav

I'm facing similar problem. Did you ever make progress with some no alloc feature gate?

vhakulinen avatar Dec 28 '21 10:12 vhakulinen

No, I was hoping to get a response here first from a maintainer before proceeding with work on this.

vadixidav avatar Dec 28 '21 17:12 vadixidav

I'm doing some research on the topic, and fwiw, nalgebra seems to have support for statically sized arrays (based on documentation at least).

vhakulinen avatar Dec 29 '21 09:12 vhakulinen

Yes, nalgebra is fine for this. The cam-geom crate, for example uses nalgebra and compiles e.g. on the target thumbv7em-none-eabihf which has no alloc available. This is run git the github CI actions if you want to have a look or of course you can download it yourself.

astraw avatar Dec 29 '21 14:12 astraw

Any news on this? :)

steckes avatar Jun 08 '23 15:06 steckes