
July 19, 2012
6:52 a.m.
Hi All, I have spot a strange behavior of numpy.fromfunction(). The sample codes are as follows:
import numpy as np
def myOnes(i,j):
return 1.0
a = np.fromfunction(myOnes,(2000,2000))
a
1.0 Actually what I expected is that the function will return a 2000*2000 2d array with unit value. The returned single float value really confused me. Is this a known bug? The numpy version I used is 1.6.1. Regards, Cheng