[NumPy-Tickets] [NumPy] #2218: numpy.any ignores imaginary part of arrays

NumPy Trac numpy-tickets@scipy....
Mon Oct 1 10:56:55 CDT 2012


#2218: numpy.any ignores imaginary part of arrays
-------------------------+--------------------------------------------------
 Reporter:  mike.wimmer  |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  highest      |   Milestone:  1.7.0   
Component:  numpy.core   |     Version:  1.6.1   
 Keywords:               |  
-------------------------+--------------------------------------------------
Changes (by seberg):

 * cc: seberg (added)


Comment:

 Puh... I checked this a bit, and this seems to fix it, but i have really
 _no_ idea whatsoever if this is the correct way to fix it or if there is
 more to fix... already puzzles me when those conversion functions from
 array_types.c.src get actually called. (Note that .astype(bool) also
 failed here.)

 --- a/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
 +++ b/numpy/core/src/multiarray/lowlevel_strided_loops.c.src
 @@ -811,9 +811,17 @@ static void
      dst_value[0] = _CONVERT_FN(src_value[0]);
      dst_value[1] = _CONVERT_FN(src_value[1]);
  #  elif !@aligned@
 -    dst_value = _CONVERT_FN(src_value[0]);
 +#    if @is_bool2@
 +       dst_value = _CONVERT_FN(src_value[0]) ||
 _CONVERT_FN(src_value[1]);
 +#    else
 +       dst_value = _CONVERT_FN(src_value[0]);
 +#    endif
  #  else
 -    *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
 +#    if @is_bool2@
 +       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]) ||
 _CONVERT_FN(src_value[1]);
 +#    else
 +       *(_TYPE2 *)dst = _CONVERT_FN(src_value[0]);
 +#    endif
  #  endif
  #else
  #  if @is_complex2@

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2218#comment:4>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list