LAPACK 3.3.0

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) GO TO 20
00036 *
00037 *        code for increment not equal to 1
00038 *
00039       IX = 1
00040       SMAX = SCABS1(CX(1))
00041       IX = IX + INCX
00042       DO 10 I = 2,N
00043           IF (SCABS1(CX(IX)).LE.SMAX) GO TO 5
00044           ICAMAX = I
00045           SMAX = SCABS1(CX(IX))
00046     5     IX = IX + INCX
00047    10 CONTINUE
00048       RETURN
00049 *
00050 *        code for increment equal to 1
00051 *
00052    20 SMAX = SCABS1(CX(1))
00053       DO 30 I = 2,N
00054           IF (SCABS1(CX(I)).LE.SMAX) GO TO 30
00055           ICAMAX = I
00056           SMAX = SCABS1(CX(I))
00057    30 CONTINUE
00058       RETURN
00059       END
 All Files Functions