On Do, 2016-04-07 at 17:00 +0000, Ian Henriksen wrote: > > > On Wed, Apr 6, 2016 at 3:21 PM Nathaniel Smith <n...@pobox.com> wrote: > > Can you elaborate on what you're doing that you find verbose and > > confusing, maybe paste an example? I've never had any trouble like > > this doing linear algebra with @ or dot (which have similar > > semantics > > for 1d arrays), which is probably just because I've had different > > use > > cases, but it's much easier to talk about these things with a > > concrete > > example in front of us to put everyone on the same page. > > > > -n > 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. This error isn't necessarily unique to beginners > either. It's a > common typo that catches intermediate users who know about > broadcasting > semantics but weren't keeping close enough track of the > dimensionality of the > different intermediate expressions in their code. >
Yes, but as noted in my other mail, A @ b.T2 would behave the same as far as I can see?! Because `@` tries to make logic of 1-D arrays in an "inner" fashion. - Sebastian > Best, > > -Ian Henriksen > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion
signature.asc
Description: This is a digitally signed message part
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion