KTH framework for Nek5000 toolboxes; testing version  0.0.1
izamax.f
Go to the documentation of this file.
1  integer function izamax(n,zx,incx)
2 c
3 c finds the index of element having max. absolute value.
4 c jack dongarra, 1/15/85.
5 c modified 3/93 to return if incx .le. 0.
6 c modified 12/3/93, array(1) declarations changed to array(*)
7 c
8  double complex zx(*)
9  double precision smax
10  integer i,incx,ix,n
11  double precision dcabs1
12 c
13  izamax = 0
14  if( n.lt.1 .or. incx.le.0 )return
15  izamax = 1
16  if(n.eq.1)return
17  if(incx.eq.1)go to 20
18 c
19 c code for increment not equal to 1
20 c
21  ix = 1
22  smax = dcabs1(zx(1))
23  ix = ix + incx
24  do 10 i = 2,n
25  if(dcabs1(zx(ix)).le.smax) go to 5
26  izamax = i
27  smax = dcabs1(zx(ix))
28  5 ix = ix + incx
29  10 continue
30  return
31 c
32 c code for increment equal to 1
33 c
34  20 smax = dcabs1(zx(1))
35  do 30 i = 2,n
36  if(dcabs1(zx(i)).le.smax) go to 30
37  izamax = i
38  smax = dcabs1(zx(i))
39  30 continue
40  return
41  end
double precision function dcabs1(z)
Definition: dcabs1.f:2
integer function izamax(n, zx, incx)
Definition: izamax.f:2