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

josef.pktd@gmai... josef.pktd@gmai...
Mon Sep 10 12:11:18 CDT 2012


On Mon, Sep 10, 2012 at 12:34 PM, Hugh Perkins <hughperkins@gmail.com> wrote:
>> > How to do efficiently do dot(dot( A.T, diag(d) ), A ) ?
>>
>> dot( A.T * d , A )
>
> This is very good!
>
> Still, the second multiplication looks like it is doing a full
> brute-force matrix multiplication:

except that the result is symmetric, I don't see any way around that.
elementwise multiplication and sum will usually be slower.

Josef


>
>>>> tic(); d = c.T * a; toc()
> Elapsed time: 0.00560903549194
>>>> tic(); e = dot( d, c ); toc()
> Elapsed time: 0.110434055328
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-User mailing list