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

Home » Public Forums » archive » User selectable lower array bound?
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: User selectable lower array bound? [message #26093 is a reply to message #25981] Fri, 03 August 2001 15:08 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Paul van Delst <paul.vandelst@noaa.gov> writes:

> Hey there,
>
> Is is just me, or would anyone else find useful the ability to define arrays in IDL such
> that the lower bound is *not* always zero? Sorta like:
>
> x = FINDGEN( 11, LOWER = -5 )
> or
> y = DBLARR( 100, LOWER = 1 )
>
> so that accessing elements such as x[ -4 ] or y[ 100 ] are o.k.?

Well, as grumpy as I have been in the past about IDL wishes, this is
one thing I do not want to have in IDL now!

As has been pointed out, the issue gets clouded when dealing with
things like WHERE() [btw, <flame>I think that -1 is one of the single
biggest mistakes that IDL has in it<flame>], but also about how such
an array would be passed to other procedures. Also, IDL has other
ways of indexing arrays, like indexing a 2d array by 1d subscripts.
What would happen then?

For the most part, I find it pretty easy to bite the bullet and say
x[CONST-4] instead of x[4].

Which brings a gripe of my own to mind. One tricky problem with
accessing arrays is that accessing out of bounds elements is both
legal and illegal, depending on whether the subscript index is a
scalar or an array.

a[ [-1] ] = 0 ;; Succeeds!
a[ -1 ] = 0 ;; Fails!

What is up with that? :-)

Craig


--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[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
Read Message
Read Message
Previous Topic: IDL virtual reality (was 3D Object IDL )
Next Topic: problem getting values from cw_bgroup normal base

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

Current Time: Wed Oct 08 18:40:56 PDT 2025

Total time taken to generate the page: 0.01116 seconds