help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vectorizing code


From: Torbjörn Rathsman
Subject: Vectorizing code
Date: Sat, 24 Sep 2011 20:38:45 +0200

How do I vectorize this piece of code?

a is an NDArray

for i=1:size(a,1)
        for j=1:size(a,2)
                v=[a(i,j,1) a(i,j,2) a(i,j,3)]';
                v=A\v;
                a(i,j,1)=v(1);
                a(i,j,2)=v(2);
                a(i,j,3)=v(3);
        end
end



reply via email to

[Prev in Thread] Current Thread [Next in Thread]