2012-10-11

speeding up code

In a low-research day the most fun I had was working in pair-code mode to speed up Fadely's mixture of factor analyzers code, now published on PyPI. Most of our speed-up came from realizing that (somewhere inside a pretty complicated expression)
c = numpy.diag(a[:, None] * b[None, :])
(where a and b are one-dimensional numpy arrays of the same length) is exactly equivalent to
c = a * b
Duh! That embarrassment aside, I think we have some pretty useful code now. Time to test it out. Please help!

No comments:

Post a Comment