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) GO TO 20
76: *
77: * Code for unequal or nonpositive increments.
78: *
79: KX = 1
80: KY = 1
81: IF (INCX.LT.0) KX = 1 + (1-N)*INCX
82: IF (INCY.LT.0) KY = 1 + (1-N)*INCY
83: DO 10 I = 1,N
84: DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
85: KX = KX + INCX
86: KY = KY + INCY
87: 10 CONTINUE
88: RETURN
89: *
90: * Code for equal, positive, non-unit increments.
91: *
92: 20 NS = N*INCX
93: DO 30 I = 1,NS,INCX
94: DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
95: 30 CONTINUE
96: RETURN
97: END
CVSweb interface <joel.bertrand@systella.fr>