Description of maxima_unicode_display in reference manual,
[maxima.git] / share / lbfgs / ddot.f
blobc829d637063002af4e79cec55ddd14012a573f87
3 C ----------------------------------------------------------
5 double precision function ddot(n,dx,incx,dy,incy)
7 c forms the dot product of two vectors.
8 c uses unrolled loops for increments equal to one.
9 c jack dongarra, linpack, 3/11/78.
11 double precision dx(1),dy(1),dtemp
12 integer i,incx,incy,ix,iy,m,mp1,n
14 ddot = 0.0d0
15 dtemp = 0.0d0
16 if(n.le.0)return
17 if(incx.eq.1.and.incy.eq.1)go to 20
19 c code for unequal increments or equal increments
20 c not equal to 1
22 ix = 1
23 iy = 1
24 if(incx.lt.0)ix = (-n+1)*incx + 1
25 if(incy.lt.0)iy = (-n+1)*incy + 1
26 do 10 i = 1,n
27 dtemp = dtemp + dx(ix)*dy(iy)
28 ix = ix + incx
29 iy = iy + incy
30 10 continue
31 ddot = dtemp
32 return
34 c code for both increments equal to 1
37 c clean-up loop
39 20 m = mod(n,5)
40 if( m .eq. 0 ) go to 40
41 do 30 i = 1,m
42 dtemp = dtemp + dx(i)*dy(i)
43 30 continue
44 if( n .lt. 5 ) go to 60
45 40 mp1 = m + 1
46 do 50 i = mp1,n,5
47 dtemp = dtemp + dx(i)*dy(i) + dx(i + 1)*dy(i + 1) +
48 * dx(i + 2)*dy(i + 2) + dx(i + 3)*dy(i + 3) + dx(i + 4)*dy(i + 4)
49 50 continue
50 60 ddot = dtemp
51 return
52 end