00001 /* izmax1.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 integer izmax1_(integer *n, doublecomplex *cx, integer *incx) 00017 { 00018 /* System generated locals */ 00019 integer ret_val, i__1; 00020 00021 /* Builtin functions */ 00022 double z_abs(doublecomplex *); 00023 00024 /* Local variables */ 00025 integer i__, ix; 00026 doublereal smax; 00027 00028 00029 /* -- LAPACK auxiliary routine (version 3.2) -- */ 00030 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00031 /* November 2006 */ 00032 00033 /* .. Scalar Arguments .. */ 00034 /* .. */ 00035 /* .. Array Arguments .. */ 00036 /* .. */ 00037 00038 /* Purpose */ 00039 /* ======= */ 00040 00041 /* IZMAX1 finds the index of the element whose real part has maximum */ 00042 /* absolute value. */ 00043 00044 /* Based on IZAMAX from Level 1 BLAS. */ 00045 /* The change is to use the 'genuine' absolute value. */ 00046 00047 /* Contributed by Nick Higham for use with ZLACON. */ 00048 00049 /* Arguments */ 00050 /* ========= */ 00051 00052 /* N (input) INTEGER */ 00053 /* The number of elements in the vector CX. */ 00054 00055 /* CX (input) COMPLEX*16 array, dimension (N) */ 00056 /* The vector whose elements will be summed. */ 00057 00058 /* INCX (input) INTEGER */ 00059 /* The spacing between successive values of CX. INCX >= 1. */ 00060 00061 /* ===================================================================== */ 00062 00063 /* .. Local Scalars .. */ 00064 /* .. */ 00065 /* .. Intrinsic Functions .. */ 00066 /* .. */ 00067 /* .. Statement Functions .. */ 00068 /* .. */ 00069 /* .. Statement Function definitions .. */ 00070 00071 /* NEXT LINE IS THE ONLY MODIFICATION. */ 00072 /* .. */ 00073 /* .. Executable Statements .. */ 00074 00075 /* Parameter adjustments */ 00076 --cx; 00077 00078 /* Function Body */ 00079 ret_val = 0; 00080 if (*n < 1) { 00081 return ret_val; 00082 } 00083 ret_val = 1; 00084 if (*n == 1) { 00085 return ret_val; 00086 } 00087 if (*incx == 1) { 00088 goto L30; 00089 } 00090 00091 /* CODE FOR INCREMENT NOT EQUAL TO 1 */ 00092 00093 ix = 1; 00094 smax = z_abs(&cx[1]); 00095 ix += *incx; 00096 i__1 = *n; 00097 for (i__ = 2; i__ <= i__1; ++i__) { 00098 if (z_abs(&cx[ix]) <= smax) { 00099 goto L10; 00100 } 00101 ret_val = i__; 00102 smax = z_abs(&cx[ix]); 00103 L10: 00104 ix += *incx; 00105 /* L20: */ 00106 } 00107 return ret_val; 00108 00109 /* CODE FOR INCREMENT EQUAL TO 1 */ 00110 00111 L30: 00112 smax = z_abs(&cx[1]); 00113 i__1 = *n; 00114 for (i__ = 2; i__ <= i__1; ++i__) { 00115 if (z_abs(&cx[i__]) <= smax) { 00116 goto L40; 00117 } 00118 ret_val = i__; 00119 smax = z_abs(&cx[i__]); 00120 L40: 00121 ; 00122 } 00123 return ret_val; 00124 00125 /* End of IZMAX1 */ 00126 00127 } /* izmax1_ */