Travis Oliphant wrote: > David Cournapeau wrote: > >> Hi, >> >> The email from Albert made me look again on some surprising results I >> got a few months ago when starting my first "serious" numpy project. I >> noticed that when computing multivariate gaussian densities, centering >> the data was more expensive than everything else, including >> exponentiation. Now that I have some experience with numpy, and >> following the previous discussion, I tried the following script: >> >> > > Try it again with the new code in SVN. > It looks like your modification solved this particular issue !:
10 0.645 0.065 0.645 0.065 storage_email.py:8(center_broadcast) 10 0.625 0.062 0.625 0.062 storage_email.py:26(center_manual) 1 0.333 0.333 0.333 0.333 /usr/lib/python2.4/site-packages/numpy/lib/shape_base.py:530(repmat) Now, using broadcast is as fast as doing the substraction itself (which does not include the necessary repmat). I tried it on my laptop, where I can safely use beta code (python 2.4 + SVN numpy), which explains the timing differences compared to my previous email; as the memory is limited on the laptop, I only benchmarked the brodcasting. For smaller arrays, I couldn't see major differences in relative timing for the other implementations. Thank you very much ! David ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion