[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My vectorized code is slower than a loop
From: |
Dave Cottingham 2 |
Subject: |
Re: My vectorized code is slower than a loop |
Date: |
Wed, 19 Oct 2016 07:26:20 -0700 (PDT) |
Andreas Weber-6 wrote
> Your script can be simplified to
>
> w = x-x(end:-1:1);
>
> try it out!
>
> Since "if(left(i) <= right(i))" is always true. Perhaps you can provide
> a realistic example?
>
> -- Andy
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@
> https://lists.gnu.org/mailman/listinfo/help-octave
I try to keep the examples short -- and the computation of a realistic
example is a bit involved -- so rather than post the code to compute the
example, here's an octave saveset with a realistic example, and a modified
"looptest.m" that reads it and runs the timing comparison.
Thanks,
Dave Cottingham
looptest.dat
<http://octave.1599824.n4.nabble.com/file/n4680245/looptest.dat>
looptest.m <http://octave.1599824.n4.nabble.com/file/n4680245/looptest.m>
--
View this message in context:
http://octave.1599824.n4.nabble.com/My-vectorized-code-is-slower-than-a-loop-tp4680192p4680245.html
Sent from the Octave - General mailing list archive at Nabble.com.