help-octave
[Top][All Lists]
Advanced

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

Re: Avoid loop


From: Kai Torben Ohlhus
Subject: Re: Avoid loop
Date: Tue, 5 Feb 2019 21:12:31 +0100

On Tue, Feb 5, 2019 at 7:04 PM LucaLuca <address@hidden> wrote:
hi siko...thank for answer

https://pastebin.com/Vz7s4hbn



Good to see the full code, now I know there is little hope for an easy vectorization to avoid the loop.
The important part was missing in your previous example.  The mean loop dependency is:

maxRel = some_val;
% ...
for gg = start:end
  % ...
  maxRel = max(new_val, maxRel);
  % ...
endfor

And similar things for minRel and so on. Thus in each inner loop the value of "maxRel" depends on the outcome of the previous loop.
I have no insight if this is really necessary. You might overthink your code or other followers of this mailing-list for sure have better ideas than I have ;-)

Best,
Kai

reply via email to

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