cscal.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* cscal.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 cscal_(integer *n, complex *ca, complex *cx, integer *
  14. incx)
  15. {
  16. /* System generated locals */
  17. integer i__1, i__2, i__3, i__4;
  18. complex q__1;
  19. /* Local variables */
  20. integer i__, nincx;
  21. /* .. Scalar Arguments .. */
  22. /* .. */
  23. /* .. Array Arguments .. */
  24. /* .. */
  25. /* Purpose */
  26. /* ======= */
  27. /* scales a vector by a constant. */
  28. /* jack dongarra, linpack, 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. --cx;
  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. nincx = *n * *incx;
  44. i__1 = nincx;
  45. i__2 = *incx;
  46. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  47. i__3 = i__;
  48. i__4 = i__;
  49. q__1.r = ca->r * cx[i__4].r - ca->i * cx[i__4].i, q__1.i = ca->r * cx[
  50. i__4].i + ca->i * cx[i__4].r;
  51. cx[i__3].r = q__1.r, cx[i__3].i = q__1.i;
  52. /* L10: */
  53. }
  54. return 0;
  55. /* code for increment equal to 1 */
  56. L20:
  57. i__2 = *n;
  58. for (i__ = 1; i__ <= i__2; ++i__) {
  59. i__1 = i__;
  60. i__3 = i__;
  61. q__1.r = ca->r * cx[i__3].r - ca->i * cx[i__3].i, q__1.i = ca->r * cx[
  62. i__3].i + ca->i * cx[i__3].r;
  63. cx[i__1].r = q__1.r, cx[i__1].i = q__1.i;
  64. /* L30: */
  65. }
  66. return 0;
  67. } /* cscal_ */