zscal.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* zscal.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 zscal_(integer *n, doublecomplex *za, doublecomplex *zx,
  14. integer *incx)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3;
  18. doublecomplex z__1;
  19. /* Local variables */
  20. integer i__, ix;
  21. /* .. Scalar Arguments .. */
  22. /* .. */
  23. /* .. Array Arguments .. */
  24. /* .. */
  25. /* Purpose */
  26. /* ======= */
  27. /* scales a vector by a constant. */
  28. /* jack dongarra, 3/11/78. */
  29. /* modified 3/93 to return if incx .le. 0. */
  30. /* modified 12/3/93, array(1) declarations changed to array(*) */
  31. /* .. Local Scalars .. */
  32. /* .. */
  33. /* Parameter adjustments */
  34. --zx;
  35. /* Function Body */
  36. if (*n <= 0 || *incx <= 0) {
  37. return 0;
  38. }
  39. if (*incx == 1) {
  40. goto L20;
  41. }
  42. /* code for increment not equal to 1 */
  43. ix = 1;
  44. i__1 = *n;
  45. for (i__ = 1; i__ <= i__1; ++i__) {
  46. i__2 = ix;
  47. i__3 = ix;
  48. z__1.r = za->r * zx[i__3].r - za->i * zx[i__3].i, z__1.i = za->r * zx[
  49. i__3].i + za->i * zx[i__3].r;
  50. zx[i__2].r = z__1.r, zx[i__2].i = z__1.i;
  51. ix += *incx;
  52. /* L10: */
  53. }
  54. return 0;
  55. /* code for increment equal to 1 */
  56. L20:
  57. i__1 = *n;
  58. for (i__ = 1; i__ <= i__1; ++i__) {
  59. i__2 = i__;
  60. i__3 = i__;
  61. z__1.r = za->r * zx[i__3].r - za->i * zx[i__3].i, z__1.i = za->r * zx[
  62. i__3].i + za->i * zx[i__3].r;
  63. zx[i__2].r = z__1.r, zx[i__2].i = z__1.i;
  64. /* L30: */
  65. }
  66. return 0;
  67. } /* zscal_ */