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

Home » Public Forums » archive » Re: IDL 8.0 compile_opt changes
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: IDL 8.0 compile_opt changes [message #69108] Mon, 21 December 2009 09:23 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Just a quick note about the negative indices. They are *only* allowed
in ranges or as a scalar index. They are *not* allowed in arrays of
indices.

For example:

a[0:-1] In IDL80, returns all the elements

a[-1] In IDL80, returns the last element

a[[-1,0,1,2]] will either truncate the -1 to 0, or will throw an
error if the "strictarrsubs" compile option is set. This behavior will
remain the same in IDL80. We will not change it.

So, for example, David's example:
z= where(bad ne 0)
if z[0] ne -1 then begin
lots of stuff
endif

This will still work *fine* in IDL80.

Now, in IDL80 the following might cause a problem:

z= where(bad ne 0)
do something with bad[z] (without checking for -1)

In this case, if "where" returns a scalar -1, then bad[z] will indeed
return the last element. However, it would be bad to use the where
result without checking for a -1...

So, in summary, in IDL 8.0:
1. Negative indices are only used for ranges or a scalar index
2. Negative indices within an index array will still behave the same
(either clip or throw an error)
3. The behavior of Where remains unchanged (and you still need to
check for a -1 result, as always)

Returning to the compile_opt discussion...

-Chris
ITTVIS
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Coyote Contributions
Next Topic: Re: how to read/display an image like it's done in ENVI?

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

Current Time: Wed Oct 08 16:04:20 PDT 2025

Total time taken to generate the page: 0.00194 seconds