zaxpy.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* zaxpy.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 zaxpy_(integer *n, doublecomplex *za, doublecomplex *zx,
  14. integer *incx, doublecomplex *zy, integer *incy)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3, i__4;
  18. doublecomplex z__1, z__2;
  19. /* Local variables */
  20. integer i__, ix, iy;
  21. extern doublereal dcabs1_(doublecomplex *);
  22. /* .. Scalar Arguments .. */
  23. /* .. */
  24. /* .. Array Arguments .. */
  25. /* .. */
  26. /* Purpose */
  27. /* ======= */
  28. /* constant times a vector plus a vector. */
  29. /* jack dongarra, 3/11/78. */
  30. /* modified 12/3/93, array(1) declarations changed to array(*) */
  31. /* .. Local Scalars .. */
  32. /* .. */
  33. /* .. External Functions .. */
  34. /* .. */
  35. /* Parameter adjustments */
  36. --zy;
  37. --zx;
  38. /* Function Body */
  39. if (*n <= 0) {
  40. return 0;
  41. }
  42. if (dcabs1_(za) == 0.) {
  43. return 0;
  44. }
  45. if (*incx == 1 && *incy == 1) {
  46. goto L20;
  47. }
  48. /* code for unequal increments or equal increments */
  49. /* not equal to 1 */
  50. ix = 1;
  51. iy = 1;
  52. if (*incx < 0) {
  53. ix = (-(*n) + 1) * *incx + 1;
  54. }
  55. if (*incy < 0) {
  56. iy = (-(*n) + 1) * *incy + 1;
  57. }
  58. i__1 = *n;
  59. for (i__ = 1; i__ <= i__1; ++i__) {
  60. i__2 = iy;
  61. i__3 = iy;
  62. i__4 = ix;
  63. z__2.r = za->r * zx[i__4].r - za->i * zx[i__4].i, z__2.i = za->r * zx[
  64. i__4].i + za->i * zx[i__4].r;
  65. z__1.r = zy[i__3].r + z__2.r, z__1.i = zy[i__3].i + z__2.i;
  66. zy[i__2].r = z__1.r, zy[i__2].i = z__1.i;
  67. ix += *incx;
  68. iy += *incy;
  69. /* L10: */
  70. }
  71. return 0;
  72. /* code for both increments equal to 1 */
  73. L20:
  74. i__1 = *n;
  75. for (i__ = 1; i__ <= i__1; ++i__) {
  76. i__2 = i__;
  77. i__3 = i__;
  78. i__4 = i__;
  79. z__2.r = za->r * zx[i__4].r - za->i * zx[i__4].i, z__2.i = za->r * zx[
  80. i__4].i + za->i * zx[i__4].r;
  81. z__1.r = zy[i__3].r + z__2.r, z__1.i = zy[i__3].i + z__2.i;
  82. zy[i__2].r = z__1.r, zy[i__2].i = z__1.i;
  83. /* L30: */
  84. }
  85. return 0;
  86. } /* zaxpy_ */