On Fri, Feb 2, 2024 at 6:34 AM Stephan Kuschel via NumPy-Discussion < numpy-discussion@python.org> wrote:
All the Best
Stephan
_______________________________________________ NumPy-Discussion mailing li
Dear Community,
For my own work, I required the intersect1d function to work on multiple arrays while returning the indices (using `return_indizes=True`). Consequently I changed the function in numpy and now I am seeking feedback from the community.
This is the corresponding PR: https://github.com/numpy/numpy/pull/25688
My motivation for the change may also apply to a larger group of people as it is important for lots of simulation data analysis:
In various simulations there is often the case that many entities (particles, cells, vehicles, whatever the simulation consists of) are being tracked throughout the simulation. A typical approach is to assign a unique ID to every entity which stays constant and unique throughout the simulation and is written together with other properties of the entities on every simulation snapshot in time. Note, that during the simulation new entities may enter or leave the simulation and due to parallelization the order of those entities is not conserved. Tracking the position of entities over, lets say, 100 snapshots requires the intersection of 100 id lists instead of only two.
Consequently I changed the intersect1d function from `intersect1d(ar1, ar2, assume_unique=False, return_indices=False)` to `intersect1d(*ars, assume_unique=False, return_indices=False)`.
Please let me know if there is any interest in those changes -- be it in this form or another.
Seems reasonable. I don't know if it is faster, but NumPy is all about vectorization. Chuck