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.

dzamaxf.f 986 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. REAL*8 function dzamaxf(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. COMPLEX*16 zx(*)
  9. integer i,incx,ix,n
  10. double precision dcabs1
  11. c
  12. dzamaxf = 0.
  13. if( n.lt.1 .or. incx.le.0 )return
  14. dzamaxf = dcabs1(zx(1))
  15. if(n.eq.1)return
  16. if(incx.eq.1)go to 20
  17. c
  18. c code for increment not equal to 1
  19. c
  20. ix = 1
  21. dzamaxf = dcabs1(zx(1))
  22. ix = ix + incx
  23. do 10 i = 2,n
  24. if(dcabs1(zx(ix)).le.dzamaxf) go to 5
  25. dzamaxf = i
  26. dzamaxf = dcabs1(zx(ix))
  27. 5 ix = ix + incx
  28. 10 continue
  29. return
  30. c
  31. c code for increment equal to 1
  32. c
  33. 20 dzamaxf = dcabs1(zx(1))
  34. do 30 i = 2,n
  35. if(dcabs1(zx(i)).le.dzamaxf) go to 30
  36. dzamaxf = i
  37. dzamaxf = dcabs1(zx(i))
  38. 30 continue
  39. return
  40. end