LAPACK 3.3.0
|
00001 SUBROUTINE SCOPY(N,SX,INCX,SY,INCY) 00002 * .. Scalar Arguments .. 00003 INTEGER INCX,INCY,N 00004 * .. 00005 * .. Array Arguments .. 00006 REAL SX(*),SY(*) 00007 * .. 00008 * 00009 * Purpose 00010 * ======= 00011 * 00012 * SCOPY copies a vector, x, to a vector, y. 00013 * uses unrolled loops for increments equal to 1. 00014 * 00015 * Further Details 00016 * =============== 00017 * 00018 * jack dongarra, linpack, 3/11/78. 00019 * modified 12/3/93, array(1) declarations changed to array(*) 00020 * 00021 * ===================================================================== 00022 * 00023 * .. Local Scalars .. 00024 INTEGER I,IX,IY,M,MP1 00025 * .. 00026 * .. Intrinsic Functions .. 00027 INTRINSIC MOD 00028 * .. 00029 IF (N.LE.0) RETURN 00030 IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 00031 * 00032 * code for unequal increments or equal increments 00033 * not equal to 1 00034 * 00035 IX = 1 00036 IY = 1 00037 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 00038 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 00039 DO 10 I = 1,N 00040 SY(IY) = SX(IX) 00041 IX = IX + INCX 00042 IY = IY + INCY 00043 10 CONTINUE 00044 RETURN 00045 * 00046 * code for both increments equal to 1 00047 * 00048 * 00049 * clean-up loop 00050 * 00051 20 M = MOD(N,7) 00052 IF (M.EQ.0) GO TO 40 00053 DO 30 I = 1,M 00054 SY(I) = SX(I) 00055 30 CONTINUE 00056 IF (N.LT.7) RETURN 00057 40 MP1 = M + 1 00058 DO 50 I = MP1,N,7 00059 SY(I) = SX(I) 00060 SY(I+1) = SX(I+1) 00061 SY(I+2) = SX(I+2) 00062 SY(I+3) = SX(I+3) 00063 SY(I+4) = SX(I+4) 00064 SY(I+5) = SX(I+5) 00065 SY(I+6) = SX(I+6) 00066 50 CONTINUE 00067 RETURN 00068 END