Re: Fast shear [message #29179 is a reply to message #29122] |
Thu, 07 February 2002 09:41   |
k-bowman
Messages: 12 Registered: December 2001
|
Junior Member |
|
|
In article <3C60199D.E4810C70@mpb.gsfc.nasa.gov>, Wayne Landsman <landsman@mpb.gsfc.nasa.gov> wrote:
> for i = 0, n-1 DO array[*,i] = SHIFT(array[*,i],delta[i])
>
> which in this case means to rewrite the assignment as
>
> for i = 0, n-1 DO array[0,i] = SHIFT(array[*,i],delta[i])
>
> I believe that one uses an asterisk on the left hand side, that
> IDL first creates a temporary variable, places the contents of the right
> hand side into this temporary variable, and then places the temporary
> variable back into array. By specifying array[0,i] one directly
> gives the starting location where to place the contents of the right
> hand side.
I thought that using an asterisk on the LHS meant that IDL created a temporary index array, i.e.
for i = 0, n-1 DO array[[0,1,2,3,...,m-1],i] = SHIFT(array[*,i],delta[i])
where m is the size of the first dimension. The slow down is due to the the indirect array indexing.
The fast method (e.g., array[0,i] = ...) specifies where to start storing the RHS, so it only works for the first dimension (that is, in memory order).
Ken
|
|
|