INTEGER FUNCTION ICAMAX(N,CX,INCX)
INTEGER INCX,N
COMPLEX CX(*)
REAL SMAX
INTEGER I,IX
REAL SCABS1
EXTERNAL SCABS1
ICAMAX = 0
IF (N.LT.1 .OR. INCX.LE.0) RETURN
ICAMAX = 1
IF (N.EQ.1) RETURN
IF (INCX.EQ.1) GO TO 20
IX = 1
SMAX = SCABS1(CX(1))
IX = IX + INCX
DO 10 I = 2,N
IF (SCABS1(CX(IX)).LE.SMAX) GO TO 5
ICAMAX = I
SMAX = SCABS1(CX(IX))
5 IX = IX + INCX
10 CONTINUE
RETURN
20 SMAX = SCABS1(CX(1))
DO 30 I = 2,N
IF (SCABS1(CX(I)).LE.SMAX) GO TO 30
ICAMAX = I
SMAX = SCABS1(CX(I))
30 CONTINUE
RETURN
END