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.

scopyf.f 1.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. subroutine scopyf(n,sx,incx,sy,incy)
  2. c
  3. c copies a vector, x, to a vector, y.
  4. c uses unrolled loops for increments equal to 1.
  5. c jack dongarra, linpack, 3/11/78.
  6. c modified 12/3/93, array(1) declarations changed to array(*)
  7. c
  8. real sx(*),sy(*)
  9. integer i,incx,incy,ix,iy,m,mp1,n
  10. c
  11. if(n.le.0)return
  12. if(incx.eq.1.and.incy.eq.1)go to 20
  13. c
  14. c code for unequal increments or equal increments
  15. c not equal to 1
  16. c
  17. ix = 1
  18. iy = 1
  19. if(incx.lt.0)ix = (-n+1)*incx + 1
  20. if(incy.lt.0)iy = (-n+1)*incy + 1
  21. do 10 i = 1,n
  22. sy(iy) = sx(ix)
  23. ix = ix + incx
  24. iy = iy + incy
  25. 10 continue
  26. return
  27. c
  28. c code for both increments equal to 1
  29. c
  30. c
  31. c clean-up loop
  32. c
  33. 20 m = mod(n,7)
  34. if( m .eq. 0 ) go to 40
  35. do 30 i = 1,m
  36. sy(i) = sx(i)
  37. 30 continue
  38. if( n .lt. 7 ) return
  39. 40 mp1 = m + 1
  40. do 50 i = mp1,n,7
  41. sy(i) = sx(i)
  42. sy(i + 1) = sx(i + 1)
  43. sy(i + 2) = sx(i + 2)
  44. sy(i + 3) = sx(i + 3)
  45. sy(i + 4) = sx(i + 4)
  46. sy(i + 5) = sx(i + 5)
  47. sy(i + 6) = sx(i + 6)
  48. 50 continue
  49. return
  50. end