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.43k stars 295 forks source link

Implementation of numpy's meshgrid function for ndarray #1355

Open jreniel opened 5 months ago

jreniel commented 5 months ago

I have made an attempt to try to replicate the core functionality of numpy's meshgrid function, using ndarray. My attempt, which seems to be yielding identical results to the numpy version is hosted here.

My hope is that this function, or an equivalent, makes it to ndarray, since I feel like meshgrid is one of those core numpy functions that we tend to use repeatedly in my field, and it would be an invaluable addition to the ndarray crate.

To be clear, I'm asking to not necessarily use the same function that I've posted here, I'll be happy too if the ndarray devs implement a better solution. All I would like to see is to have this function be a part of the ndarray collection of functions.