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
idamin.f
Go to the documentation of this file.
1 c BLAS routine missing in ACML and some other implementations
2 
3  integer function idamin(n,dx,incx)
4 c
5 c finds the index of element having min. absolute value.
6 c
7  double precision dx(*),dmin
8  integer i,incx,ix,n
9 c
10  idamin = 0
11  if( n.lt.1 .or. incx.le.0 ) return
12  idamin = 1
13  if(n.eq.1)return
14  if(incx.eq.1)go to 20
15 c
16 c code for increment not equal to 1
17 c
18  ix = 1
19  dmin = dabs(dx(1))
20  ix = ix + incx
21  do 10 i = 2,n
22  if(dabs(dx(ix)).ge.dmin) go to 5
23  idamin = i
24  dmin = dabs(dx(ix))
25  5 ix = ix + incx
26  10 continue
27  return
28 c
29 c code for increment equal to 1
30 c
31  20 dmin = dabs(dx(1))
32  do 30 i = 2,n
33  if(dabs(dx(i)).ge.dmin) go to 30
34  idamin = i
35  dmin = dabs(dx(i))
36  30 continue
37  return
38  end