[NumPy-Tickets] [NumPy] #1862: improvement of index notation in einsum
NumPy Trac
numpy-tickets@scipy....
Wed Jun 8 05:15:13 CDT 2011
#1862: improvement of index notation in einsum
-------------------------------------+--------------------------------------
Reporter: wieland | Owner: somebody
Type: enhancement | Status: new
Priority: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.6.0
Keywords: einsum, index, notation |
-------------------------------------+--------------------------------------
I suggest some small and very natural improvements on the exceptional
index notation of einsum.
1) Given an N-dimensional array A and a 1-dimensional array B, the
following code throws an error:
{{{
einsum('ij...,j->ij...',A,B)
}}}
Instead one has to write an (empty) ellipsis for B,
{{{
einsum('ij...,j...->ij...',A,B)
}}}
which just obscures the real index summation.
2) At the moment, all indices to sum over have to be made explicit.
However, I claim that
{{{
einsum('ij...,j...->ij',A,B)
}}}
is. as an example, naturally equivalent to
{{{
einsum('ijts,jts->ij',A,B)
}}}
(if the dimensions of A and B are appropriate). In the same way, in
{{{
einsum('ij,j...->ij',A,B)
}}}
you sum over the other axes of B.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1862>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list