Re: [Numpy-discussion] Improving performance of the `numpy.any` function.

2021-04-15 Thread zoj613
Although still much slower than the builtin `any`, this is an interesting and strange alternative way to improve the timing. My speeds are a result of using a _very_ old machine with a low-grade processor so maybe these times are more exaggerated to me than others. -- Sent from: http://numpy-dis

Re: [Numpy-discussion] Improving performance of the `numpy.any` function.

2021-04-15 Thread Sebastian Berg
On Wed, 2021-04-14 at 18:53 -0700, dan_patterson wrote: > a = np.zeros(1_000_000) > > a[100] = 1 > > %timeit np.any(a) > 814 µs ± 17.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops > each) > > %timeit np.any(a == 1) > 488 µs ± 5.68 µs per loop (mean ± std. dev. of 7 runs, 1000 loops > each

[Numpy-discussion] Add pad_to_shape and pad_to_match for simpler padding if a target size is already known

2021-04-15 Thread czorio4
Hello all, I'm only two weeks late with this message about my pull request that adds functions that allow the user to pad to a target shape, instead of adding a certain amount to each axis. For example: x = np.ones((3, 3)) # We want an output s