LAPACK 3.3.0

isamax.f

Go to the documentation of this file.
00001       INTEGER FUNCTION ISAMAX(N,SX,INCX)
00002 *     .. Scalar Arguments ..
00003       INTEGER INCX,N
00004 *     ..
00005 *     .. Array Arguments ..
00006       REAL SX(*)
00007 *     ..
00008 *
00009 *  Purpose
00010 *  =======
00011 *
00012 *     ISAMAX 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 *     .. Intrinsic Functions ..
00028       INTRINSIC ABS
00029 *     ..
00030       ISAMAX = 0
00031       IF (N.LT.1 .OR. INCX.LE.0) RETURN
00032       ISAMAX = 1
00033       IF (N.EQ.1) RETURN
00034       IF (INCX.EQ.1) GO TO 20
00035 *
00036 *        code for increment not equal to 1
00037 *
00038       IX = 1
00039       SMAX = ABS(SX(1))
00040       IX = IX + INCX
00041       DO 10 I = 2,N
00042           IF (ABS(SX(IX)).LE.SMAX) GO TO 5
00043           ISAMAX = I
00044           SMAX = ABS(SX(IX))
00045     5     IX = IX + INCX
00046    10 CONTINUE
00047       RETURN
00048 *
00049 *        code for increment equal to 1
00050 *
00051    20 SMAX = ABS(SX(1))
00052       DO 30 I = 2,N
00053           IF (ABS(SX(I)).LE.SMAX) GO TO 30
00054           ISAMAX = I
00055           SMAX = ABS(SX(I))
00056    30 CONTINUE
00057       RETURN
00058       END
 All Files Functions