csscal.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* csscal.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 csscal_(integer *n, real *sa, complex *cx, integer *incx)
  14. {
  15. /* System generated locals */
  16. integer i__1, i__2, i__3, i__4;
  17. real r__1, r__2;
  18. complex q__1;
  19. /* Builtin functions */
  20. double r_imag(complex *);
  21. /* Local variables */
  22. integer i__, nincx;
  23. /* .. Scalar Arguments .. */
  24. /* .. */
  25. /* .. Array Arguments .. */
  26. /* .. */
  27. /* Purpose */
  28. /* ======= */
  29. /* scales a complex vector by a real constant. */
  30. /* jack dongarra, linpack, 3/11/78. */
  31. /* modified 3/93 to return if incx .le. 0. */
  32. /* modified 12/3/93, array(1) declarations changed to array(*) */
  33. /* .. Local Scalars .. */
  34. /* .. */
  35. /* .. Intrinsic Functions .. */
  36. /* .. */
  37. /* Parameter adjustments */
  38. --cx;
  39. /* Function Body */
  40. if (*n <= 0 || *incx <= 0) {
  41. return 0;
  42. }
  43. if (*incx == 1) {
  44. goto L20;
  45. }
  46. /* code for increment not equal to 1 */
  47. nincx = *n * *incx;
  48. i__1 = nincx;
  49. i__2 = *incx;
  50. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  51. i__3 = i__;
  52. i__4 = i__;
  53. r__1 = *sa * cx[i__4].r;
  54. r__2 = *sa * r_imag(&cx[i__]);
  55. q__1.r = r__1, q__1.i = r__2;
  56. cx[i__3].r = q__1.r, cx[i__3].i = q__1.i;
  57. /* L10: */
  58. }
  59. return 0;
  60. /* code for increment equal to 1 */
  61. L20:
  62. i__2 = *n;
  63. for (i__ = 1; i__ <= i__2; ++i__) {
  64. i__1 = i__;
  65. i__3 = i__;
  66. r__1 = *sa * cx[i__3].r;
  67. r__2 = *sa * r_imag(&cx[i__]);
  68. q__1.r = r__1, q__1.i = r__2;
  69. cx[i__1].r = q__1.r, cx[i__1].i = q__1.i;
  70. /* L30: */
  71. }
  72. return 0;
  73. } /* csscal_ */