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

Home » Public Forums » archive » IDL's handling of LOGICAL quantities (WHERE)
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
IDL's handling of LOGICAL quantities (WHERE) [message #17411] Tue, 12 October 1999 00:00 Go to next message
James Tappin is currently offline  James Tappin
Messages: 54
Registered: December 1995
Member
\begin{rant}
I've finally decided to have a public moan about one of the weaknesses of IDL's
handling of logical operations: to boot -- that the WHERE function follows
a C-like interpretation while most other things are Fortran-like.

for example suppose we have an array (m) some of whose values are NaN then the
(inefficient) loop:
for j=0, n_elements(m) do if not finite(m(j)) then m(j)=0
will set all non-finite elements of m to 0.
However:
m(where(not finite(m))) = 0
will zero out the whole array since where sees (not 1) as a Yes.
[The correct solution is of course:
m(where(finite(m) ne 1)) = 0
]

Or a simpler example:
IDL> a = [0, 1, 0, 1]
IDL> print, where(a eq 0)
0 2
IDL> print, where(not (a ne 0))
0 1 2 3

I guess the proper answer isto have aproper logical or boolean type and
functions like FINITE and logical operations should return it, and of course
WHERE should accept it.

\end{rant}


--
+------------------------+-------------------------------+-- -------+
| James Tappin | School of Physics & Astronomy | O__ |
| sjt@star.sr.bham.ac.uk | University of Birmingham | -- \/` |
| Ph: 0121-414-6462. Fax: 0121-414-3722 | |
+--------------------------------------------------------+-- -------+
Re: IDL's handling of LOGICAL quantities (WHERE) [message #17507 is a reply to message #17411] Tue, 19 October 1999 00:00 Go to previous message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
In article <MPG.126cfe683b63903f989913@news.frii.com>,
davidf@dfanning.com (David Fanning) wrote:
> James Tappin (sjt@star.sr.bham.ac.uk) writes:
>
>> \begin{rant}
>> \end{rant}
>
> Uh, right. Whatever.
>
> Cheers,
>
> David
>
> P.S. I *think* it was IDL code.

nope, it was LaTeX, one of the better ways of producing
really great-looking text.

Mirko

\PS{P.S. I am very biased here, don't take my opinions too
seriously.}


Sent via Deja.com http://www.deja.com/
Before you buy.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Smith Charts
Next Topic: Re: ??% TRIGRID: X, Y, or Z array dimensions are incompatible?? what the....

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

Current Time: Wed Oct 08 15:26:44 PDT 2025

Total time taken to generate the page: 0.00602 seconds