[NumPy-Tickets] [NumPy] #2027: einsum/iterator bug

NumPy Trac numpy-tickets@scipy....
Sat Jan 21 17:39:45 CST 2012


#2027: einsum/iterator bug
------------------------+---------------------------------------------------
 Reporter:  mwiebe      |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  high        |   Milestone:  1.7.0   
Component:  numpy.core  |     Version:  1.6.1   
 Keywords:              |  
------------------------+---------------------------------------------------
 This was reported by royf by reopening ticket #1885. I'm moving it to a
 new ticket, as it's a new bug, even though it's very similar in nature to
 the one reopened.

 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/2027>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list