LAPACK 3.3.0

dcopy.f

Go to the documentation of this file.
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) 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           DY(IY) = DX(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           DY(I) = DX(I)
00055    30 CONTINUE
00056       IF (N.LT.7) RETURN
00057    40 MP1 = M + 1
00058       DO 50 I = MP1,N,7
00059           DY(I) = DX(I)
00060           DY(I+1) = DX(I+1)
00061           DY(I+2) = DX(I+2)
00062           DY(I+3) = DX(I+3)
00063           DY(I+4) = DX(I+4)
00064           DY(I+5) = DX(I+5)
00065           DY(I+6) = DX(I+6)
00066    50 CONTINUE
00067       RETURN
00068       END
 All Files Functions