[NumPy-Tickets] [NumPy] #1885: einsum wrong result / crash
NumPy Trac
numpy-tickets@scipy....
Fri Nov 25 17:42:17 CST 2011
#1885: einsum wrong result / crash
-------------------------+--------------------------------------------------
Reporter: royf | Owner: somebody
Type: defect | Status: reopened
Priority: normal | Milestone: 1.6.2
Component: numpy.core | Version: 1.6.0
Resolution: | Keywords: einsum,wrong
-------------------------+--------------------------------------------------
Changes (by royf):
* status: closed => reopened
* resolution: fixed =>
* milestone: 1.6.1 => 1.6.2
Comment:
Replying to [comment:3 mwiebe]:
Problem not solved in 1.6.1,
or a very similar problem remains:
>>> import numpy; print(numpy.version.full_version); a = numpy.arange(1,
3); b = numpy.arange(1, 5).reshape(2, 2); c = numpy.arange(1,
9).reshape(4, 2); numpy.einsum('x,yx,zx->xzy', a, b, c)
1.6.1
array([[[ 1, 3],
[ 3, 9],
[ 1, 3],
[ 3, 9]],
[[ 8, 16],
[16, 32],
[ 8, 16],
[16, 32]]])
The correct result is
>>> numpy.array([[[a[x]*b[y, x]*c[z, x] for y in range(2)] for z in
range(4)] for x in range(2)])
array([[[ 1, 3],
[ 3, 9],
[ 5, 15],
[ 7, 21]],
[[ 8, 16],
[16, 32],
[24, 48],
[32, 64]]])
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1885#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list