[NumPy-Tickets] [NumPy] #2144: .max(0) on reshaped array returns inconsistent results.

NumPy Trac numpy-tickets@scipy....
Fri May 25 19:06:44 CDT 2012

#2144: .max(0) on reshaped array returns inconsistent results.
 Reporter:  thouis  |       Owner:  somebody   
     Type:  defect  |      Status:  new        
 Priority:  normal  |   Milestone:  Unscheduled
Component:  Other   |     Version:  devel      
 Keywords:          |  

Comment(by thouis):

 I think I've traced it down to this line being executed at the last loop
 of the iteration it's controlling:

 while (iternext(iter));

 Before this line executes, the data is correct.  Afterward, it has been
 scribbled over with something that looks suspiciously like a pointer's

 The call to iternext at the end of the loop calls this:

 Which *only when it crashes*, goes into this piece of code:

 and executes this:

 I'm reasonably certain it shouldn't be going into the if clause based on
 delta at line 1878, but I haven't unraveled enough of that code to know
 for sure.

 However, changing the second <= to < at this line (since it looks like an
 off-by-one error, and every time it crashed, it was under the == case of

 seems to fix the crash.  Mark, can you verify that my intuition about this
 comparison is correct?

 All tests pass with this change, except one:
 FAIL: test_where_param_buffer_output (test_ufunc.TestUfunc)
 Traceback (most recent call last):
   File "/Users/tjones/numpy.git/numpy/core/tests/test_ufunc.py", line 598,
 in test_where_param_buffer_output
     assert_equal(c, [2,1.5,1.5,2,1.5,1.5,2,2,2,1.5])
   File "/Users/tjones/numpy.git/numpy/testing/utils.py", line 256, in
     return assert_array_equal(actual, desired, err_msg, verbose)
   File "/Users/tjones/numpy.git/numpy/testing/utils.py", line 753, in
     verbose=verbose, header='Arrays are not equal')
   File "/Users/tjones/numpy.git/numpy/testing/utils.py", line 677, in
     raise AssertionError(msg)
 Arrays are not equal

 (mismatch 50.0%)
  x: array([ 1.5,  1.5,  1.5,  1.5,  1.5,  1.5,  1.5,  1.5,  1.5,  1.5])
  y: array([ 2. ,  1.5,  1.5,  2. ,  1.5,  1.5,  2. ,  2. ,  2. ,  1.5])

Ticket URL: <http://projects.scipy.org/numpy/ticket/2144#comment:5>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list