Line | |
---|
1 | SUBROUTINE DCOPY(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 | * copies a vector, x, to a vector, y. |
---|
13 | * uses unrolled loops for increments equal to one. |
---|
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 | DY(IY) = DX(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 | DY(I) = DX(I) |
---|
50 | 30 CONTINUE |
---|
51 | IF (N.LT.7) RETURN |
---|
52 | 40 MP1 = M + 1 |
---|
53 | DO 50 I = MP1,N,7 |
---|
54 | DY(I) = DX(I) |
---|
55 | DY(I+1) = DX(I+1) |
---|
56 | DY(I+2) = DX(I+2) |
---|
57 | DY(I+3) = DX(I+3) |
---|
58 | DY(I+4) = DX(I+4) |
---|
59 | DY(I+5) = DX(I+5) |
---|
60 | DY(I+6) = DX(I+6) |
---|
61 | 50 CONTINUE |
---|
62 | RETURN |
---|
63 | END |
---|
Note: See
TracBrowser
for help on using the repository browser.