zdscal.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* zdscal.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 zdscal_(integer *n, doublereal *da, doublecomplex *zx,
  14. integer *incx)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3;
  18. doublecomplex z__1, z__2;
  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. /* .. Intrinsic Functions .. */
  34. /* .. */
  35. /* Parameter adjustments */
  36. --zx;
  37. /* Function Body */
  38. if (*n <= 0 || *incx <= 0) {
  39. return 0;
  40. }
  41. if (*incx == 1) {
  42. goto L20;
  43. }
  44. /* code for increment not equal to 1 */
  45. ix = 1;
  46. i__1 = *n;
  47. for (i__ = 1; i__ <= i__1; ++i__) {
  48. i__2 = ix;
  49. z__2.r = *da, z__2.i = 0.;
  50. i__3 = ix;
  51. z__1.r = z__2.r * zx[i__3].r - z__2.i * zx[i__3].i, z__1.i = z__2.r *
  52. zx[i__3].i + z__2.i * zx[i__3].r;
  53. zx[i__2].r = z__1.r, zx[i__2].i = z__1.i;
  54. ix += *incx;
  55. /* L10: */
  56. }
  57. return 0;
  58. /* code for increment equal to 1 */
  59. L20:
  60. i__1 = *n;
  61. for (i__ = 1; i__ <= i__1; ++i__) {
  62. i__2 = i__;
  63. z__2.r = *da, z__2.i = 0.;
  64. i__3 = i__;
  65. z__1.r = z__2.r * zx[i__3].r - z__2.i * zx[i__3].i, z__1.i = z__2.r *
  66. zx[i__3].i + z__2.i * zx[i__3].r;
  67. zx[i__2].r = z__1.r, zx[i__2].i = z__1.i;
  68. /* L30: */
  69. }
  70. return 0;
  71. } /* zdscal_ */