```01:       INTEGER FUNCTION IDAMAX(N,DX,INCX)
02: *     .. Scalar Arguments ..
03:       INTEGER INCX,N
04: *     ..
05: *     .. Array Arguments ..
06:       DOUBLE PRECISION DX(*)
07: *     ..
08: *
09: *  Purpose
10: *  =======
11: *
12: *     IDAMAX finds the index of element having max. absolute value.
13: *
14: *  Further Details
15: *  ===============
16: *
17: *     jack dongarra, linpack, 3/11/78.
18: *     modified 3/93 to return if incx .le. 0.
19: *     modified 12/3/93, array(1) declarations changed to array(*)
20: *
21: *  =====================================================================
22: *
23: *     .. Local Scalars ..
24:       DOUBLE PRECISION DMAX
25:       INTEGER I,IX
26: *     ..
27: *     .. Intrinsic Functions ..
28:       INTRINSIC DABS
29: *     ..
30:       IDAMAX = 0
31:       IF (N.LT.1 .OR. INCX.LE.0) RETURN
32:       IDAMAX = 1
33:       IF (N.EQ.1) RETURN
34:       IF (INCX.EQ.1) GO TO 20
35: *
36: *        code for increment not equal to 1
37: *
38:       IX = 1
39:       DMAX = DABS(DX(1))
40:       IX = IX + INCX
41:       DO 10 I = 2,N
42:           IF (DABS(DX(IX)).LE.DMAX) GO TO 5
43:           IDAMAX = I
44:           DMAX = DABS(DX(IX))
45:     5     IX = IX + INCX
46:    10 CONTINUE
47:       RETURN
48: *
49: *        code for increment equal to 1
50: *
51:    20 DMAX = DABS(DX(1))
52:       DO 30 I = 2,N
53:           IF (DABS(DX(I)).LE.DMAX) GO TO 30
54:           IDAMAX = I
55:           DMAX = DABS(DX(I))
56:    30 CONTINUE
57:       RETURN
58:       END
59: ```