Re: Performance of a loop [message #27341] |
Thu, 18 October 2001 08:34  |
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  |
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
|
|
|