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

Home » Public Forums » archive » Re: Need help to optimize for speed
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: Need help to optimize for speed [message #20110 is a reply to message #20109] Tue, 16 May 2000 00:00 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
From way of Hamid <kohen@jpl.nasa.gov> writes:



> Hi,
>
> I have this for loop that searches for a particular pattern (roi).
> This search takes for ever.
> Does anyone knows how to optimize this code for speed.

How about this?

ncols = size1(1)
cc = convol(bscl, roi, total(roi), /center, /edge_truncate)
wh = where(abs(cc - 1) LT 0.01, nmatches)
if nmatches GT 0 then begin
rows = wh / ncols - 1
cols = wh MOD ncols - 1
endif
...

This will find the best close matches, just a few of them, which you
can then examine in more detail, like you are already doing. ROWS and
COLS contain the row and column indices for each likely match.
Depending on how tolerant of noise you are, you can increase or reduce
the value of 0.01.

Just looking at your code, it seems that you are hurting yourself by
making lots of calls to EXTRAC, which is a function written in IDL.
Doing the array subscripting explicitly should speed things up some.

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
Previous Topic: Re: grayscale vs. color
Next Topic: Need help to optimize for speed

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

Current Time: Sat Oct 11 15:20:57 PDT 2025

Total time taken to generate the page: 0.22807 seconds