```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: *     finds the index of element having max. absolute value.
13: *     jack dongarra, linpack, 3/11/78.
14: *     modified 3/93 to return if incx .le. 0.
15: *     modified 12/3/93, array(1) declarations changed to array(*)
16: *
17: *
18: *     .. Local Scalars ..
19:       DOUBLE PRECISION DMAX
20:       INTEGER I,IX
21: *     ..
22: *     .. Intrinsic Functions ..
23:       INTRINSIC DABS
24: *     ..
25:       IDAMAX = 0
26:       IF (N.LT.1 .OR. INCX.LE.0) RETURN
27:       IDAMAX = 1
28:       IF (N.EQ.1) RETURN
29:       IF (INCX.EQ.1) GO TO 20
30: *
31: *        code for increment not equal to 1
32: *
33:       IX = 1
34:       DMAX = DABS(DX(1))
35:       IX = IX + INCX
36:       DO 10 I = 2,N
37:           IF (DABS(DX(IX)).LE.DMAX) GO TO 5
38:           IDAMAX = I
39:           DMAX = DABS(DX(IX))
40:     5     IX = IX + INCX
41:    10 CONTINUE
42:       RETURN
43: *
44: *        code for increment equal to 1
45: *
46:    20 DMAX = DABS(DX(1))
47:       DO 30 I = 2,N
48:           IF (DABS(DX(I)).LE.DMAX) GO TO 30
49:           IDAMAX = I
50:           DMAX = DABS(DX(I))
51:    30 CONTINUE
52:       RETURN
53:       END
54: ```