```01:       DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY)
02: *     .. Scalar Arguments ..
03:       INTEGER INCX,INCY,N
04: *     ..
05: *     .. Array Arguments ..
06:       DOUBLE PRECISION DX(*),DY(*)
07: *     ..
08: *
09: *  Purpose
10: *  =======
11: *
12: *     DDOT forms the dot product of two vectors.
13: *     uses unrolled loops for increments equal to one.
14: *
15: *  Further Details
16: *  ===============
17: *
18: *     jack dongarra, linpack, 3/11/78.
19: *     modified 12/3/93, array(1) declarations changed to array(*)
20: *
21: *  =====================================================================
22: *
23: *     .. Local Scalars ..
24:       DOUBLE PRECISION DTEMP
25:       INTEGER I,IX,IY,M,MP1
26: *     ..
27: *     .. Intrinsic Functions ..
28:       INTRINSIC MOD
29: *     ..
30:       DDOT = 0.0d0
31:       DTEMP = 0.0d0
32:       IF (N.LE.0) RETURN
33:       IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20
34: *
35: *        code for unequal increments or equal increments
36: *          not equal to 1
37: *
38:       IX = 1
39:       IY = 1
40:       IF (INCX.LT.0) IX = (-N+1)*INCX + 1
41:       IF (INCY.LT.0) IY = (-N+1)*INCY + 1
42:       DO 10 I = 1,N
43:           DTEMP = DTEMP + DX(IX)*DY(IY)
44:           IX = IX + INCX
45:           IY = IY + INCY
46:    10 CONTINUE
47:       DDOT = DTEMP
48:       RETURN
49: *
50: *        code for both increments equal to 1
51: *
52: *
53: *        clean-up loop
54: *
55:    20 M = MOD(N,5)
56:       IF (M.EQ.0) GO TO 40
57:       DO 30 I = 1,M
58:           DTEMP = DTEMP + DX(I)*DY(I)
59:    30 CONTINUE
60:       IF (N.LT.5) GO TO 60
61:    40 MP1 = M + 1
62:       DO 50 I = MP1,N,5
63:           DTEMP = DTEMP + DX(I)*DY(I) + DX(I+1)*DY(I+1) +
64:      +            DX(I+2)*DY(I+2) + DX(I+3)*DY(I+3) + DX(I+4)*DY(I+4)
65:    50 CONTINUE
66:    60 DDOT = DTEMP
67:       RETURN
68:       END
69: ```