1 DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
2 * .. Scalar Arguments ..
3 INTEGER INCX,INCY,N
4 * ..
5 * .. Array Arguments ..
6 REAL SX(*),SY(*)
7 * ..
8 *
9 * AUTHORS
10 * =======
11 * Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
12 * Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
13 *
14 * Purpose
15 * =======
16 * Compute the inner product of two vectors with extended
17 * precision accumulation and result.
18 *
19 * Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
20 * DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY),
21 * where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
22 * defined in a similar way using INCY.
23 *
24 * Arguments
25 * =========
26 *
27 * N (input) INTEGER
28 * number of elements in input vector(s)
29 *
30 * SX (input) REAL array, dimension(N)
31 * single precision vector with N elements
32 *
33 * INCX (input) INTEGER
34 * storage spacing between elements of SX
35 *
36 * SY (input) REAL array, dimension(N)
37 * single precision vector with N elements
38 *
39 * INCY (input) INTEGER
40 * storage spacing between elements of SY
41 *
42 * DSDOT (output) DOUBLE PRECISION
43 * DSDOT double precision dot product (zero if N.LE.0)
44 *
45 * Further Details
46 * ===============
47 *
48 * REFERENCES
49 *
50 * C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
51 * Krogh, Basic linear algebra subprograms for Fortran
52 * usage, Algorithm No. 539, Transactions on Mathematical
53 * Software 5, 3 (September 1979), pp. 308-323.
54 *
55 * REVISION HISTORY (YYMMDD)
56 *
57 * 791001 DATE WRITTEN
58 * 890831 Modified array declarations. (WRB)
59 * 890831 REVISION DATE from Version 3.2
60 * 891214 Prologue converted to Version 4.0 format. (BAB)
61 * 920310 Corrected definition of LX in DESCRIPTION. (WRB)
62 * 920501 Reformatted the REFERENCES section. (WRB)
63 * 070118 Reformat to LAPACK style (JL)
64 *
65 * =====================================================================
66 *
67 * .. Local Scalars ..
68 INTEGER I,KX,KY,NS
69 * ..
70 * .. Intrinsic Functions ..
71 INTRINSIC DBLE
72 * ..
73 DSDOT = 0.0D0
74 IF (N.LE.0) RETURN
75 IF (INCX.EQ.INCY .AND. INCX.GT.0) THEN
76 *
77 * Code for equal, positive, non-unit increments.
78 *
79 NS = N*INCX
80 DO I = 1,NS,INCX
81 DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
82 END DO
83 ELSE
84 *
85 * Code for unequal or nonpositive increments.
86 *
87 KX = 1
88 KY = 1
89 IF (INCX.LT.0) KX = 1 + (1-N)*INCX
90 IF (INCY.LT.0) KY = 1 + (1-N)*INCY
91 DO I = 1,N
92 DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
93 KX = KX + INCX
94 KY = KY + INCY
95 END DO
96 END IF
97 RETURN
98 END
2 * .. Scalar Arguments ..
3 INTEGER INCX,INCY,N
4 * ..
5 * .. Array Arguments ..
6 REAL SX(*),SY(*)
7 * ..
8 *
9 * AUTHORS
10 * =======
11 * Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
12 * Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
13 *
14 * Purpose
15 * =======
16 * Compute the inner product of two vectors with extended
17 * precision accumulation and result.
18 *
19 * Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
20 * DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY),
21 * where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
22 * defined in a similar way using INCY.
23 *
24 * Arguments
25 * =========
26 *
27 * N (input) INTEGER
28 * number of elements in input vector(s)
29 *
30 * SX (input) REAL array, dimension(N)
31 * single precision vector with N elements
32 *
33 * INCX (input) INTEGER
34 * storage spacing between elements of SX
35 *
36 * SY (input) REAL array, dimension(N)
37 * single precision vector with N elements
38 *
39 * INCY (input) INTEGER
40 * storage spacing between elements of SY
41 *
42 * DSDOT (output) DOUBLE PRECISION
43 * DSDOT double precision dot product (zero if N.LE.0)
44 *
45 * Further Details
46 * ===============
47 *
48 * REFERENCES
49 *
50 * C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
51 * Krogh, Basic linear algebra subprograms for Fortran
52 * usage, Algorithm No. 539, Transactions on Mathematical
53 * Software 5, 3 (September 1979), pp. 308-323.
54 *
55 * REVISION HISTORY (YYMMDD)
56 *
57 * 791001 DATE WRITTEN
58 * 890831 Modified array declarations. (WRB)
59 * 890831 REVISION DATE from Version 3.2
60 * 891214 Prologue converted to Version 4.0 format. (BAB)
61 * 920310 Corrected definition of LX in DESCRIPTION. (WRB)
62 * 920501 Reformatted the REFERENCES section. (WRB)
63 * 070118 Reformat to LAPACK style (JL)
64 *
65 * =====================================================================
66 *
67 * .. Local Scalars ..
68 INTEGER I,KX,KY,NS
69 * ..
70 * .. Intrinsic Functions ..
71 INTRINSIC DBLE
72 * ..
73 DSDOT = 0.0D0
74 IF (N.LE.0) RETURN
75 IF (INCX.EQ.INCY .AND. INCX.GT.0) THEN
76 *
77 * Code for equal, positive, non-unit increments.
78 *
79 NS = N*INCX
80 DO I = 1,NS,INCX
81 DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
82 END DO
83 ELSE
84 *
85 * Code for unequal or nonpositive increments.
86 *
87 KX = 1
88 KY = 1
89 IF (INCX.LT.0) KX = 1 + (1-N)*INCX
90 IF (INCY.LT.0) KY = 1 + (1-N)*INCY
91 DO I = 1,N
92 DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
93 KX = KX + INCX
94 KY = KY + INCY
95 END DO
96 END IF
97 RETURN
98 END