Line | |
---|
1 | SUBROUTINE CSWAP(N,CX,INCX,CY,INCY) |
---|
2 | * .. Scalar Arguments .. |
---|
3 | INTEGER INCX,INCY,N |
---|
4 | * .. |
---|
5 | * .. Array Arguments .. |
---|
6 | COMPLEX CX(*),CY(*) |
---|
7 | * .. |
---|
8 | * |
---|
9 | * Purpose |
---|
10 | * ======= |
---|
11 | * |
---|
12 | * interchanges two vectors. |
---|
13 | * jack dongarra, linpack, 3/11/78. |
---|
14 | * modified 12/3/93, array(1) declarations changed to array(*) |
---|
15 | * |
---|
16 | * |
---|
17 | * .. Local Scalars .. |
---|
18 | COMPLEX CTEMP |
---|
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 | CTEMP = CX(IX) |
---|
33 | CX(IX) = CY(IY) |
---|
34 | CY(IY) = CTEMP |
---|
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 | CTEMP = CX(I) |
---|
43 | CX(I) = CY(I) |
---|
44 | CY(I) = CTEMP |
---|
45 | 30 CONTINUE |
---|
46 | RETURN |
---|
47 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.