root / src / blas / ddot.f @ 10
Historique | Voir | Annoter | Télécharger (1,46 ko)
1 | 1 | pfleura2 | DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) |
---|---|---|---|
2 | 1 | pfleura2 | * .. Scalar Arguments .. |
3 | 1 | pfleura2 | INTEGER INCX,INCY,N |
4 | 1 | pfleura2 | * .. |
5 | 1 | pfleura2 | * .. Array Arguments .. |
6 | 1 | pfleura2 | DOUBLE PRECISION DX(*),DY(*) |
7 | 1 | pfleura2 | * .. |
8 | 1 | pfleura2 | * |
9 | 1 | pfleura2 | * Purpose |
10 | 1 | pfleura2 | * ======= |
11 | 1 | pfleura2 | * |
12 | 1 | pfleura2 | * forms the dot product of two vectors. |
13 | 1 | pfleura2 | * uses unrolled loops for increments equal to one. |
14 | 1 | pfleura2 | * jack dongarra, linpack, 3/11/78. |
15 | 1 | pfleura2 | * modified 12/3/93, array(1) declarations changed to array(*) |
16 | 1 | pfleura2 | * |
17 | 1 | pfleura2 | * |
18 | 1 | pfleura2 | * .. Local Scalars .. |
19 | 1 | pfleura2 | DOUBLE PRECISION DTEMP |
20 | 1 | pfleura2 | INTEGER I,IX,IY,M,MP1 |
21 | 1 | pfleura2 | * .. |
22 | 1 | pfleura2 | * .. Intrinsic Functions .. |
23 | 1 | pfleura2 | INTRINSIC MOD |
24 | 1 | pfleura2 | * .. |
25 | 1 | pfleura2 | DDOT = 0.0d0 |
26 | 1 | pfleura2 | DTEMP = 0.0d0 |
27 | 1 | pfleura2 | IF (N.LE.0) RETURN |
28 | 1 | pfleura2 | IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20 |
29 | 1 | pfleura2 | * |
30 | 1 | pfleura2 | * code for unequal increments or equal increments |
31 | 1 | pfleura2 | * not equal to 1 |
32 | 1 | pfleura2 | * |
33 | 1 | pfleura2 | IX = 1 |
34 | 1 | pfleura2 | IY = 1 |
35 | 1 | pfleura2 | IF (INCX.LT.0) IX = (-N+1)*INCX + 1 |
36 | 1 | pfleura2 | IF (INCY.LT.0) IY = (-N+1)*INCY + 1 |
37 | 1 | pfleura2 | DO 10 I = 1,N |
38 | 1 | pfleura2 | DTEMP = DTEMP + DX(IX)*DY(IY) |
39 | 1 | pfleura2 | IX = IX + INCX |
40 | 1 | pfleura2 | IY = IY + INCY |
41 | 1 | pfleura2 | 10 CONTINUE |
42 | 1 | pfleura2 | DDOT = DTEMP |
43 | 1 | pfleura2 | RETURN |
44 | 1 | pfleura2 | * |
45 | 1 | pfleura2 | * code for both increments equal to 1 |
46 | 1 | pfleura2 | * |
47 | 1 | pfleura2 | * |
48 | 1 | pfleura2 | * clean-up loop |
49 | 1 | pfleura2 | * |
50 | 1 | pfleura2 | 20 M = MOD(N,5) |
51 | 1 | pfleura2 | IF (M.EQ.0) GO TO 40 |
52 | 1 | pfleura2 | DO 30 I = 1,M |
53 | 1 | pfleura2 | DTEMP = DTEMP + DX(I)*DY(I) |
54 | 1 | pfleura2 | 30 CONTINUE |
55 | 1 | pfleura2 | IF (N.LT.5) GO TO 60 |
56 | 1 | pfleura2 | 40 MP1 = M + 1 |
57 | 1 | pfleura2 | DO 50 I = MP1,N,5 |
58 | 1 | pfleura2 | DTEMP = DTEMP + DX(I)*DY(I) + DX(I+1)*DY(I+1) + |
59 | 1 | pfleura2 | + DX(I+2)*DY(I+2) + DX(I+3)*DY(I+3) + DX(I+4)*DY(I+4) |
60 | 1 | pfleura2 | 50 CONTINUE |
61 | 1 | pfleura2 | 60 DDOT = DTEMP |
62 | 1 | pfleura2 | RETURN |
63 | 1 | pfleura2 | END |