[SciPy-User] calculating covariances fast (and accurate)
Thu Jul 8 19:08:32 CDT 2010
Sturla Molden skrev:
> One important lesson from this: it does not help to write a function
> like cov(X) in C, when we have access to optimized BLAS from Python. So
> let this serve as a warning against using C istead of Python.
After plowing though numpy svn, I located np.dot here:
It seems numpy.cov is written in Python too. But it uses np.dot instead
of dgemm (why is that less efficient?), deals with masked arrays, and
forms more temporary arrays. That's why it's slower. The biggest
contribution is probably dgemm vs. np.dot.
And np.cov does not correct for rounding errors (which I think it should).
More information about the SciPy-User