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

Home » Public Forums » archive » Re: avoiding for loop when calculating median
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: avoiding for loop when calculating median [message #10937 is a reply to message #10936] Mon, 02 February 1998 00:00 Go to previous messageGo to previous message
George McCabe is currently offline  George McCabe
Messages: 23
Registered: June 1997
Junior Member
Thanks for your inputs, Alex.

following an earlier hint on the group I wrote the loop like you
describe, but without REFORM'ing the matrix. To be honest my matrix is
a large data cube, but I chose a 2D example to make the description less
opaque. The reduction in execution time was measured - 20%, which on 45
seconds is significant. When you say HUGE is that the scale of the
increase you experienced.

I didn't REFORM the data because I figured it wasn't worth the extra
step as the cube can be addressed directly as 1D. But if yours ran much
faster including the step to REFORMAT then I'll try it.

Thanks again, George

Alex Schuster wrote:
>
> Oops! I wrote:
>
>> I assume that mat is an idim x jdim array. mat(cnt,*) gives the elements
>> no. cnt, cnth+idim, cnth+2*idim etc., I guess it's easier to use
>> mat2=reform(mat), so all the elements are in line.
>
> Don't know why I wrote REFORM here, it's TRANSPOSE.
> I just tested this with an 5000x5000 float array, there is a HUGE
> difference in the execution time.
>
> Alex

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV VVVVVVVVV
George McCabe (HSTX) NASA / GSFC
Tel: (301)286-8283, Fax: (301)286-0212 Code 693, B2 R151
E-mail: george.mccabe@gsfc.nasa.gov Greenbelt, MD 20912
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: LMFIT -- stay away from it!
Next Topic: REAL DATA

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

Current Time: Fri Oct 10 14:23:59 PDT 2025

Total time taken to generate the page: 2.16311 seconds