LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ cswap()

subroutine cswap ( integer  N,
complex, dimension(*)  CX,
integer  INCX,
complex, dimension(*)  CY,
integer  INCY 
)

CSWAP

Purpose:
   CSWAP interchanges two vectors.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in,out]CX
          CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of CX
[in,out]CY
          CY is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
[in]INCY
          INCY is INTEGER
         storage spacing between elements of CY
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 83 of file cswap.f.

83 *
84 * -- Reference BLAS level1 routine (version 3.8.0) --
85 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
86 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
87 * November 2017
88 *
89 * .. Scalar Arguments ..
90  INTEGER INCX,INCY,N
91 * ..
92 * .. Array Arguments ..
93  COMPLEX CX(*),CY(*)
94 * ..
95 *
96 * =====================================================================
97 *
98 * .. Local Scalars ..
99  COMPLEX CTEMP
100  INTEGER I,IX,IY
101 * ..
102  IF (n.LE.0) RETURN
103  IF (incx.EQ.1 .AND. incy.EQ.1) THEN
104 *
105 * code for both increments equal to 1
106  DO i = 1,n
107  ctemp = cx(i)
108  cx(i) = cy(i)
109  cy(i) = ctemp
110  END DO
111  ELSE
112 *
113 * code for unequal increments or equal increments not equal
114 * to 1
115 *
116  ix = 1
117  iy = 1
118  IF (incx.LT.0) ix = (-n+1)*incx + 1
119  IF (incy.LT.0) iy = (-n+1)*incy + 1
120  DO i = 1,n
121  ctemp = cx(ix)
122  cx(ix) = cy(iy)
123  cy(iy) = ctemp
124  ix = ix + incx
125  iy = iy + incy
126  END DO
127  END IF
128  RETURN