LAPACK 3.3.0
|
00001 SUBROUTINE CSWAP(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 * CSWAP interchanges two vectors. 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 COMPLEX CTEMP 00024 INTEGER I,IX,IY 00025 * .. 00026 IF (N.LE.0) RETURN 00027 IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 00028 * 00029 * code for unequal increments or equal increments not equal 00030 * to 1 00031 * 00032 IX = 1 00033 IY = 1 00034 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 00035 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 00036 DO 10 I = 1,N 00037 CTEMP = CX(IX) 00038 CX(IX) = CY(IY) 00039 CY(IY) = CTEMP 00040 IX = IX + INCX 00041 IY = IY + INCY 00042 10 CONTINUE 00043 RETURN 00044 * 00045 * code for both increments equal to 1 00046 20 DO 30 I = 1,N 00047 CTEMP = CX(I) 00048 CX(I) = CY(I) 00049 CY(I) = CTEMP 00050 30 CONTINUE 00051 RETURN 00052 END