LAPACK  3.8.0 LAPACK: Linear Algebra PACKage
sdsdot.f
Go to the documentation of this file.
1 *> \brief \b SDSDOT
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * REAL FUNCTION SDSDOT(N,SB,SX,INCX,SY,INCY)
12 *
13 * .. Scalar Arguments ..
14 * REAL SB
15 * INTEGER INCX,INCY,N
16 * ..
17 * .. Array Arguments ..
18 * REAL SX(*),SY(*)
19 * ..
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 * Compute the inner product of two vectors with extended
27 * precision accumulation.
28 *
29 * Returns S.P. result with dot product accumulated in D.P.
30 * SDSDOT = SB + sum for I = 0 to N-1 of SX(LX+I*INCX)*SY(LY+I*INCY),
31 * where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
32 * defined in a similar way using INCY.
33 *> \endverbatim
34 *
35 * Arguments:
36 * ==========
37 *
38 *> \param[in] N
39 *> \verbatim
40 *> N is INTEGER
41 *> number of elements in input vector(s)
42 *> \endverbatim
43 *>
44 *> \param[in] SB
45 *> \verbatim
46 *> SB is REAL
47 *> single precision scalar to be added to inner product
48 *> \endverbatim
49 *>
50 *> \param[in] SX
51 *> \verbatim
52 *> SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
53 *> single precision vector with N elements
54 *> \endverbatim
55 *>
56 *> \param[in] INCX
57 *> \verbatim
58 *> INCX is INTEGER
59 *> storage spacing between elements of SX
60 *> \endverbatim
61 *>
62 *> \param[in] SY
63 *> \verbatim
64 *> SY is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
65 *> single precision vector with N elements
66 *> \endverbatim
67 *>
68 *> \param[in] INCY
69 *> \verbatim
70 *> INCY is INTEGER
71 *> storage spacing between elements of SY
72 *> \endverbatim
73 *
74 * Authors:
75 * ========
76 *
77 *> \author Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
78 *> \author Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
79 *
80 *> \ingroup complex_blas_level1
81 *
82 *> \par Further Details:
83 * =====================
84 *>
85 *> \verbatim
86 *>
87 *> REFERENCES
88 *>
89 *> C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
90 *> Krogh, Basic linear algebra subprograms for Fortran
91 *> usage, Algorithm No. 539, Transactions on Mathematical
92 *> Software 5, 3 (September 1979), pp. 308-323.
93 *>
94 *> REVISION HISTORY (YYMMDD)
95 *>
96 *> 791001 DATE WRITTEN
97 *> 890531 Changed all specific intrinsics to generic. (WRB)
98 *> 890831 Modified array declarations. (WRB)
99 *> 890831 REVISION DATE from Version 3.2
100 *> 891214 Prologue converted to Version 4.0 format. (BAB)
101 *> 920310 Corrected definition of LX in DESCRIPTION. (WRB)
102 *> 920501 Reformatted the REFERENCES section. (WRB)
103 *> 070118 Reformat to LAPACK coding style
104 *> \endverbatim
105 *
106 * =====================================================================
107 *
108 * .. Local Scalars ..
109 * DOUBLE PRECISION DSDOT
110 * INTEGER I,KX,KY,NS
111 * ..
112 * .. Intrinsic Functions ..
113 * INTRINSIC DBLE
114 * ..
115 * DSDOT = SB
116 * IF (N.LE.0) THEN
117 * SDSDOT = DSDOT
118 * RETURN
119 * END IF
120 * IF (INCX.EQ.INCY .AND. INCX.GT.0) THEN
121 *
122 * Code for equal and positive increments.
123 *
124 * NS = N*INCX
125 * DO I = 1,NS,INCX
126 * DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
127 * END DO
128 * ELSE
129 *
130 * Code for unequal or nonpositive increments.
131 *
132 * KX = 1
133 * KY = 1
134 * IF (INCX.LT.0) KX = 1 + (1-N)*INCX
135 * IF (INCY.LT.0) KY = 1 + (1-N)*INCY
136 * DO I = 1,N
137 * DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
138 * KX = KX + INCX
139 * KY = KY + INCY
140 * END DO
141 * END IF
142 * SDSDOT = DSDOT
143 * RETURN
144 * END
145 *
146 *> \par Purpose:
147 * =============
148 *>
149 *> \verbatim
150 *> \endverbatim
151 *
152 * Authors:
153 * ========
154 *
155 *> \author Univ. of Tennessee
156 *> \author Univ. of California Berkeley
157 *> \author Univ. of Colorado Denver
158 *> \author NAG Ltd.
159 *
160 *> \date November 2017
161 *
162 *> \ingroup single_blas_level1
163 *
164 * =====================================================================
165  REAL FUNCTION sdsdot(N,SB,SX,INCX,SY,INCY)
166 *
167 * -- Reference BLAS level1 routine (version 3.8.0) --
168 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
169 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
170 * November 2017
171 *
172 * .. Scalar Arguments ..
173  REAL SB
174  INTEGER INCX,INCY,N
175 * ..
176 * .. Array Arguments ..
177  REAL SX(*),SY(*)
178 * ..
179 *
180 * PURPOSE
181 * =======
182 *
183 * Compute the inner product of two vectors with extended
184 * precision accumulation.
185 *
186 * Returns S.P. result with dot product accumulated in D.P.
187 * SDSDOT = SB + sum for I = 0 to N-1 of SX(LX+I*INCX)*SY(LY+I*INCY),
188 * where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
189 * defined in a similar way using INCY.
190 *
191 * AUTHOR
192 * ======
193 * Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
194 * Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
195 *
196 * ARGUMENTS
197 * =========
198 *
199 * N (input) INTEGER
200 * number of elements in input vector(s)
201 *
202 * SB (input) REAL
203 * single precision scalar to be added to inner product
204 *
205 * SX (input) REAL array, dimension (N)
206 * single precision vector with N elements
207 *
208 * INCX (input) INTEGER
209 * storage spacing between elements of SX
210 *
211 * SY (input) REAL array, dimension (N)
212 * single precision vector with N elements
213 *
214 * INCY (input) INTEGER
215 * storage spacing between elements of SY
216 *
217 * SDSDOT (output) REAL
218 * single precision dot product (SB if N .LE. 0)
219 *
220 * Further Details
221 * ===============
222 *
223 * REFERENCES
224 *
225 * C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
226 * Krogh, Basic linear algebra subprograms for Fortran
227 * usage, Algorithm No. 539, Transactions on Mathematical
228 * Software 5, 3 (September 1979), pp. 308-323.
229 *
230 * REVISION HISTORY (YYMMDD)
231 *
232 * 791001 DATE WRITTEN
233 * 890531 Changed all specific intrinsics to generic. (WRB)
234 * 890831 Modified array declarations. (WRB)
235 * 890831 REVISION DATE from Version 3.2
236 * 891214 Prologue converted to Version 4.0 format. (BAB)
237 * 920310 Corrected definition of LX in DESCRIPTION. (WRB)
238 * 920501 Reformatted the REFERENCES section. (WRB)
239 * 070118 Reformat to LAPACK coding style
240 *
241 * =====================================================================
242 *
243 * .. Local Scalars ..
244  DOUBLE PRECISION DSDOT
245  INTEGER I,KX,KY,NS
246 * ..
247 * .. Intrinsic Functions ..
248  INTRINSIC dble
249 * ..
250  dsdot = sb
251  IF (n.LE.0) THEN
252  sdsdot = dsdot
253  RETURN
254  END IF
255  IF (incx.EQ.incy .AND. incx.GT.0) THEN
256 *
257 * Code for equal and positive increments.
258 *
259  ns = n*incx
260  DO i = 1,ns,incx
261  dsdot = dsdot + dble(sx(i))*dble(sy(i))
262  END DO
263  ELSE
264 *
265 * Code for unequal or nonpositive increments.
266 *
267  kx = 1
268  ky = 1
269  IF (incx.LT.0) kx = 1 + (1-n)*incx
270  IF (incy.LT.0) ky = 1 + (1-n)*incy
271  DO i = 1,n
272  dsdot = dsdot + dble(sx(kx))*dble(sy(ky))
273  kx = kx + incx
274  ky = ky + incy
275  END DO
276  END IF
277  sdsdot = dsdot
278  RETURN
279  END
real function sdsdot(N, SB, SX, INCX, SY, INCY)
SDSDOT
Definition: sdsdot.f:166