 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ dswap()

 subroutine dswap ( integer N, double precision, dimension(*) DX, integer INCX, double precision, dimension(*) DY, integer INCY )

DSWAP

Purpose:
```    DSWAP interchanges two vectors.
uses unrolled loops for increments equal to 1.```
Parameters
 [in] N ``` N is INTEGER number of elements in input vector(s)``` [in,out] DX ` DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )` [in] INCX ``` INCX is INTEGER storage spacing between elements of DX``` [in,out] DY ` DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )` [in] INCY ``` INCY is INTEGER storage spacing between elements of DY```
Further Details:
```     jack dongarra, linpack, 3/11/78.
modified 12/3/93, array(1) declarations changed to array(*)```

Definition at line 81 of file dswap.f.

82 *
83 * -- Reference BLAS level1 routine --
84 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
85 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
86 *
87 * .. Scalar Arguments ..
88  INTEGER INCX,INCY,N
89 * ..
90 * .. Array Arguments ..
91  DOUBLE PRECISION DX(*),DY(*)
92 * ..
93 *
94 * =====================================================================
95 *
96 * .. Local Scalars ..
97  DOUBLE PRECISION DTEMP
98  INTEGER I,IX,IY,M,MP1
99 * ..
100 * .. Intrinsic Functions ..
101  INTRINSIC mod
102 * ..
103  IF (n.LE.0) RETURN
104  IF (incx.EQ.1 .AND. incy.EQ.1) THEN
105 *
106 * code for both increments equal to 1
107 *
108 *
109 * clean-up loop
110 *
111  m = mod(n,3)
112  IF (m.NE.0) THEN
113  DO i = 1,m
114  dtemp = dx(i)
115  dx(i) = dy(i)
116  dy(i) = dtemp
117  END DO
118  IF (n.LT.3) RETURN
119  END IF
120  mp1 = m + 1
121  DO i = mp1,n,3
122  dtemp = dx(i)
123  dx(i) = dy(i)
124  dy(i) = dtemp
125  dtemp = dx(i+1)
126  dx(i+1) = dy(i+1)
127  dy(i+1) = dtemp
128  dtemp = dx(i+2)
129  dx(i+2) = dy(i+2)
130  dy(i+2) = dtemp
131  END DO
132  ELSE
133 *
134 * code for unequal increments or equal increments not equal
135 * to 1
136 *
137  ix = 1
138  iy = 1
139  IF (incx.LT.0) ix = (-n+1)*incx + 1
140  IF (incy.LT.0) iy = (-n+1)*incy + 1
141  DO i = 1,n
142  dtemp = dx(ix)
143  dx(ix) = dy(iy)
144  dy(iy) = dtemp
145  ix = ix + incx
146  iy = iy + incy
147  END DO
148  END IF
149  RETURN
150 *
151 * End of DSWAP
152 *