Annotation of rpl/lapack/blas/dswap.f, revision 1.9
1.8 bertrand 1: *> \brief \b DSWAP
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 DSWAP(N,DX,INCX,DY,INCY)
12: *
13: * .. Scalar Arguments ..
14: * INTEGER INCX,INCY,N
15: * ..
16: * .. Array Arguments ..
17: * DOUBLE PRECISION DX(*),DY(*)
18: * ..
19: *
20: *
21: *> \par Purpose:
22: * =============
23: *>
24: *> \verbatim
25: *>
26: *> interchanges two vectors.
27: *> uses unrolled loops for increments equal one.
28: *> \endverbatim
29: *
30: * Authors:
31: * ========
32: *
33: *> \author Univ. of Tennessee
34: *> \author Univ. of California Berkeley
35: *> \author Univ. of Colorado Denver
36: *> \author NAG Ltd.
37: *
38: *> \date November 2011
39: *
40: *> \ingroup double_blas_level1
41: *
42: *> \par Further Details:
43: * =====================
44: *>
45: *> \verbatim
46: *>
47: *> jack dongarra, linpack, 3/11/78.
48: *> modified 12/3/93, array(1) declarations changed to array(*)
49: *> \endverbatim
50: *>
51: * =====================================================================
1.1 bertrand 52: SUBROUTINE DSWAP(N,DX,INCX,DY,INCY)
1.8 bertrand 53: *
54: * -- Reference BLAS level1 routine (version 3.4.0) --
55: * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
56: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
57: * November 2011
58: *
1.1 bertrand 59: * .. Scalar Arguments ..
60: INTEGER INCX,INCY,N
61: * ..
62: * .. Array Arguments ..
63: DOUBLE PRECISION DX(*),DY(*)
64: * ..
65: *
66: * =====================================================================
67: *
68: * .. Local Scalars ..
69: DOUBLE PRECISION DTEMP
70: INTEGER I,IX,IY,M,MP1
71: * ..
72: * .. Intrinsic Functions ..
73: INTRINSIC MOD
74: * ..
75: IF (N.LE.0) RETURN
1.7 bertrand 76: IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
1.1 bertrand 77: *
1.7 bertrand 78: * code for both increments equal to 1
1.1 bertrand 79: *
80: *
1.7 bertrand 81: * clean-up loop
1.1 bertrand 82: *
1.7 bertrand 83: M = MOD(N,3)
84: IF (M.NE.0) THEN
85: DO I = 1,M
86: DTEMP = DX(I)
87: DX(I) = DY(I)
88: DY(I) = DTEMP
89: END DO
90: IF (N.LT.3) RETURN
91: END IF
92: MP1 = M + 1
93: DO I = MP1,N,3
94: DTEMP = DX(I)
95: DX(I) = DY(I)
96: DY(I) = DTEMP
97: DTEMP = DX(I+1)
98: DX(I+1) = DY(I+1)
99: DY(I+1) = DTEMP
100: DTEMP = DX(I+2)
101: DX(I+2) = DY(I+2)
102: DY(I+2) = DTEMP
103: END DO
104: ELSE
1.1 bertrand 105: *
1.7 bertrand 106: * code for unequal increments or equal increments not equal
107: * to 1
1.1 bertrand 108: *
1.7 bertrand 109: IX = 1
110: IY = 1
111: IF (INCX.LT.0) IX = (-N+1)*INCX + 1
112: IF (INCY.LT.0) IY = (-N+1)*INCY + 1
113: DO I = 1,N
114: DTEMP = DX(IX)
115: DX(IX) = DY(IY)
116: DY(IY) = DTEMP
117: IX = IX + INCX
118: IY = IY + INCY
119: END DO
120: END IF
1.1 bertrand 121: RETURN
122: END
CVSweb interface <joel.bertrand@systella.fr>