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

Home » Public Forums » archive » subscript array question
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: subscript array question [message #14366 is a reply to message #14309] Tue, 16 February 1999 00:00 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Tom McGlynn <tam@silk.gsfc.nasa.gov> writes:
>
> This kind of thing comes up in a number of contexts, e.g., the
> thread a couple of months ago for calculating cumulative totals
> in arrays. The solution I've suggested to RSI is a new equality
> operator (e.g., :=) which does not implicitly parallelize
> array operations.
>
> In this case one could just write
>
> array[subs] := array[subs]+1
>
> in a very natural way rather than use devious if clever subterfuges.
>

Yorick, which is very IDL-like, has some pretty handy ideas in it.
While it doesn't consider your "anti-parallel" equality operator, it
does have operators that *attach* to array subscripts and do most of
the things you might want. Consider that there is no nicely
vectorized function in IDL which computes the cumulative total of "x"
in IDL. In Yorick, you would say:

y = x(cum)

Here "cum" is a special function which operates on a dimension of the
array, and cranks out the cumulative total for you. Thus for example,

y = x(dif) is the finite difference between elements of x
(this is something I wish I had all the time!)

There are also "rank-reducing" functions which remove one dimension of
the array. Thus,

y = x(sum) is the same as y = total(x) in IDL,
y = x(max) is the same as y = max(x), etc.

Whis is this nice? Sometimes you want to get the maximum along only a
certain dimension. To get the maximum in each row of an array, you
might try:

y = x(max,*) which has no equivalent in IDL

As I say, I find myself wishing for a lot of these features almost
daily. IDL could become a whole lot more vector-friendly with
them. The RSI people could take some lessons from Yorick.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@astrog.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Non-Blocking I/O
Next Topic: How do I prevent underflow errors?

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

Current Time: Sat Oct 11 03:50:08 PDT 2025

Total time taken to generate the page: 1.60097 seconds