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

Home » Public Forums » archive » Re: max, mean, min of array
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: max, mean, min of array [message #29004 is a reply to message #28924] Thu, 24 January 2002 07:29 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Alex Schuster <Wonko@planet-interkom.de> writes:
> It's possible without, um, with fewer loops:
>
> zdim = (size( array, /dimension ))[2]
> pixmin = ( pixmax = array[*,*,0] )
> for i = 1, zdim-1 do begin
> pixmax = pixmax > array[*,*,i]
> pixmin = pixmin < array[*,*,i]
> endfor
> pixmean = total( array, 3 ) / zdim
>
> Hey Craig, I think with this method you can get rid of your ho, hum
> comment in cmapply.pro.

Very cool! I think I've been "outvectored" on this one.

Alex, I think *both* solutions should be possible. Consider the
following scenario: instead of a 400x400x12 array, how about a
2x2x1000000 array? Using your technique we would end up doing 1000000
iterations, but with mine it would only be 4.

Thus, the code should contain both solutions, and pick whichever one
takes fewer iterations.

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
Previous Topic: Re: Urgent object question
Next Topic: Urgent object question

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

Current Time: Wed Oct 08 13:12:14 PDT 2025

Total time taken to generate the page: 0.00172 seconds