LAPACK  3.7.1
LAPACK: Linear Algebra PACKage
ddot.f
Go to the documentation of this file.
1 *> \brief \b DDOT
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 DDOT(N,DX,INCX,DY,INCY)
12 *
13 * .. Scalar Arguments ..
14 * INTEGER INCX,INCY,N
15 * ..
16 * .. Array Arguments ..
17 * DOUBLE PRECISION DX(*),DY(*)
18 * ..
19 *
20 *
21 *> \par Purpose:
22 * =============
23 *>
24 *> \verbatim
25 *>
26 *> DDOT forms the dot product of two vectors.
27 *> uses unrolled loops for increments equal to one.
28 *> \endverbatim
29 *
30 * Arguments:
31 * ==========
32 *
33 *> \param[in] N
34 *> \verbatim
35 *> N is INTEGER
36 *> number of elements in input vector(s)
37 *> \endverbatim
38 *>
39 *> \param[in] DX
40 *> \verbatim
41 *> DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
42 *> \endverbatim
43 *>
44 *> \param[in] INCX
45 *> \verbatim
46 *> INCX is INTEGER
47 *> storage spacing between elements of DX
48 *> \endverbatim
49 *>
50 *> \param[in] DY
51 *> \verbatim
52 *> DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
53 *> \endverbatim
54 *>
55 *> \param[in] INCY
56 *> \verbatim
57 *> INCY is INTEGER
58 *> storage spacing between elements of DY
59 *> \endverbatim
60 *
61 * Authors:
62 * ========
63 *
64 *> \author Univ. of Tennessee
65 *> \author Univ. of California Berkeley
66 *> \author Univ. of Colorado Denver
67 *> \author NAG Ltd.
68 *
69 *> \date December 2016
70 *
71 *> \ingroup double_blas_level1
72 *
73 *> \par Further Details:
74 * =====================
75 *>
76 *> \verbatim
77 *>
78 *> jack dongarra, linpack, 3/11/78.
79 *> modified 12/3/93, array(1) declarations changed to array(*)
80 *> \endverbatim
81 *>
82 * =====================================================================
83  DOUBLE PRECISION FUNCTION ddot(N,DX,INCX,DY,INCY)
84 *
85 * -- Reference BLAS level1 routine (version 3.7.0) --
86 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
87 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
88 * December 2016
89 *
90 * .. Scalar Arguments ..
91  INTEGER INCX,INCY,N
92 * ..
93 * .. Array Arguments ..
94  DOUBLE PRECISION DX(*),DY(*)
95 * ..
96 *
97 * =====================================================================
98 *
99 * .. Local Scalars ..
100  DOUBLE PRECISION DTEMP
101  INTEGER I,IX,IY,M,MP1
102 * ..
103 * .. Intrinsic Functions ..
104  INTRINSIC mod
105 * ..
106  ddot = 0.0d0
107  dtemp = 0.0d0
108  IF (n.LE.0) RETURN
109  IF (incx.EQ.1 .AND. incy.EQ.1) THEN
110 *
111 * code for both increments equal to 1
112 *
113 *
114 * clean-up loop
115 *
116  m = mod(n,5)
117  IF (m.NE.0) THEN
118  DO i = 1,m
119  dtemp = dtemp + dx(i)*dy(i)
120  END DO
121  IF (n.LT.5) THEN
122  ddot=dtemp
123  RETURN
124  END IF
125  END IF
126  mp1 = m + 1
127  DO i = mp1,n,5
128  dtemp = dtemp + dx(i)*dy(i) + dx(i+1)*dy(i+1) +
129  $ dx(i+2)*dy(i+2) + dx(i+3)*dy(i+3) + dx(i+4)*dy(i+4)
130  END DO
131  ELSE
132 *
133 * code for unequal increments or equal increments
134 * not equal to 1
135 *
136  ix = 1
137  iy = 1
138  IF (incx.LT.0) ix = (-n+1)*incx + 1
139  IF (incy.LT.0) iy = (-n+1)*incy + 1
140  DO i = 1,n
141  dtemp = dtemp + dx(ix)*dy(iy)
142  ix = ix + incx
143  iy = iy + incy
144  END DO
145  END IF
146  ddot = dtemp
147  RETURN
148  END
double precision function ddot(N, DX, INCX, DY, INCY)
DDOT
Definition: ddot.f:84