Line | |
---|
1 | SUBROUTINE SCOPY(N,SX,INCX,SY,INCY) |
---|
2 | * .. Scalar Arguments .. |
---|
3 | INTEGER INCX,INCY,N |
---|
4 | * .. |
---|
5 | * .. Array Arguments .. |
---|
6 | REAL SX(*),SY(*) |
---|
7 | * .. |
---|
8 | * |
---|
9 | * Purpose |
---|
10 | * ======= |
---|
11 | * |
---|
12 | * copies a vector, x, to a vector, y. |
---|
13 | * uses unrolled loops for increments equal to 1. |
---|
14 | * jack dongarra, linpack, 3/11/78. |
---|
15 | * modified 12/3/93, array(1) declarations changed to array(*) |
---|
16 | * |
---|
17 | * |
---|
18 | * .. Local Scalars .. |
---|
19 | INTEGER I,IX,IY,M,MP1 |
---|
20 | * .. |
---|
21 | * .. Intrinsic Functions .. |
---|
22 | INTRINSIC MOD |
---|
23 | * .. |
---|
24 | IF (N.LE.0) RETURN |
---|
25 | IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 |
---|
26 | * |
---|
27 | * code for unequal increments or equal increments |
---|
28 | * not equal to 1 |
---|
29 | * |
---|
30 | IX = 1 |
---|
31 | IY = 1 |
---|
32 | IF (INCX.LT.0) IX = (-N+1)*INCX + 1 |
---|
33 | IF (INCY.LT.0) IY = (-N+1)*INCY + 1 |
---|
34 | DO 10 I = 1,N |
---|
35 | SY(IY) = SX(IX) |
---|
36 | IX = IX + INCX |
---|
37 | IY = IY + INCY |
---|
38 | 10 CONTINUE |
---|
39 | RETURN |
---|
40 | * |
---|
41 | * code for both increments equal to 1 |
---|
42 | * |
---|
43 | * |
---|
44 | * clean-up loop |
---|
45 | * |
---|
46 | 20 M = MOD(N,7) |
---|
47 | IF (M.EQ.0) GO TO 40 |
---|
48 | DO 30 I = 1,M |
---|
49 | SY(I) = SX(I) |
---|
50 | 30 CONTINUE |
---|
51 | IF (N.LT.7) RETURN |
---|
52 | 40 MP1 = M + 1 |
---|
53 | DO 50 I = MP1,N,7 |
---|
54 | SY(I) = SX(I) |
---|
55 | SY(I+1) = SX(I+1) |
---|
56 | SY(I+2) = SX(I+2) |
---|
57 | SY(I+3) = SX(I+3) |
---|
58 | SY(I+4) = SX(I+4) |
---|
59 | SY(I+5) = SX(I+5) |
---|
60 | SY(I+6) = SX(I+6) |
---|
61 | 50 CONTINUE |
---|
62 | RETURN |
---|
63 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.