Annotation of rpl/lapack/blas/dswap.f, revision 1.14
1.8 bertrand 1: *> \brief \b DSWAP
2: *
3: * =========== DOCUMENTATION ===========
4: *
1.13 bertrand 5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
1.8 bertrand 7: *
8: * Definition:
9: * ===========
10: *
11: * SUBROUTINE DSWAP(N,DX,INCX,DY,INCY)
1.13 bertrand 12: *
1.8 bertrand 13: * .. Scalar Arguments ..
14: * INTEGER INCX,INCY,N
15: * ..
16: * .. Array Arguments ..
17: * DOUBLE PRECISION DX(*),DY(*)
18: * ..
1.13 bertrand 19: *
1.8 bertrand 20: *
21: *> \par Purpose:
22: * =============
23: *>
24: *> \verbatim
25: *>
1.14 ! bertrand 26: *> DSWAP interchanges two vectors.
! 27: *> uses unrolled loops for increments equal to 1.
! 28: *> \endverbatim
! 29: *
! 30: * Arguments:
! 31: * ==========
! 32: *
! 33: *> \param[in] N
! 34: *> \verbatim
! 35: *> N is INTEGER
! 36: *> number of elements in input vector(s)
! 37: *> \endverbatim
! 38: *>
! 39: *> \param[in,out] DX
! 40: *> \verbatim
! 41: *> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
! 42: *> \endverbatim
! 43: *>
! 44: *> \param[in] INCX
! 45: *> \verbatim
! 46: *> INCX is INTEGER
! 47: *> storage spacing between elements of DX
! 48: *> \endverbatim
! 49: *>
! 50: *> \param[in,out] DY
! 51: *> \verbatim
! 52: *> DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
! 53: *> \endverbatim
! 54: *>
! 55: *> \param[in] INCY
! 56: *> \verbatim
! 57: *> INCY is INTEGER
! 58: *> storage spacing between elements of DY
1.8 bertrand 59: *> \endverbatim
60: *
61: * Authors:
62: * ========
63: *
1.13 bertrand 64: *> \author Univ. of Tennessee
65: *> \author Univ. of California Berkeley
66: *> \author Univ. of Colorado Denver
67: *> \author NAG Ltd.
1.8 bertrand 68: *
1.14 ! bertrand 69: *> \date November 2017
1.8 bertrand 70: *
71: *> \ingroup double_blas_level1
72: *
73: *> \par Further Details:
74: * =====================
75: *>
76: *> \verbatim
77: *>
78: *> jack dongarra, linpack, 3/11/78.
79: *> modified 12/3/93, array(1) declarations changed to array(*)
80: *> \endverbatim
81: *>
82: * =====================================================================
1.1 bertrand 83: SUBROUTINE DSWAP(N,DX,INCX,DY,INCY)
1.8 bertrand 84: *
1.14 ! bertrand 85: * -- Reference BLAS level1 routine (version 3.8.0) --
1.8 bertrand 86: * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
87: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.14 ! bertrand 88: * November 2017
1.8 bertrand 89: *
1.1 bertrand 90: * .. Scalar Arguments ..
91: INTEGER INCX,INCY,N
92: * ..
93: * .. Array Arguments ..
94: DOUBLE PRECISION DX(*),DY(*)
95: * ..
96: *
97: * =====================================================================
98: *
99: * .. Local Scalars ..
100: DOUBLE PRECISION DTEMP
101: INTEGER I,IX,IY,M,MP1
102: * ..
103: * .. Intrinsic Functions ..
104: INTRINSIC MOD
105: * ..
106: IF (N.LE.0) RETURN
1.7 bertrand 107: IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
1.1 bertrand 108: *
1.7 bertrand 109: * code for both increments equal to 1
1.1 bertrand 110: *
111: *
1.7 bertrand 112: * clean-up loop
1.1 bertrand 113: *
1.7 bertrand 114: M = MOD(N,3)
115: IF (M.NE.0) THEN
116: DO I = 1,M
117: DTEMP = DX(I)
118: DX(I) = DY(I)
119: DY(I) = DTEMP
120: END DO
121: IF (N.LT.3) RETURN
122: END IF
123: MP1 = M + 1
124: DO I = MP1,N,3
125: DTEMP = DX(I)
126: DX(I) = DY(I)
127: DY(I) = DTEMP
128: DTEMP = DX(I+1)
129: DX(I+1) = DY(I+1)
130: DY(I+1) = DTEMP
131: DTEMP = DX(I+2)
132: DX(I+2) = DY(I+2)
133: DY(I+2) = DTEMP
134: END DO
135: ELSE
1.1 bertrand 136: *
1.7 bertrand 137: * code for unequal increments or equal increments not equal
138: * to 1
1.1 bertrand 139: *
1.7 bertrand 140: IX = 1
141: IY = 1
142: IF (INCX.LT.0) IX = (-N+1)*INCX + 1
143: IF (INCY.LT.0) IY = (-N+1)*INCY + 1
144: DO I = 1,N
145: DTEMP = DX(IX)
146: DX(IX) = DY(IY)
147: DY(IY) = DTEMP
148: IX = IX + INCX
149: IY = IY + INCY
150: END DO
151: END IF
1.1 bertrand 152: RETURN
153: END
CVSweb interface <joel.bertrand@systella.fr>