[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
efficiency
From: |
Daniel Heiserer |
Subject: |
efficiency |
Date: |
Mon, 31 Jan 2000 15:34:33 +0100 |
Hi,
Assume I have a few hundred matrices:
k_0004711
k_0004712
.........
And I want to loop through a subset of them
with a certain function:
like:
a=myfunc(b,c,K__00047[1-5]) # in shell regexps .... ;-)
call for each matrix
What is better/more efficient:
1) copying the data via a temporary variable
for jj=1:5
tmp=eval(sprintf('k_%7d',47*1000+jj));
a=myfunc(b,c,tmp);
end
% Which probably means copying data in core each time .......
% for big loops not nice .......
or
2) putting the eval above all:
for jj=1:5
eval(sprintf('a=myfunc(a,b,K_%7d)',47*1000+jj));
end
% no idea about what is really done here....
or
3) put all the crap in ONE Monster array, store the indices somewhere
and do it like this and making all the code realy ugly .......
a=myfunc(a,b,K_monster,K_indices);
% is here any data copied?
% and does it only make the code unreadible
4) or a really good idea :-), which I don't have right now ......
Thanks Daniel
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------
- efficiency,
Daniel Heiserer <=