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
isamax.f
Go to the documentation of this file.
1 c BLAS routine missing in ACML and some other implementations
2 
3  integer function isamax(n,sx,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  real sx(*),smax
11  integer i,incx,ix,n
12 c
13  isamax = 0
14  if( n.lt.1 .or. incx.le.0 ) return
15  isamax = 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 = abs(sx(1))
23  ix = ix + incx
24  do 10 i = 2,n
25  if(abs(sx(ix)).le.smax) go to 5
26  isamax = i
27  smax = abs(sx(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 = abs(sx(1))
35  do 30 i = 2,n
36  if(abs(sx(i)).le.smax) go to 30
37  isamax = i
38  smax = abs(sx(i))
39  30 continue
40  return
41  end