Speeding up element-wise multiplication between sparse and dense vectors
- From: "David " <dude@xxxxxxxxxxxxxxxxxx>
- Date: Fri, 10 Aug 2007 16:01:54 +0000 (UTC)
Hello,
I have a large 10^8+ elements sparse matrix X with no more
than 5% non-zero elements. I run an algorithm on X which
takes much longer if X is sparse compared to when it's dense.
The bottle neck is a computation of the form:
temp_result = sum(non_sparse_vec_01 .* X(:,i) .*
non_sparse_vec_02)
i.e the sum of an elementwise multiplication between dense
and sparse vectors.
Any ideas on how to speed up the computation?
There are 2 obvious options but both have drawbacks:
1. Convert the entire X to full -> speeds up but is memory
intensive
2. Convert columns of X into full when required -> not
memory intensive but conversion time cancels out what is
gained in time...
I also considered working only on the elements corresponding
to the nnz entires in X(:,i) -> since the final output is a
sum... but I only gain little.
Any help is appreciated.
/David
.
- Follow-Ups:
- Re: Speeding up element-wise multiplication between sparse and dense vectors
- From: David
- Re: Speeding up element-wise multiplication between sparse and dense vectors
- From: Tim Davis
- Re: Speeding up element-wise multiplication between sparse and dense vectors
- From: Ofek Shilon
- Re: Speeding up element-wise multiplication between sparse and dense vectors
- From: David
- Re: Speeding up element-wise multiplication between sparse and dense vectors
- Prev by Date: Randomly sorting a vector
- Next by Date: Remove uitable default context menu?
- Previous by thread: Randomly sorting a vector
- Next by thread: Re: Speeding up element-wise multiplication between sparse and dense vectors
- Index(es):
Relevant Pages
|