39d3a2e6cb34bd0cf788ce2a1baf0a587f2f5db4
[platform/upstream/lapack.git] / BLAS / SRC / sdsdot.f
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