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