[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I replace this "for" loop?
From: |
Keith Goodman |
Subject: |
Re: How do I replace this "for" loop? |
Date: |
Tue, 31 May 2005 18:46:52 -0700 |
OK. That window border theme is a little better.
On 5/31/05, Tom Holroyd <address@hidden> wrote:
> Oops! There was a(nother) bug in my script -- the original line
> was
>
> x = 2*(x>p);
>
> but it should have been
>
> x = 2*x(x>p);
>
> and the really astonishing part is, the second line is faster.
> In fact (see attached graph), it shows that in this case, find is
> *never* faster than using logical indexing. Not only that, even
> the logical indexing gets faster as the number of elements
> selected decreases! I'm not sure why that is.
>
> The first line involves conversion of a logical array to a double
> array, which has nothing to do with the original task.
>
> Dr. Tom Holroyd
> "A man of genius makes no mistakes. His errors are volitional and
> are the portals of discovery." -- James Joyce
>
>
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- Re: How do I replace this "for" loop?, (continued)
Re: How do I replace this "for" loop?, Tom Holroyd, 2005/05/31
Re: How do I replace this "for" loop?, Jonathan Stickel, 2005/05/31
Re: How do I replace this "for" loop?, Tom Holroyd, 2005/05/31