Return to sub_shift.f CVS log Up to [Development] / JSOC / proj / timed / apps

 File: [Development] / JSOC / proj / timed / apps / sub_shift.f (download) Revision: 1.1, Tue Nov 15 20:32:58 2011 UTC (11 years, 6 months ago) by rick Branch: MAIN CVS Tags: Ver_LATEST, Ver_9-5, Ver_9-41, Ver_9-4, Ver_9-3, Ver_9-2, Ver_9-1, Ver_9-0, Ver_8-8, Ver_8-7, Ver_8-6, Ver_8-5, Ver_8-4, Ver_8-3, Ver_8-2, Ver_8-12, Ver_8-11, Ver_8-10, Ver_8-1, Ver_8-0, Ver_7-1, Ver_7-0, Ver_6-4, Ver_6-3, Ver_6-2, Ver_6-1, Ver_6-0, HEAD ```added for JSOC release 6.0 ```

```      SUBROUTINE shift(x,n,delta)
CC     x(n) is the original data array for shift.
CC     delta is the value to be shifted, and the
CC     routine returns x(n) after shifting.
DIMENSION x(n), y1((n+1)/2), y2((n+1)/2)
DIMENSION y1_temp((n+1)/2),y2_temp((n+1)/2)
REAL delta
CC     first is to divide x(n) into 2 sub-arrays
DO 5 i=1, (n+1)/2
y1(i)=x((n+1)/2+i-1)
y2(i)=x((n+1)/2-i+1)
5    CONTINUE

IF(delta.GE.0.) THEN
m=INT(delta)
del=delta-m
DO 15 i=m+2, (n+1)/2
y1_temp(i)=y1(i-m-1)+(y1(i-m)-y1(i-m-1))*(1-del)
y2_temp(i)=y2(i-m-1)+(y2(i-m)-y2(i-m-1))*(1-del)
15      ENDDO
DO 16 i=1, m+1
y1_temp(i)=y1(1)-(y1(2)-y1(1))*(i+del-1)
y2_temp(i)=y2(1)-(y2(2)-y2(1))*(i+del-1)
16 	 ENDDO

ELSE
m=INT(-delta)
del=-delta-m
DO 20 i=1, (n+1)/2-(m+1)
y1_temp(i)=y1(i+m)+(y1(i+m+1)-y1(i+m))*(del)
y2_temp(i)=y2(i+m)+(y2(i+m+1)-y2(i+m))*(del)
20      ENDDO
ENDIF

DO 25 i=1,(n+1)/2
x(i)=y2_temp((n+1)/2-i+1)
x(i+(n+1)/2-1)=y1_temp(i)
25   ENDDO
x((n+1)/2)=y1(1)

RETURN
END
```