LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ ddot()

double precision function ddot ( integer  n,
double precision, dimension(*)  dx,
integer  incx,
double precision, dimension(*)  dy,
integer  incy 
)

DDOT

Purpose:
    DDOT forms the dot product of two vectors.
    uses unrolled loops for increments equal to one.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]DX
          DX is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of DX
[in]DY
          DY is DOUBLE PRECISION array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
[in]INCY
          INCY is INTEGER
         storage spacing between elements of DY
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 81 of file ddot.f.

82*
83* -- Reference BLAS level1 routine --
84* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
85* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
86*
87* .. Scalar Arguments ..
88 INTEGER INCX,INCY,N
89* ..
90* .. Array Arguments ..
91 DOUBLE PRECISION DX(*),DY(*)
92* ..
93*
94* =====================================================================
95*
96* .. Local Scalars ..
97 DOUBLE PRECISION DTEMP
98 INTEGER I,IX,IY,M,MP1
99* ..
100* .. Intrinsic Functions ..
101 INTRINSIC mod
102* ..
103 ddot = 0.0d0
104 dtemp = 0.0d0
105 IF (n.LE.0) RETURN
106 IF (incx.EQ.1 .AND. incy.EQ.1) THEN
107*
108* code for both increments equal to 1
109*
110*
111* clean-up loop
112*
113 m = mod(n,5)
114 IF (m.NE.0) THEN
115 DO i = 1,m
116 dtemp = dtemp + dx(i)*dy(i)
117 END DO
118 IF (n.LT.5) THEN
119 ddot=dtemp
120 RETURN
121 END IF
122 END IF
123 mp1 = m + 1
124 DO i = mp1,n,5
125 dtemp = dtemp + dx(i)*dy(i) + dx(i+1)*dy(i+1) +
126 $ dx(i+2)*dy(i+2) + dx(i+3)*dy(i+3) + dx(i+4)*dy(i+4)
127 END DO
128 ELSE
129*
130* code for unequal increments or equal increments
131* not equal to 1
132*
133 ix = 1
134 iy = 1
135 IF (incx.LT.0) ix = (-n+1)*incx + 1
136 IF (incy.LT.0) iy = (-n+1)*incy + 1
137 DO i = 1,n
138 dtemp = dtemp + dx(ix)*dy(iy)
139 ix = ix + incx
140 iy = iy + incy
141 END DO
142 END IF
143 ddot = dtemp
144 RETURN
145*
146* End of DDOT
147*
double precision function ddot(n, dx, incx, dy, incy)
DDOT
Definition ddot.f:82
Here is the call graph for this function:
Here is the caller graph for this function: