Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/isamax.c

raw
1 /* ./src_f77/isamax.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 integer isamax_(integer *n, real *sx, integer *incx)
9 {
10 /* System generated locals */
11 integer ret_val, i__1;
12 real r__1;
13
14 /* Local variables */
15 static integer i__, ix;
16 static real smax;
17
18
19 /* finds the index of element having max. absolute value. */
20 /* jack dongarra, linpack, 3/11/78. */
21 /* modified 3/93 to return if incx .le. 0. */
22 /* modified 12/3/93, array(1) declarations changed to array(*) */
23
24
25 /* Parameter adjustments */
26 --sx;
27
28 /* Function Body */
29 ret_val = 0;
30 if (*n < 1 || *incx <= 0) {
31 return ret_val;
32 }
33 ret_val = 1;
34 if (*n == 1) {
35 return ret_val;
36 }
37 if (*incx == 1) {
38 goto L20;
39 }
40
41 /* code for increment not equal to 1 */
42
43 ix = 1;
44 smax = dabs(sx[1]);
45 ix += *incx;
46 i__1 = *n;
47 for (i__ = 2; i__ <= i__1; ++i__) {
48 if ((r__1 = sx[ix], dabs(r__1)) <= smax) {
49 goto L5;
50 }
51 ret_val = i__;
52 smax = (r__1 = sx[ix], dabs(r__1));
53 L5:
54 ix += *incx;
55 /* L10: */
56 }
57 return ret_val;
58
59 /* code for increment equal to 1 */
60
61 L20:
62 smax = dabs(sx[1]);
63 i__1 = *n;
64 for (i__ = 2; i__ <= i__1; ++i__) {
65 if ((r__1 = sx[i__], dabs(r__1)) <= smax) {
66 goto L30;
67 }
68 ret_val = i__;
69 smax = (r__1 = sx[i__], dabs(r__1));
70 L30:
71 ;
72 }
73 return ret_val;
74 } /* isamax_ */
75