LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE DCOPY(N,DX,INCX,DY,INCY) 00002 * .. Scalar Arguments .. 00003 INTEGER INCX,INCY,N 00004 * .. 00005 * .. Array Arguments .. 00006 DOUBLE PRECISION DX(*),DY(*) 00007 * .. 00008 * 00009 * Purpose 00010 * ======= 00011 * 00012 * DCOPY copies a vector, x, to a vector, y. 00013 * uses unrolled loops for increments equal to one. 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) THEN 00031 * 00032 * code for both increments equal to 1 00033 * 00034 * 00035 * clean-up loop 00036 * 00037 M = MOD(N,7) 00038 IF (M.NE.0) THEN 00039 DO I = 1,M 00040 DY(I) = DX(I) 00041 END DO 00042 IF (N.LT.7) RETURN 00043 END IF 00044 MP1 = M + 1 00045 DO I = MP1,N,7 00046 DY(I) = DX(I) 00047 DY(I+1) = DX(I+1) 00048 DY(I+2) = DX(I+2) 00049 DY(I+3) = DX(I+3) 00050 DY(I+4) = DX(I+4) 00051 DY(I+5) = DX(I+5) 00052 DY(I+6) = DX(I+6) 00053 END DO 00054 ELSE 00055 * 00056 * code for unequal increments or equal increments 00057 * not equal to 1 00058 * 00059 IX = 1 00060 IY = 1 00061 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 00062 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 00063 DO I = 1,N 00064 DY(IY) = DX(IX) 00065 IX = IX + INCX 00066 IY = IY + INCY 00067 END DO 00068 END IF 00069 RETURN 00070 END