On Mon, Mar 17, 2014 at 8:54 PM, Nathaniel Smith <njs@pobox.com> wrote:

But there's still something about the "vector" examples that bugs me, "matrix@vector" and "vector@@2", keep popping up (this also applies to the matrix@matrix examples to a lesser extent).

Einsum is fantastic by the way, totally worth learning and using.

But, this is actually a feature! Because obviously what *should* be

returned in this case is *not* (Mat @ vec) @ Mat, *or* Mat @ (vec @

Mat). Both of those answers are terrible; it's just, if you have an

ordinary left-/right-associative operator, those are your only

options. What *should* be returned is an error. And in this scheme we

get to see the whole @ expression at once, so we actually can raise an

error for such things.

Sorry if this is a little off topic.

But there's still something about the "vector" examples that bugs me, "matrix@vector" and "vector@@2", keep popping up (this also applies to the matrix@matrix examples to a lesser extent).

I'm a little unconformable looking at the shape to to decide what's a matrix and what's a vector. (Matlab has some problems like this)

If it only has one or two dimensions it's easy, but I
always find that if I've written code that works for 1 matrix or vector, 5
minutes later I want it to work for fields of matrices or vectors. If we're just going by shape there's no way to distinguish between a 2d field of matrices and a 3d field of vectors.I guess this is a repeat of part of what Eelco Hoogendoorn saying a few posts back

I was just wondering if anyone sees a place, to get @ a little closer to Einsum, for some sort of array class that understands the difference between a 4D array of scalars, a 3D array of vectors, and a 2D array of matrices... The difference between the axes that broad-cast and the axes that can sum when you hit them with an @ ... or something like that.

Just a thought.

Einsum is fantastic by the way, totally worth learning and using.

Mark Daoust