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

Home » Public Forums » archive » Re: Zero vector detection in IDL
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: Zero vector detection in IDL [message #16101 is a reply to message #16038] Mon, 28 June 1999 00:00 Go to previous message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
Using WHERE does search through the entire array. I tried it: on my Power
Mac I could only get a FINDGEN(10,500,000) in memory, and locating randomly
incerted zeros in it using WHERE took 1.6 s. Unless your arrays are much
larger, I'd stick with WHERE for simplicity sake. Saves about 8 lines of
code, which I am not sure would speeds things up much: what if your
non-zero is at the end? You will loose an hour to loop through 10,500,000
elements.
Good luck,
Pavel

Frank Morgan wrote:

> Given a big byte or integer array (actually a 1-D vector), is there a
> fast IDL way to check whether any non-zero elements exist?
>
> Something like "if (total(x) EQ 0)..." or a where() construct will work,
> but scans the whole vector when the first non-zero element is enough to
> answer the question. max(x) is even worse.
[Message index]
 
Read Message
Read Message
Previous Topic: Widget question
Next Topic: Re: Passing zero as a Parameter/ NOT KEYWORD_SET

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

Current Time: Thu Oct 09 22:14:23 PDT 2025

Total time taken to generate the page: 2.31746 seconds