LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
zswap.f
Go to the documentation of this file.
1 *> \brief \b ZSWAP
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE ZSWAP(N,ZX,INCX,ZY,INCY)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,INCY,N
15 * ..
16 * .. Array Arguments ..
17 * COMPLEX*16 ZX(*),ZY(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> ZSWAP interchanges two vectors.
27 *> \endverbatim
28 *
29 * Arguments:
30 * ==========
31 *
32 *> \param[in] N
33 *> \verbatim
34 *> N is INTEGER
35 *> number of elements in input vector(s)
36 *> \endverbatim
37 *>
38 *> \param[in,out] ZX
39 *> \verbatim
40 *> ZX is COMPLEX*16 array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
41 *> \endverbatim
42 *>
43 *> \param[in] INCX
44 *> \verbatim
45 *> INCX is INTEGER
46 *> storage spacing between elements of ZX
47 *> \endverbatim
48 *>
49 *> \param[in,out] ZY
50 *> \verbatim
51 *> ZY is COMPLEX*16 array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
52 *> \endverbatim
53 *>
54 *> \param[in] INCY
55 *> \verbatim
56 *> INCY is INTEGER
57 *> storage spacing between elements of ZY
58 *> \endverbatim
59 *
60 * Authors:
61 * ========
62 *
63 *> \author Univ. of Tennessee
64 *> \author Univ. of California Berkeley
65 *> \author Univ. of Colorado Denver
66 *> \author NAG Ltd.
67 *
68 *> \date November 2017
69 *
70 *> \ingroup complex16_blas_level1
71 *
72 *> \par Further Details:
73 * =====================
74 *>
75 *> \verbatim
76 *>
77 *> jack dongarra, 3/11/78.
78 *> modified 12/3/93, array(1) declarations changed to array(*)
79 *> \endverbatim
80 *>
81 * =====================================================================
82  SUBROUTINE zswap(N,ZX,INCX,ZY,INCY)
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*16 ZX(*),ZY(*)
94 * ..
95 *
96 * =====================================================================
97 *
98 * .. Local Scalars ..
99  COMPLEX*16 ZTEMP
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  ztemp = zx(i)
108  zx(i) = zy(i)
109  zy(i) = ztemp
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  ztemp = zx(ix)
122  zx(ix) = zy(iy)
123  zy(iy) = ztemp
124  ix = ix + incx
125  iy = iy + incy
126  END DO
127  END IF
128  RETURN
129  END
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
Definition: zswap.f:83