CVM Class Library  8.1
This C++ class library encapsulates concepts of vector and different matrices including square, band, symmetric and hermitian ones in Euclidean space of real and complex numbers.
 All Classes Files Functions Variables Typedefs Friends Macros Pages
icamax.f
Go to the documentation of this file.
1 c BLAS routine missing in ACML and some other implementations
2 
3  integer function icamax(n,cx,incx)
4 c
5 c finds the index of element having max. absolute value.
6 c jack dongarra, linpack, 3/11/78.
7 c modified 3/93 to return if incx .le. 0.
8 c modified 12/3/93, array(1) declarations changed to array(*)
9 c
10  complex cx(*)
11  real smax
12  integer i,incx,ix,n
13  real cabs
14 c
15  icamax = 0
16  if( n.lt.1 .or. incx.le.0 ) return
17  icamax = 1
18  if(n.eq.1)return
19  if(incx.eq.1)go to 20
20 c
21 c code for increment not equal to 1
22 c
23  ix = 1
24  smax = cabs(cx(1))
25  ix = ix + incx
26  do 10 i = 2,n
27  if(cabs(cx(ix)).le.smax) go to 5
28  icamax = i
29  smax = cabs(cx(ix))
30  5 ix = ix + incx
31  10 continue
32  return
33 c
34 c code for increment equal to 1
35 c
36  20 smax = cabs(cx(1))
37  do 30 i = 2,n
38  if(cabs(cx(i)).le.smax) go to 30
39  icamax = i
40  smax = cabs(cx(i))
41  30 continue
42  return
43  end