zswap.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* zswap.f -- translated by f2c (version 20061008).
  2. You must link the resulting object file with libf2c:
  3. on Microsoft Windows system, link with libf2c.lib;
  4. on Linux or Unix systems, link with .../path/to/libf2c.a -lm
  5. or, if you install libf2c.a in a standard place, with -lf2c -lm
  6. -- in that order, at the end of the command line, as in
  7. cc *.o -lf2c -lm
  8. Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
  9. http://www.netlib.org/f2c/libf2c.zip
  10. */
  11. #include "f2c.h"
  12. #include "blaswrap.h"
  13. /* Subroutine */ int zswap_(integer *n, doublecomplex *zx, integer *incx,
  14. doublecomplex *zy, integer *incy)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3;
  18. /* Local variables */
  19. integer i__, ix, iy;
  20. doublecomplex ztemp;
  21. /* .. Scalar Arguments .. */
  22. /* .. */
  23. /* .. Array Arguments .. */
  24. /* .. */
  25. /* Purpose */
  26. /* ======= */
  27. /* interchanges two vectors. */
  28. /* jack dongarra, 3/11/78. */
  29. /* modified 12/3/93, array(1) declarations changed to array(*) */
  30. /* .. Local Scalars .. */
  31. /* .. */
  32. /* Parameter adjustments */
  33. --zy;
  34. --zx;
  35. /* Function Body */
  36. if (*n <= 0) {
  37. return 0;
  38. }
  39. if (*incx == 1 && *incy == 1) {
  40. goto L20;
  41. }
  42. /* code for unequal increments or equal increments not equal */
  43. /* to 1 */
  44. ix = 1;
  45. iy = 1;
  46. if (*incx < 0) {
  47. ix = (-(*n) + 1) * *incx + 1;
  48. }
  49. if (*incy < 0) {
  50. iy = (-(*n) + 1) * *incy + 1;
  51. }
  52. i__1 = *n;
  53. for (i__ = 1; i__ <= i__1; ++i__) {
  54. i__2 = ix;
  55. ztemp.r = zx[i__2].r, ztemp.i = zx[i__2].i;
  56. i__2 = ix;
  57. i__3 = iy;
  58. zx[i__2].r = zy[i__3].r, zx[i__2].i = zy[i__3].i;
  59. i__2 = iy;
  60. zy[i__2].r = ztemp.r, zy[i__2].i = ztemp.i;
  61. ix += *incx;
  62. iy += *incy;
  63. /* L10: */
  64. }
  65. return 0;
  66. /* code for both increments equal to 1 */
  67. L20:
  68. i__1 = *n;
  69. for (i__ = 1; i__ <= i__1; ++i__) {
  70. i__2 = i__;
  71. ztemp.r = zx[i__2].r, ztemp.i = zx[i__2].i;
  72. i__2 = i__;
  73. i__3 = i__;
  74. zx[i__2].r = zy[i__3].r, zx[i__2].i = zy[i__3].i;
  75. i__2 = i__;
  76. zy[i__2].r = ztemp.r, zy[i__2].i = ztemp.i;
  77. /* L30: */
  78. }
  79. return 0;
  80. } /* zswap_ */