LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
dsdot.f
Go to the documentation of this file.
1 *> \brief \b DSDOT
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,INCY,N
15 * ..
16 * .. Array Arguments ..
17 * REAL SX(*),SY(*)
18 * ..
19 *
20 * AUTHORS
21 * =======
22 * Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
23 * Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
24 *
25 *
26 *> \par Purpose:
27 * =============
28 *>
29 *> \verbatim
30 *>
31 *> Compute the inner product of two vectors with extended
32 *> precision accumulation and result.
33 *>
34 *> Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
35 *> DSDOT = sum for I = 0 to N-1 of SX(LX+I*INCX) * SY(LY+I*INCY),
36 *> where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
37 *> defined in a similar way using INCY.
38 *> \endverbatim
39 *
40 * Arguments:
41 * ==========
42 *
43 *> \param[in] N
44 *> \verbatim
45 *> N is INTEGER
46 *> number of elements in input vector(s)
47 *> \endverbatim
48 *>
49 *> \param[in] SX
50 *> \verbatim
51 *> SX is REAL array, dimension(N)
52 *> single precision vector with N elements
53 *> \endverbatim
54 *>
55 *> \param[in] INCX
56 *> \verbatim
57 *> INCX is INTEGER
58 *> storage spacing between elements of SX
59 *> \endverbatim
60 *>
61 *> \param[in] SY
62 *> \verbatim
63 *> SY is REAL array, dimension(N)
64 *> single precision vector with N elements
65 *> \endverbatim
66 *>
67 *> \param[in] INCY
68 *> \verbatim
69 *> INCY is INTEGER
70 *> storage spacing between elements of SY
71 *> \endverbatim
72 *>
73 *> \result DSDOT
74 *> \verbatim
75 *> DSDOT is DOUBLE PRECISION
76 *> DSDOT double precision dot product (zero if N.LE.0)
77 *> \endverbatim
78 *
79 * Authors:
80 * ========
81 *
82 *> \author Univ. of Tennessee
83 *> \author Univ. of California Berkeley
84 *> \author Univ. of Colorado Denver
85 *> \author NAG Ltd.
86 *
87 *> \date November 2011
88 *
89 *> \ingroup double_blas_level1
90 *
91 *> \par Further Details:
92 * =====================
93 *>
94 *> \verbatim
95 *> \endverbatim
96 *
97 *> \par References:
98 * ================
99 *>
100 *> \verbatim
101 *>
102 *>
103 *> C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
104 *> Krogh, Basic linear algebra subprograms for Fortran
105 *> usage, Algorithm No. 539, Transactions on Mathematical
106 *> Software 5, 3 (September 1979), pp. 308-323.
107 *>
108 *> REVISION HISTORY (YYMMDD)
109 *>
110 *> 791001 DATE WRITTEN
111 *> 890831 Modified array declarations. (WRB)
112 *> 890831 REVISION DATE from Version 3.2
113 *> 891214 Prologue converted to Version 4.0 format. (BAB)
114 *> 920310 Corrected definition of LX in DESCRIPTION. (WRB)
115 *> 920501 Reformatted the REFERENCES section. (WRB)
116 *> 070118 Reformat to LAPACK style (JL)
117 *> \endverbatim
118 *>
119 * =====================================================================
120  DOUBLE PRECISION FUNCTION dsdot(N,SX,INCX,SY,INCY)
121 *
122 * -- Reference BLAS level1 routine (version 3.4.0) --
123 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
124 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125 * November 2011
126 *
127 * .. Scalar Arguments ..
128  INTEGER incx,incy,n
129 * ..
130 * .. Array Arguments ..
131  REAL sx(*),sy(*)
132 * ..
133 *
134 * Authors:
135 * ========
136 * Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
137 * Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
138 *
139 * =====================================================================
140 *
141 * .. Local Scalars ..
142  INTEGER i,kx,ky,ns
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC dble
146 * ..
147  dsdot = 0.0d0
148  IF (n.LE.0) return
149  IF (incx.EQ.incy .AND. incx.GT.0) THEN
150 *
151 * Code for equal, positive, non-unit increments.
152 *
153  ns = n*incx
154  DO i = 1,ns,incx
155  dsdot = dsdot + dble(sx(i))*dble(sy(i))
156  END DO
157  ELSE
158 *
159 * Code for unequal or nonpositive increments.
160 *
161  kx = 1
162  ky = 1
163  IF (incx.LT.0) kx = 1 + (1-n)*incx
164  IF (incy.LT.0) ky = 1 + (1-n)*incy
165  DO i = 1,n
166  dsdot = dsdot + dble(sx(kx))*dble(sy(ky))
167  kx = kx + incx
168  ky = ky + incy
169  END DO
170  END IF
171  return
172  END