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.

dminf.f 813 B

123456789101112131415161718192021222324252627282930313233343536
  1. REAL*8 function dminf(n,dx,incx)
  2. c
  3. c finds the index of element having min. absolute value.
  4. c jack dongarra, linpack, 3/11/78.
  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 precision dx(*)
  9. integer i,incx,ix,n
  10. c
  11. dminf = 0
  12. if( n.lt.1 .or. incx.le.0 ) return
  13. if(incx.eq.1)go to 20
  14. c
  15. c code for increment not equal to 1
  16. c
  17. ix = 1
  18. dminf = dx(1)
  19. ix = ix + incx
  20. do 10 i = 2,n
  21. if(dx(ix).ge.dminf) go to 5
  22. dminf = dx(ix)
  23. 5 ix = ix + incx
  24. 10 continue
  25. return
  26. c
  27. c code for increment equal to 1
  28. c
  29. 20 dminf = dx(1)
  30. do 30 i = 2,n
  31. if(dx(i).ge.dminf) go to 30
  32. dminf = dx(i)
  33. 30 continue
  34. return
  35. end