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.

cswapf.f 844 B

123456789101112131415161718192021222324252627282930313233343536
  1. subroutine cswapf (n,cx,incx,cy,incy)
  2. c
  3. c interchanges two vectors.
  4. c jack dongarra, linpack, 3/11/78.
  5. c modified 12/3/93, array(1) declarations changed to array(*)
  6. c
  7. complex cx(*),cy(*),ctemp
  8. integer i,incx,incy,ix,iy,n
  9. c
  10. if(n.le.0)return
  11. if(incx.eq.1.and.incy.eq.1)go to 20
  12. c
  13. c code for unequal increments or equal increments not equal
  14. c to 1
  15. c
  16. ix = 1
  17. iy = 1
  18. if(incx.lt.0)ix = (-n+1)*incx + 1
  19. if(incy.lt.0)iy = (-n+1)*incy + 1
  20. do 10 i = 1,n
  21. ctemp = cx(ix)
  22. cx(ix) = cy(iy)
  23. cy(iy) = ctemp
  24. ix = ix + incx
  25. iy = iy + incy
  26. 10 continue
  27. return
  28. c
  29. c code for both increments equal to 1
  30. 20 do 30 i = 1,n
  31. ctemp = cx(i)
  32. cx(i) = cy(i)
  33. cy(i) = ctemp
  34. 30 continue
  35. return
  36. end