Hi all, I'm wondering if this is a bug...
Something strange happens with my ufunc as soon as I use 10000 elements. As the test shows, the ufunc computes the correct result for either the first or last 9999 elements, but both at the same time is no good.
Turns out I'm only running numpy 1.3.0 with Python 2.6.4... could someone with a more recent installation maybe check to see if this has been fixed?
Thanks,
def test_ufunc():
np = numpy
rng = np.random.RandomState(2342)
a = rng.randn(10000, 2)
b = rng.randn(10000, 1)
f = lambda x,y:x*y
ufunc = np.frompyfunc(lambda *x:numpy.prod(x), 2, 1)
def g(x,y):
return np.asarray(ufunc(x,y), dtype='float64')
assert numpy.allclose(f(a[:-1],b[:-1]), g(a[:-1],b[:-1])) # PASS
assert numpy.allclose(f(a[1:],b[1:]), g(a[1:],b[1:])) # PASS
assert numpy.allclose(f(a,b), g(a,b)) # FAIL
--
http://www-etud.iro.umontreal.ca/~bergstrj