comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: fastest way to find the first non-zero value in an array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: fastest way to find the first non-zero value in an array [message #59674 is a reply to message #59673] Tue, 08 April 2008 06:15 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Apr 8, 3:04 am, smas...@locean-ipsl.upmc.fr wrote:
> Hi,
>
> I want to find the first non-zero value of an array. Is there a faster
> way to do this than with the "where" command: (where(array ne 0))[0]
> "Where" will look for all non-zero values and I only need the first
> one. It would be great if I could stop "where" in its search process
> as soon as it found one element...
>
> sebastien

Wow - I'd be interested in knowing how slow 'where' is. Are we
talking the difference between 0.01 seconds and 0.05 seconds? Or even
the difference between 1 and 5 seconds? Time is money, but at what
point does our 'need for speed' end?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: array concatenation in 2-D
Next Topic: Re: Avoiding FOR loops (version googleplex.infinity)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 19:55:47 PDT 2025

Total time taken to generate the page: 0.23792 seconds