Line | |
---|
1 | SUBROUTINE ZSWAP(N,ZX,INCX,ZY,INCY) |
---|
2 | * .. Scalar Arguments .. |
---|
3 | INTEGER INCX,INCY,N |
---|
4 | * .. |
---|
5 | * .. Array Arguments .. |
---|
6 | DOUBLE COMPLEX ZX(*),ZY(*) |
---|
7 | * .. |
---|
8 | * |
---|
9 | * Purpose |
---|
10 | * ======= |
---|
11 | * |
---|
12 | * interchanges two vectors. |
---|
13 | * jack dongarra, 3/11/78. |
---|
14 | * modified 12/3/93, array(1) declarations changed to array(*) |
---|
15 | * |
---|
16 | * |
---|
17 | * .. Local Scalars .. |
---|
18 | DOUBLE COMPLEX ZTEMP |
---|
19 | INTEGER I,IX,IY |
---|
20 | * .. |
---|
21 | IF (N.LE.0) RETURN |
---|
22 | IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 |
---|
23 | * |
---|
24 | * code for unequal increments or equal increments not equal |
---|
25 | * to 1 |
---|
26 | * |
---|
27 | IX = 1 |
---|
28 | IY = 1 |
---|
29 | IF (INCX.LT.0) IX = (-N+1)*INCX + 1 |
---|
30 | IF (INCY.LT.0) IY = (-N+1)*INCY + 1 |
---|
31 | DO 10 I = 1,N |
---|
32 | ZTEMP = ZX(IX) |
---|
33 | ZX(IX) = ZY(IY) |
---|
34 | ZY(IY) = ZTEMP |
---|
35 | IX = IX + INCX |
---|
36 | IY = IY + INCY |
---|
37 | 10 CONTINUE |
---|
38 | RETURN |
---|
39 | * |
---|
40 | * code for both increments equal to 1 |
---|
41 | 20 DO 30 I = 1,N |
---|
42 | ZTEMP = ZX(I) |
---|
43 | ZX(I) = ZY(I) |
---|
44 | ZY(I) = ZTEMP |
---|
45 | 30 CONTINUE |
---|
46 | RETURN |
---|
47 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.