LAPACK 3.3.1
Linear Algebra PACKage
|
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 DMAX 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) THEN 00036 * 00037 * code for increment equal to 1 00038 * 00039 DMAX = DCABS1(ZX(1)) 00040 DO I = 2,N 00041 IF (DCABS1(ZX(I)).GT.DMAX) THEN 00042 IZAMAX = I 00043 DMAX = DCABS1(ZX(I)) 00044 END IF 00045 END DO 00046 ELSE 00047 * 00048 * code for increment not equal to 1 00049 * 00050 IX = 1 00051 DMAX = DCABS1(ZX(1)) 00052 IX = IX + INCX 00053 DO I = 2,N 00054 IF (DCABS1(ZX(IX)).GT.DMAX) THEN 00055 IZAMAX = I 00056 DMAX = DCABS1(ZX(IX)) 00057 END IF 00058 IX = IX + INCX 00059 END DO 00060 END IF 00061 RETURN 00062 END