LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
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*> \ingroup dot
88*
89*> \par Further Details:
90* =====================
91*>
92*> \verbatim
93*> \endverbatim
94*
95*> \par References:
96* ================
97*>
98*> \verbatim
99*>
100*>
101*> C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
102*> Krogh, Basic linear algebra subprograms for Fortran
103*> usage, Algorithm No. 539, Transactions on Mathematical
104*> Software 5, 3 (September 1979), pp. 308-323.
105*>
106*> REVISION HISTORY (YYMMDD)
107*>
108*> 791001 DATE WRITTEN
109*> 890831 Modified array declarations. (WRB)
110*> 890831 REVISION DATE from Version 3.2
111*> 891214 Prologue converted to Version 4.0 format. (BAB)
112*> 920310 Corrected definition of LX in DESCRIPTION. (WRB)
113*> 920501 Reformatted the REFERENCES section. (WRB)
114*> 070118 Reformat to LAPACK style (JL)
115*> \endverbatim
116*>
117* =====================================================================
118 DOUBLE PRECISION FUNCTION dsdot(N,SX,INCX,SY,INCY)
119*
120* -- Reference BLAS level1 routine --
121* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
122* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
123*
124* .. Scalar Arguments ..
125 INTEGER incx,incy,n
126* ..
127* .. Array Arguments ..
128 REAL sx(*),sy(*)
129* ..
130*
131* Authors:
132* ========
133* Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
134* Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
135*
136* =====================================================================
137*
138* .. Local Scalars ..
139 INTEGER i,kx,ky,ns
140* ..
141* .. Intrinsic Functions ..
142 INTRINSIC dble
143* ..
144 dsdot = 0.0d0
145 IF (n.LE.0) RETURN
146 IF (incx.EQ.incy .AND. incx.GT.0) THEN
147*
148* Code for equal, positive, non-unit increments.
149*
150 ns = n*incx
151 DO i = 1,ns,incx
152 dsdot = dsdot + dble(sx(i))*dble(sy(i))
153 END DO
154 ELSE
155*
156* Code for unequal or nonpositive increments.
157*
158 kx = 1
159 ky = 1
160 IF (incx.LT.0) kx = 1 + (1-n)*incx
161 IF (incy.LT.0) ky = 1 + (1-n)*incy
162 DO i = 1,n
163 dsdot = dsdot + dble(sx(kx))*dble(sy(ky))
164 kx = kx + incx
165 ky = ky + incy
166 END DO
167 END IF
168 RETURN
169*
170* End of DSDOT
171*
172 END
double precision function dsdot(n, sx, incx, sy, incy)
DSDOT
Definition dsdot.f:119