Python

The Python programming language.

Updated: building 64-bit Numpy with Intel compilers (icc)

I had to re-build Numpy because our cluster was upgraded and the Intel compilers and libraries were moved to a different directory.  This turned out to be a half-day affair of trial-and-error.  I learned a few important things, which I will try to list here: Delete the numpy-1.0.4/build directory after every build attempt.  Doing “python …

Updated: building 64-bit Numpy with Intel compilers (icc) Read More »

Even faster collision detection in Python using Numpy

Last night, in the shower, I realized that my collision detection routine could be even faster. Here is a representative snippet of code from my previous post: d2 = (x-self.x[0:i])*(x-self.x[0:i]) + (y-self.y[0:i])*(y-self.y[0:i]) + (z-self.z[0:i])*(z-self.z[0:i]) For some reason, I used the code (x-self.x)*(x-self.x) instead of (x-self.x)**2. Upon further reflection, I realized that (x-self.x)*(x-self.x) computes the difference …

Even faster collision detection in Python using Numpy Read More »

Speeding up Python math with Numpy: collision detection example

Python is a very-high-level language.  That makes it easy to write code quickly, but the program may not be as fast as a program compiled from a lower-level language.  For this reason, many scientific programs are written in Fortran or C++.  However, it has always been my experience that the majority of time on a …

Speeding up Python math with Numpy: collision detection example Read More »