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

Home » Public Forums » archive » Zero vector detection in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Zero vector detection in IDL [message #16102] Mon, 28 June 1999 00:00
Frank Morgan is currently offline  Frank Morgan
Messages: 3
Registered: June 1999
Junior Member
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.

On the other hand:
for i=0,n-1 do begin
if (x(i) NE 0) then begin
(it's not all zero)
goto, BREAK
endif
endif
BREAK:
will stop early if possible, but looping a
conditional is maybe not the
fastest structure in IDL.

An internal command that implements the loop concept would be what I'm
looking for I think but I don't know if it exists.

Any better ideas?

Thanks,
Frank
frank.morgan@jhuapl.edu
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: unsupported X Window
Next Topic: Re: Reading free format data

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

Current Time: Wed Oct 08 16:52:17 PDT 2025

Total time taken to generate the page: 0.00529 seconds