Quick little typing nitpick:
`tuple[np.float64]` describes a tuple of length 1.
To describe a tuple of arbitrary length, you'd write `tuple[np.float64, ...]`
---
On a more related note, I'm seeing an asymptotic speedup/slowdown of 14x
Equality: True
Number of points: 10
Normal:2.99 μs ± 8.
On Sun, 2025-03-23 at 10:17 +0800, Fang Zhang wrote:
> Sebastian,
>
> I think the core issue you pointed out is indeed correct, but your
> detailed
> explanation is backwards, since `maximum(arr[:, 0], arr[:, 1])`
> implements
Ah, right, I explained things thinking of axis=1, thanks! As you sai
Sebastian,
I think the core issue you pointed out is indeed correct, but your detailed
explanation is backwards, since `maximum(arr[:, 0], arr[:, 1])` implements
`arr.max(axis=1)` instead of `arr.max(axis=0)`. So OP's transpose method is
essentially approach 1, which for this array shape has less
Very interesting! Thanks for the quick response!
___
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member
On Fri, 2025-03-21 at 23:22 +0100, Tiziano Zito via NumPy-Discussion
wrote:
> Hi George,
>
> what you see is due to the memory layout of numpy arrays. If you
> switch your array to F-order you'll see that the two functions have
> the same timings, i.e. both are fast (on my machine 25 times faster
Hi George,
what you see is due to the memory layout of numpy arrays. If you switch your
array to F-order you'll see that the two functions have the same timings, i.e.
both are fast (on my machine 25 times faster for the 1_000_000 points case).
Try:
vertices = np.array(np.random.random((n, 2))