On Thu, Apr 7, 2016 at 10:00 AM, Ian Henriksen
<insertinterestingnameh...@gmail.com> wrote:
>
> Here's another example that I've seen catch people now and again.
>
> A = np.random.rand(100, 100)
> b =  np.random.rand(10)
> A * b.T
>
> In this case the user pretty clearly meant to be broadcasting along the rows
> of A
> rather than along the columns, but the code fails silently. When an issue
> like this
> gets mixed into a larger series of broadcasting operations, the error
> becomes
> difficult to find.

I feel like this is an argument for named axes, and broadcasting rules
that respect those names, as in xarray? There's been some speculative
discussion about adding something along these lines to numpy, though
nothing that's even reached the half-baked stage.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to