Re: Avoiding loop in stats [message #52147] |
Sun, 21 January 2007 08:01 |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
On Sun, 21 Jan 2007, yp wrote:
> On Jan 19, 8:26 pm, FÖLDY Lajos <f...@rmki.kfki.hu> wrote:
>> Some speedup can be achieved with optimized memory access (if you have
>> enough memory for two copies of data):
>>
>> temp=transpose(data, [2,0,1])
>> for j=0l,2000l-1 do for i=0l,4000l-1 do data_st[i,j]=st_func(temp[*,i,j])
>>
>> regards,
>> lajos- Hide quoted text -- Show quoted text -
>
> Thanks Lajos,
> It does improve the speed by >35%. Quite useful :)
> btw is it necessary to copy data into temp var? I did not see any
> difference when I overwrote data with transposed data.
> --yas
>
I didn't want to destroy your original data structure. You can use data
instead of temp if you like (but transpose will still use extra memory).
regards,
lajos
|
|
|
Re: Avoiding loop in stats [message #52148 is a reply to message #52147] |
Sun, 21 January 2007 05:11  |
yp
Messages: 42 Registered: February 2005
|
Member |
|
|
On Jan 19, 8:26 pm, FÖLDY Lajos <f...@rmki.kfki.hu> wrote:
> Some speedup can be achieved with optimized memory access (if you have
> enough memory for two copies of data):
>
> temp=transpose(data, [2,0,1])
> for j=0l,2000l-1 do for i=0l,4000l-1 do data_st[i,j]=st_func(temp[*,i,j])
>
> regards,
> lajos- Hide quoted text -- Show quoted text -
Thanks Lajos,
It does improve the speed by >35%. Quite useful :)
btw is it necessary to copy data into temp var? I did not see any
difference when I overwrote data with transposed data.
--yas
|
|
|