LAPACK 3.3.1
Linear Algebra PACKage

icamax.f

Go to the documentation of this file.
00001       INTEGER FUNCTION ICAMAX(N,CX,INCX)
00002 *     .. Scalar Arguments ..
00003       INTEGER INCX,N
00004 *     ..
00005 *     .. Array Arguments ..
00006       COMPLEX CX(*)
00007 *     ..
00008 *
00009 *  Purpose
00010 *  =======
00011 *
00012 *     ICAMAX finds the index of element having max. absolute value.
00013 *
00014 *  Further Details
00015 *  ===============
00016 *
00017 *     jack dongarra, linpack, 3/11/78.
00018 *     modified 3/93 to return if incx .le. 0.
00019 *     modified 12/3/93, array(1) declarations changed to array(*)
00020 *
00021 *  =====================================================================
00022 *
00023 *     .. Local Scalars ..
00024       REAL SMAX
00025       INTEGER I,IX
00026 *     ..
00027 *     .. External Functions ..
00028       REAL SCABS1
00029       EXTERNAL SCABS1
00030 *     ..
00031       ICAMAX = 0
00032       IF (N.LT.1 .OR. INCX.LE.0) RETURN
00033       ICAMAX = 1
00034       IF (N.EQ.1) RETURN
00035       IF (INCX.EQ.1) THEN
00036 *
00037 *        code for increment equal to 1
00038 *
00039          SMAX = SCABS1(CX(1))
00040          DO I = 2,N
00041             IF (SCABS1(CX(I)).GT.SMAX) THEN
00042                ICAMAX = I
00043                SMAX = SCABS1(CX(I))
00044             END IF
00045          END DO
00046       ELSE
00047 *
00048 *        code for increment not equal to 1
00049 *
00050          IX = 1
00051          SMAX = SCABS1(CX(1))
00052          IX = IX + INCX
00053          DO I = 2,N
00054             IF (SCABS1(CX(IX)).GT.SMAX) THEN
00055                ICAMAX = I
00056                SMAX = SCABS1(CX(IX))
00057             END IF
00058             IX = IX + INCX
00059          END DO
00060       END IF
00061       RETURN
00062       END
 All Files Functions