[Numpy-discussion] Possible bug in scalar * array

Edward C. Jones edcjones at erols.com
Sun Oct 19 02:22:02 CDT 2003


#! /usr/bin/env python

# Python 2.3.2, numarray 0.7
import numarray

def fun1(code, scale):
     arr1 = numarray.ones((4,4), code)
     arr2 = scale * arr1
     arr3 = numarray.ones((4,4), code)
     # Bug appears at second multiply.
     arr4 = scale * arr3

def fun2(code, scale):
     arr = numarray.ones((4,4), code)
     arr2 = scale * arr
     # Bug appears at second multiply.
     arr3 = scale * arr

# These calls fail when "scale" is too big for "code":

#   File 
"/usr/local/lib/python2.3/site-packages/numarray/numarraycore.py", line 
653, in __rmul__
#    def __rmul__(self, operand): return ufunc.multiply(operand, self)
# ValueError: invalid shape tuple

#fun2('Int16', 100000)
fun2('UInt8' , -1)





More information about the Numpy-discussion mailing list