On Wed, Aug 11, 2010 at 8:20 AM, Marco Caliari <address@hidden> wrote:
Dear maintainers,
if I run
A = toeplitz ([-2, 1, 1, 1, zeros(1, 856)]);
A = reshape (A, 18490, 40);
SA = sparse (A);
B = rand (size (A));
tic, A .* B;,toc
tic, SA .* B;, toc
tic, SA .* sparse (B);, toc
I get
Elapsed time is 0.00745105 seconds.
Elapsed time is 0.229055 seconds.
Elapsed time is 0.0203849 seconds.
(3.3.51 with Suitesparse 3.5.0, similar results with 3.2.4 with Suitesparse
3.4.0). Why SA .* sparse (B) is so faster than SA .* B? What is done by
default when a full-sparse dot product is required?
Best regards,
Marco
Apparently this operation is just poorly optimized.
Before I start doing anything here, I'd like to know what the Matlab
behavior is w.r.t. NaNs. Namely, if
A = sparse ([2,3,1,2], [1,1,3,3], [0.1, 0.2, 0.3, 0.4]);
B = ones (3); B(1,1) = NaN;
C = sparse ([1,2,3,1,2], [1,1,1,3,3], [NaN, 0.1, 0.2, 0.3, 0.4]);
what is the output of A.*B, B.*A, A ./ B, A .*C?
Of course, newer version is better.