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 #33809 is a reply to message #33713] Fri, 24 January 2003 11:29 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Pepijn Kenter" <kenter@tpd.tno.nl> writes:
> "Kenneth Bowman" <k-bowman@null.tamu.edu> wrote in message
> news:k-bowman-4D0582.08381824012003@news.tamu.edu...
>> In article <b0rce6$23c$1@news.surfnet.nl>,
>> "Pepijn Kenter" <kenter@tpd.tno.nl> wrote:
>>
>>> And does any IDL-wizard know a similar trick to average each row/column
> of
>>> a?
>>> i.e. to replace the following lines:
>>>
>>> result = dblarr(3)
>>> for i = 0, 2 do result[i] = mean(a[*,i])
>>
>> That's an easy one:
>>
>> result1 = TOTAL(a, 1, /DOUBLE)/n1
>> result2 = TOTAL(a, 2, /DOUBLE)/n2
>>
>> where n1 and n2 are the sizes of the first and second dimensions,
>> respectively.
>>
>> Ken Bowman
>
> Thanks, but what I actually meant was a way where you can replace the mean
> function by any, arbitrary function.
> I forgot about the dimension parameter of the TOTAL function, so my example
> was a bad one. Sorry.

"Arbitrary function"? No. In more recent versions of IDL, quite a
number of built-in math functions have the ability to specify one or
more dimensions over which the function is to be applied. I have a
function called CMAPPLY, which may be useful with older versions of
IDL, and does many of those same things. One thing it can do is apply
an arbitrary function, but it won't necessarily be speedy. JD Smith
also has a DLM which did a lot of these kinds of things.

Good luck,
Craig

http://cow.physics.wisc.edu/~craigm/idl/idl.html (under Array/Set ops)

--
------------------------------------------------------------ --------------
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:04:54 PDT 2025

Total time taken to generate the page: 0.00446 seconds