I would like to thank timl for the code cleanup patches. I've commited the ma.py patch to svn and the other patches seem to be acceptable as well. I assume you used some kind of automated code checking tool to spot the irregularities that you've fixed. It would be nice if you could describe your procedure and the tool that you used somewere on the developers' wiki. I've created a stub at http://projects.scipy.org/scipy/numpy/wiki/CodingStyleGuidelines . I assume that for the most part numpy can simply follow general python guidelines, but as more people start contributing code it maybe useful to document some guidelines.
Hi, Here are some timings that puzzle me a bit. Sum the two rows of a 2xn matrix, where n is some large number python -m timeit -s "from numpy import array,sum,reshape; x = array([1.5]*1000); x = reshape(x,(2,500))" "x.sum(0)" 10000 loops, best of 3: 36.2 usec per loop python -m timeit -s "from numpy import array,sum,reshape; x = array([1.5]*1000); x = reshape(x,(2,500))" "x[0] + x[1]" 100000 loops, best of 3: 5.35 usec per loop The two calculations are completely equivalent (at least from the numerical results point of view). But using the built-in sum() function is app. 6 times slower. Just for the reference - using Numeric gives python -m timeit -s "from Numeric import array,sum,reshape; x = array([1.5]*1000); x = reshape(x,(2,500))" "sum(x)" 100000 loops, best of 3: 7.08 usec per loop Any suggestions to why this might be - or am I doing something wrong here? Thanks // Mads PS. Thanks to everybody that responded to my previous posting on problems and questions regarding rint() and related coding issues. Your replies were very helpful!
participants (2)
-
Mads Ipsen
-
Sasha