[SciPy-User] How to efficiently do dot(dot( A.T, diag(d) ), A ) ?

Hugh Perkins hughperkins@gmail....
Mon Sep 10 21:43:09 CDT 2012


> It's not so clear what kind of improvements you are looking for. Do you
> perhaps expect that there exist some magic to ignore half of the
> computations with dot product, when the result is symmetric?

Here's the same test in matlab:

>> n = 10000;
>> k = 100;
>> a = spdiags(rand(n,1),0,n,n);
>> c = rand(k,n);
>> tic, d = c*a; toc
Elapsed time is 0.007769 seconds.
>> tic, d = d*c'; toc
Elapsed time is 0.007782 seconds.

(vs, in scipy:

>>> tic(); d = c.T * a; toc()
Elapsed time: 0.00560903549194
>>> tic(); e = dot( d, c ); toc()
Elapsed time: 0.110434055328
)


More information about the SciPy-User mailing list