|
|
Log in / Subscribe / Register

NumPy 1.20 has been released

NumPy 1.20 has been released

Posted Feb 24, 2021 14:05 UTC (Wed) by leephillips (guest, #100450)
In reply to: NumPy 1.20 has been released by quietbritishjim
Parent article: NumPy 1.20 has been released

As far as I can tell the results should be the same. This is an extension of the `where` keyword argument that was added to `numpy.reduce` in v. 1.17. Both when using the `where` keyword argument in when using `logical_and`, the Boolean mask array is broadcast to match the dimensions of the array in the first argument. There could be performance differences.


to post comments

NumPy 1.20 has been released

Posted Feb 24, 2021 14:49 UTC (Wed) by mhvk (subscriber, #86585) [Link]

Indeed, it just extends `where` to the wrappers around ufunc reductions (`np.logical_and.reduce` and `np.logical_or.reduce` in this case), really remedying an oversight from when I implemented `where` for reductions... I think the advantage is clearer for taking the mean, etc. For `any` and `all`, what would be nice is to have proper short-circuiting, but that is still on the wish list.

p.s. What makes `ndarray` so particularly nice is how it deals with strides to allow views of many forms into the array. This is nicely described in the "array programming with numpy" article; see https://ui.adsabs.harvard.edu/abs/2020Natur.585..357H/abs...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds