[Numpy-discussion] Bug in frompyfunc starting at 10000 elements?
James Bergstra
bergstrj at iro.umontreal.ca
Fri May 21 21:10:12 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100521/2036f0cc/attachment.html>
More information about the NumPy-Discussion
mailing list