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

Home » Public Forums » archive » Re: Performance of a loop
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: Performance of a loop [message #27341] Thu, 18 October 2001 08:34 Go to next message
Paul van Delst is currently offline  Paul van Delst
Messages: 364
Registered: March 1997
Senior Member
azM wrote:
>
> How can i speed up this procedure? It steps through a matrix of either
> 64x64x64, 128x128x128 or in the worst case 256x256x256.
>
> <==BEGIN IDL==>
> FOR i = init, limit, 1 DO BEGIN
> FOR j = init, limit, 1 DO BEGIN
> FOR k = init, limit, 1 DO BEGIN
> X=img_a(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
> Y=img_b(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
> sign_prob_map=TM_TEST(X,Y)
> spm_plot_statistic(i,j,k)= sign_prob_map(0)
> spm_plot_significance(i,j,k)= sign_prob_map(1)
> ENDFOR
> ENDFOR
> ENDFOR
> <== END IDL ==>

The easiest mod for some increase in speed:

<==BEGIN IDL==>
FOR k = init, limit, 1 DO BEGIN
FOR j = init, limit, 1 DO BEGIN
FOR i = init, limit, 1 DO BEGIN
X=img_a(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
Y=img_b(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
sign_prob_map=TM_TEST(X,Y)
spm_plot_statistic(i,j,k)= sign_prob_map(0)
spm_plot_significance(i,j,k)= sign_prob_map(1)
ENDFOR
ENDFOR
ENDFOR
<== END IDL ==>

assuming the guts of the inner loop can't be sped up somehow.

paulv

--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
Re: Performance of a loop [message #27419 is a reply to message #27341] Fri, 19 October 2001 13:29 Go to previous message
Martin Downing is currently offline  Martin Downing
Messages: 136
Registered: September 1998
Senior Member
Paul,
Im curious, can you explain why your modification should run faster?
cheers
Martin

--
----------------------------------------
Martin Downing,
Clinical Research Physicist,
Grampian Orthopaedic RSA Research Centre,
Woodend Hospital, Aberdeen, AB15 6LS.
Tel. 01224 556055 / 07903901612
Fax. 01224 556662

m.downing@abdn.ac.uk

"Paul van Delst" <paul.vandelst@noaa.gov> wrote in message
news:3BCEF673.6858D2A@noaa.gov...
> azM wrote:
>>
>> How can i speed up this procedure? It steps through a matrix of either
>> 64x64x64, 128x128x128 or in the worst case 256x256x256.
>>
>> <==BEGIN IDL==>
>> FOR i = init, limit, 1 DO BEGIN
>> FOR j = init, limit, 1 DO BEGIN
>> FOR k = init, limit, 1 DO BEGIN
>> X=img_a(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
>> Y=img_b(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
>> sign_prob_map=TM_TEST(X,Y)
>> spm_plot_statistic(i,j,k)= sign_prob_map(0)
>> spm_plot_significance(i,j,k)= sign_prob_map(1)
>> ENDFOR
>> ENDFOR
>> ENDFOR
>> <== END IDL ==>
>
> The easiest mod for some increase in speed:
>
> <==BEGIN IDL==>
> FOR k = init, limit, 1 DO BEGIN
> FOR j = init, limit, 1 DO BEGIN
> FOR i = init, limit, 1 DO BEGIN
> X=img_a(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
> Y=img_b(i:kernel_dim+i,j:kernel_dim+j,k:kernel_dim+k)
> sign_prob_map=TM_TEST(X,Y)
> spm_plot_statistic(i,j,k)= sign_prob_map(0)
> spm_plot_significance(i,j,k)= sign_prob_map(1)
> ENDFOR
> ENDFOR
> ENDFOR
> <== END IDL ==>
>
> assuming the guts of the inner loop can't be sped up somehow.
>
> paulv
>
> --
> Paul van Delst Religious and cultural
> CIMSS @ NOAA/NCEP purity is a fundamentalist
> Ph: (301)763-8000 x7274 fantasy
> Fax:(301)763-8545 V.S.Naipaul
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Widget_Draw - Help
Next Topic: using an unlnown number of keywords

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

Current Time: Wed Oct 08 19:24:36 PDT 2025

Total time taken to generate the page: 0.00490 seconds