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

Home » Public Forums » archive » Need help to optimize for speed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Need help to optimize for speed [message #20115] Tue, 16 May 2000 00:00
Hamid Kohen is currently offline  Hamid Kohen
Messages: 5
Registered: March 2000
Junior Member
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.

Any suggestions ?

Thanks.

Hamid


size1 = size(bscl) ;;; is 1000 x 1000
size2 = size(roi) ;;;; is about 50 x 50


print, 'Size of bscl is ', size1
print, 'Size of roi is ', size2


a = reform(bscl,size1(4))
b = reform(roi,size2(4))
nmatch = 0

print, 'searching'
for column = 0, size1(1) -1 do begin
for row = 0, size1(2) -1 do begin ; num
print,'row and col', row, col
sample = reform(extrac(bscl,column,row,size2(1),size2(2)),size2(4))
IF (array_match(sample,b)) THEN begin
nmatch = nmatch +1 ;;; length has to match
print, '-------------------------'
print,'We have a match at row of', row, ' and colof', column
print, 'The centriod is at ', row + size2(1)/2 , column +
size2(2)/2
print, extrac(bscl,column,row,size2(1),size2(2))
print, '-------------------------'
print, b
end
end
end
print, 'Number of matches', nmatch
print, ' success '
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Need help to optimize for speed
Next Topic: Re: Pretty-printing IDL code?

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

Current Time: Wed Oct 08 18:50:38 PDT 2025

Total time taken to generate the page: 0.00349 seconds