LAPACK 3.3.0
|
00001 INTEGER FUNCTION IZAMAX(N,ZX,INCX) 00002 * .. Scalar Arguments .. 00003 INTEGER INCX,N 00004 * .. 00005 * .. Array Arguments .. 00006 DOUBLE COMPLEX ZX(*) 00007 * .. 00008 * 00009 * Purpose 00010 * ======= 00011 * 00012 * IZAMAX finds the index of element having max. absolute value. 00013 * 00014 * Further Details 00015 * =============== 00016 * 00017 * jack dongarra, 1/15/85. 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 DOUBLE PRECISION SMAX 00025 INTEGER I,IX 00026 * .. 00027 * .. External Functions .. 00028 DOUBLE PRECISION DCABS1 00029 EXTERNAL DCABS1 00030 * .. 00031 IZAMAX = 0 00032 IF (N.LT.1 .OR. INCX.LE.0) RETURN 00033 IZAMAX = 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 = DCABS1(ZX(1)) 00041 IX = IX + INCX 00042 DO 10 I = 2,N 00043 IF (DCABS1(ZX(IX)).LE.SMAX) GO TO 5 00044 IZAMAX = I 00045 SMAX = DCABS1(ZX(IX)) 00046 5 IX = IX + INCX 00047 10 CONTINUE 00048 RETURN 00049 * 00050 * code for increment equal to 1 00051 * 00052 20 SMAX = DCABS1(ZX(1)) 00053 DO 30 I = 2,N 00054 IF (DCABS1(ZX(I)).LE.SMAX) GO TO 30 00055 IZAMAX = I 00056 SMAX = DCABS1(ZX(I)) 00057 30 CONTINUE 00058 RETURN 00059 END