[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
vectorization quiz
From: |
Carlo de Falco |
Subject: |
vectorization quiz |
Date: |
Fri, 28 Aug 2009 10:44:08 +0200 |
Hi,
I've just come back to work after holidays but my brain seems not to
have noticed,
I'm sure there is an easy way to vectorize the following code but I
just can't see it at the moment...
Here is the code:
for iel = 1:nel
for iqn = 1:nqn
shg(:,:,iqn,iel) = J(:, :, iqn, iel) * shg(:,:,iqn,iel);
endfor
endfor
where nel and nqn are possibly very large and size(J(:, :, iqn, iel))
= size(shg(:,:,iqn,iel)) = [2 2]
Can anyone suggest a way to speed this up?
Thanks in advance,
c.
- vectorization quiz,
Carlo de Falco <=