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 #10952 is a reply to message #10936] Fri, 30 January 1998 00:00 Go to previous messageGo to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
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.

> Another idea:
>
> index = lindgen( jdim )
> for cnt = 0, idim-1 do begin
> calcmedian(cnt) = median( mat2(cnt*jdim+index) )
> end

Forget this. I thought this were a good idea, but it actually slows down
the calculation.

Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
[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: Thu Oct 09 20:47:46 PDT 2025

Total time taken to generate the page: 0.87603 seconds