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