[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help requested with extremely slow for loop?
From: |
Joachim De Beule |
Subject: |
Re: help requested with extremely slow for loop? |
Date: |
Thu, 25 Mar 2010 10:54:58 +0100 |
User-agent: |
KMail/1.11.2 (Linux/2.6.28-15-generic; KDE/4.2.2; x86_64; ; ) |
Many thanks to all of you, this is really interesting!
Are there any other 'insiders' I should know about with respect to sparse
matrices? (I've read the 'Mathematical considerations' in the info file.) In
particular, could you please expand on the following because I am not sure
what it means.
> This should work well unless there are loop-carried dependencies
> assumed, in which case you'll need something more elaborate.
> If you have thousands of independent vectors, you may also consider
> stacking them in a matrix.
So you mean sth like xs = [x1 x2 ... x3], with the xi one of the x's in the
previous code? Actually that is what I have, but I am not sure what that gives
me with respect to the calculations, I still need a for loop:
for i = 1:length(xs)
idxs = find(xs(:,i) & y);
xs(:,idxs(i)) += xs(:,i);
xs(:,i) = 0;
endfor
Or am I missing something again?
Joachim