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

Home » Public Forums » archive » Re: Help with program speed (Recursive Merging Function)
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
Re: Help with program speed (Recursive Merging Function) [message #61192] Wed, 09 July 2008 06:20
crd319 is currently offline  crd319
Messages: 5
Registered: June 2008
Junior Member
On Jul 8, 4:32 pm, Jean H <jghas...@DELTHIS.ucalgary.ANDTHIS.ca>
wrote:
> Hi,
>
> one thing you could do is to keep track of who is neighbor of whom.
> Build an array with one entry per "block", identify the neighbors
> (likely the Moore neighborhood, for the first step). Then, when you want
> to process block N, just look in the table who are the neighbors. Do
> your computation and if you merge 2 block, add the neighbors of block2
> to the neighbors of block1, remove block2 from the list of neighbors of
> block1 and, eventually (not required), delete the entry corresponding to
> block2.
>
Thanks for the suggestion. By moving those three lines of code, I cut
my time down from 400 seconds to 5 seconds. Much more manageable.
Ill probably look at the other way to cut down on time, but for now
this is manageable and I have a deadline for this. Thanks for the
help.

Chris
> By doing this, you will NOT compare every block with every other blocks!
>
> *************
>
> In the meanwhile, if you want to keep using your loops, move the calls to
>
> p2 = n_elements(blk2)
> LBP_C2 = LBP_OVER_C(blk2)
> hist2 = HIST_2D(LBP_C2.LBP, LBP_C2.C, max1=255, max2=bins-1)
>
> in the "if..." section. There is no need to compute that if your blocks
> are not neighbors!
>
> Jean
Re: Help with program speed (Recursive Merging Function) [message #61219 is a reply to message #61192] Tue, 08 July 2008 13:32 Go to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Hi,

one thing you could do is to keep track of who is neighbor of whom.
Build an array with one entry per "block", identify the neighbors
(likely the Moore neighborhood, for the first step). Then, when you want
to process block N, just look in the table who are the neighbors. Do
your computation and if you merge 2 block, add the neighbors of block2
to the neighbors of block1, remove block2 from the list of neighbors of
block1 and, eventually (not required), delete the entry corresponding to
block2.

By doing this, you will NOT compare every block with every other blocks!

*************

In the meanwhile, if you want to keep using your loops, move the calls to

p2 = n_elements(blk2)
LBP_C2 = LBP_OVER_C(blk2)
hist2 = HIST_2D(LBP_C2.LBP, LBP_C2.C, max1=255, max2=bins-1)

in the "if..." section. There is no need to compute that if your blocks
are not neighbors!

Jean
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: shap file problem
Next Topic: 32/64 bit sav

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

Current Time: Wed Oct 08 17:24:33 PDT 2025

Total time taken to generate the page: 0.00392 seconds