You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

izamaxf.f 988 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. integer function izamaxf(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. izamaxf = 0
  14. if( n.lt.1 .or. incx.le.0 )return
  15. izamaxf = 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. izamaxf = 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. izamaxf = i
  38. smax = dcabs1(zx(i))
  39. 30 continue
  40. return
  41. end