help-octave
[Top][All Lists]
Advanced

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

indexing expression performance


From: Nicholas Tung
Subject: indexing expression performance
Date: Tue, 13 Jan 2009 13:13:27 -0500

I've noticed that indexing expressions on large arrays can be quite slow, even if the indexes are mostly sequential. In the code below, the first loop takes 1.91 seconds while the second takes 0.11 seconds. Any suggestions on how to get around this would be much appreciated, even looking at Octave's source.

a = rand(300);
tic
for i = 1:100
    a(1:(size(a, 1) - 1), :) += a(2:size(a, 1), :);
endfor
toc

tic
for i = 1:100
    a += a;
endfor
toc

thanks,
Nicholas

reply via email to

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