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

Home » Public Forums » archive » simple array math 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: simple array math question [message #33786 is a reply to message #33713] Mon, 27 January 2003 11:54 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
JD Smith <jdsmith@as.arizona.edu> writes:

> On Sun, 26 Jan 2003 13:11:31 -0700, Craig Markwardt wrote:
>
>
>> Heinz Stege <reply_to_posting@arcor.de> writes:
>>>
>>> Thanks a lot for this very instructive contribution! Since the
>>> proposal of the intarr() method was from me, the NG may allow me to
>>> state this here.
>>>
>>> REBIN(REFORM(...)) is the better alternative. This is obvious now.
>>
>> "Better" can be defined in a lot of ways. Your solution is by far the
>> most readable way, in my view, to extend arrays. And it's cool because
>> nobody seems to have discovered it before!
>>
>> Speed is only king when you need a king.
>
>
> Well put. Ideally, IDL would have an intrinsic, readable, "inflate"
> operator to do what we're all doing in roundabout, quasi-readable ways
> right now. Maybe something like:
>
> IDL> a=findgen(10,12,14)
> IDL> g=a[3;7]*randomu(sd,10,12,7,14)

Yorick, a language very similar to IDL, but sadly not very popular,
has some very cool ways to do this. The first is a "pseudo-index"
which automatically introduces dimensions of length one.

a[*,*,-,*] would be a 10x12x1x14 array, the "-" introducing the extra
dimension. Yorick has a separate meaning for the "*"
operator but I mean it here in the normal IDL sense.

The second thing is "broadcasting," which automatically extends
dimensions of length 1. Thus, in the expression,

a[*,*,-,*] * randomu(sd,10,12,7,14)

The 3rd dimension is automatically extended to length 7 by replicating
A. Someone has already thought about these things (Yorick's author,
David Munro), and they are very cool!

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
Previous Topic: Re: Polyfill, z-buffer & postscript
Next Topic: True size of a gzip compressed file?

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

Current Time: Wed Oct 08 13:05:27 PDT 2025

Total time taken to generate the page: 0.00409 seconds