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