LAPACK 3.3.1
Linear Algebra PACKage

ccopy.f

Go to the documentation of this file.
00001       SUBROUTINE CCOPY(N,CX,INCX,CY,INCY)
00002 *     .. Scalar Arguments ..
00003       INTEGER INCX,INCY,N
00004 *     ..
00005 *     .. Array Arguments ..
00006       COMPLEX CX(*),CY(*)
00007 *     ..
00008 *
00009 *  Purpose
00010 *  =======
00011 *
00012 *     CCOPY copies a vector x to a vector y.
00013 *
00014 *  Further Details
00015 *  ===============
00016 *
00017 *     jack dongarra, linpack, 3/11/78.
00018 *     modified 12/3/93, array(1) declarations changed to array(*)
00019 *
00020 *  =====================================================================
00021 *
00022 *     .. Local Scalars ..
00023       INTEGER I,IX,IY
00024 *     ..
00025       IF (N.LE.0) RETURN
00026       IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
00027 *
00028 *        code for both increments equal to 1
00029 *
00030          DO I = 1,N
00031             CY(I) = CX(I)
00032          END DO
00033       ELSE
00034 *
00035 *        code for unequal increments or equal increments
00036 *          not equal to 1
00037 *
00038          IX = 1
00039          IY = 1
00040          IF (INCX.LT.0) IX = (-N+1)*INCX + 1
00041          IF (INCY.LT.0) IY = (-N+1)*INCY + 1
00042          DO I = 1,N
00043             CY(IY) = CX(IX)
00044             IX = IX + INCX
00045             IY = IY + INCY
00046          END DO
00047       END IF
00048       RETURN
00049       END
 All Files Functions