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

Home » Public Forums » archive » Re: Is it an IDL bug or feature?
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
Re: Is it an IDL bug or feature? [message #5239] Thu, 26 October 1995 00:00
hahn is currently offline  hahn
Messages: 108
Registered: November 1993
Senior Member
Liyun Wang <Liyun.Wang.1@gsfc.nasa.gov> wrote:

> Hi,

> In a process of debugging our IDL codes, we found an interesting case which you
> may want to be aware of. Consider this:
[snip]
> IDL> b = 1
> IDL> a = b([2],[1],[2])
[snip]
> What do you think IDL will respond? Will it issue a syntax error message?
> Wrong!

IDL works as described in the manual: User's manual p 5-5, formula
beginning with V(S) =

> As long as the subscript indices of a *scalar* variable, like b here,
> are arrays with the same dimension, IDL does not care nor complain, no matter
> how
> many array elements you give. Do you consider this to be a potential bug or a
> feature of IDL?

The reason for this feature is to save time when doing image
processing: Imagine a 512x512 array of luminance values and
use these to adress a color lookup table. Some luminance
values may be missing or out of range in this example. Thus
you save lots of processing time (for subscript checking)
when the top and the bottom element of the lut are set to the color of
missing value.
> --
> ============================================================ =========
> Liyun Wang | Voice: 301-286-3126
> G1 Building 26, SOHO EAF | FAX: 301-286-0264
> NASA, GSFC, Code 682.3 | Liyun.Wang.1@gsfc.nasa.gov
> Greenbelt, MD 20771 |http://orpheus.nascom.nasa.gov/~lwang
> ============================================================ =========

Norbert Hahn
Re: Is it an IDL bug or feature? [message #5243 is a reply to message #5239] Thu, 26 October 1995 00:00 Go to previous message
chase is currently offline  chase
Messages: 62
Registered: May 1993
Member
>>>> > "Liyun" == Liyun Wang <Liyun.Wang.1@gsfc.nasa.gov> writes:


Liyun> In a process of debugging our IDL codes, we found an
Liyun> interesting case which you may want to be aware of. Consider
Liyun> this:

IDL> b = 1
IDL> a = b(1,2,1)

Liyun> IDL will complain about subscript being out of range. But watch this:

IDL> b = 1
IDL> a = b([2],[1],[2])
Liyun> or
IDL> a = b([[2],[1],[10],[30]])
Liyun> or even
IDL> a = b([[2],[,1],[10],[30]], [[20],[12],[70],[20]])

Liyun> What do you think IDL will respond? Will it issue a syntax
Liyun> error message? Wrong! As long as the subscript indices of a
Liyun> *scalar* variable, like b here, are arrays with the same
Liyun> dimension, IDL does not care nor complain, no matter how many
Liyun> array elements you give. Do you consider this to be a potential
Liyun> bug or a feature of IDL?

It is not a bug. The specific behaviors are clearly documented
features in Chapter 5 of the "IDL User's Guide" (version 3.5 and
version 4, perhaps earlier too) under the subsections "Subscript
Examples" and "Array Subscripts".

It does seem unfortunate the behavior seems inconsistent. I find that
both behaviors are useful.

Chris
--
===============================
Bldg 24-E188
The Applied Physics Laboratory
The Johns Hopkins University
Laurel, MD 20723-6099
(301)953-6000 x8529
chris.chase@jhuapl.edu
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CALL_EXTERNAL under OpenVMS Alpha (IDL 4.0.1)
Next Topic: Why does IDL strip unary dimensions from structure elements?

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

Current Time: Wed Oct 08 19:43:30 PDT 2025

Total time taken to generate the page: 0.00605 seconds