The current array_equal implementation allocates an intermediate array for
the elementwise comparison of the two input arrays.

it would be great to do all this in c that is something like a reduction
operation.

I say this because certain workflows (zarr) like to check for equality
against "zero" and simply not encode the data to avoid extra files on disk.

this inevitably means that something like a full memory copy of your array
is allocated for this equality check, which should only have a memory
footprint of O(1) instead of O(n) which it has now.

Are PRs welcome to implement optimize this?
https://github.com/numpy/numpy/blob/67fc5c311eea54b27e43c2c769b3b8f878ae43f9/numpy/_core/numeric.py#L2528

Selfishly, I would love to optimize the equal_nan=False usecase first, but
perhaps with AI assistants, we can do both in 1 shot....

Let me know your thoughts

Best,

Mark
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

Reply via email to