Annotation of rpl/lapack/blas/dswap.f, revision 1.2
1.1 bertrand 1: SUBROUTINE DSWAP(N,DX,INCX,DY,INCY)
2: * .. Scalar Arguments ..
3: INTEGER INCX,INCY,N
4: * ..
5: * .. Array Arguments ..
6: DOUBLE PRECISION DX(*),DY(*)
7: * ..
8: *
9: * Purpose
10: * =======
11: *
12: * interchanges two vectors.
13: * uses unrolled loops for increments equal one.
14: *
15: * Further Details
16: * ===============
17: *
18: * jack dongarra, linpack, 3/11/78.
19: * modified 12/3/93, array(1) declarations changed to array(*)
20: *
21: * =====================================================================
22: *
23: * .. Local Scalars ..
24: DOUBLE PRECISION DTEMP
25: INTEGER I,IX,IY,M,MP1
26: * ..
27: * .. Intrinsic Functions ..
28: INTRINSIC MOD
29: * ..
30: IF (N.LE.0) RETURN
31: IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20
32: *
33: * code for unequal increments or equal increments not equal
34: * to 1
35: *
36: IX = 1
37: IY = 1
38: IF (INCX.LT.0) IX = (-N+1)*INCX + 1
39: IF (INCY.LT.0) IY = (-N+1)*INCY + 1
40: DO 10 I = 1,N
41: DTEMP = DX(IX)
42: DX(IX) = DY(IY)
43: DY(IY) = DTEMP
44: IX = IX + INCX
45: IY = IY + INCY
46: 10 CONTINUE
47: RETURN
48: *
49: * code for both increments equal to 1
50: *
51: *
52: * clean-up loop
53: *
54: 20 M = MOD(N,3)
55: IF (M.EQ.0) GO TO 40
56: DO 30 I = 1,M
57: DTEMP = DX(I)
58: DX(I) = DY(I)
59: DY(I) = DTEMP
60: 30 CONTINUE
61: IF (N.LT.3) RETURN
62: 40 MP1 = M + 1
63: DO 50 I = MP1,N,3
64: DTEMP = DX(I)
65: DX(I) = DY(I)
66: DY(I) = DTEMP
67: DTEMP = DX(I+1)
68: DX(I+1) = DY(I+1)
69: DY(I+1) = DTEMP
70: DTEMP = DX(I+2)
71: DX(I+2) = DY(I+2)
72: DY(I+2) = DTEMP
73: 50 CONTINUE
74: RETURN
75: END
CVSweb interface <joel.bertrand@systella.fr>