srot.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* srot.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 srot_(integer *n, real *sx, integer *incx, real *sy,
  14. integer *incy, real *c__, real *s)
  15. {
  16. /* System generated locals */
  17. integer i__1;
  18. /* Local variables */
  19. integer i__, ix, iy;
  20. real stemp;
  21. /* .. Scalar Arguments .. */
  22. /* .. */
  23. /* .. Array Arguments .. */
  24. /* .. */
  25. /* Purpose */
  26. /* ======= */
  27. /* applies a plane rotation. */
  28. /* Further Details */
  29. /* =============== */
  30. /* jack dongarra, linpack, 3/11/78. */
  31. /* modified 12/3/93, array(1) declarations changed to array(*) */
  32. /* .. Local Scalars .. */
  33. /* .. */
  34. /* Parameter adjustments */
  35. --sy;
  36. --sx;
  37. /* Function Body */
  38. if (*n <= 0) {
  39. return 0;
  40. }
  41. if (*incx == 1 && *incy == 1) {
  42. goto L20;
  43. }
  44. /* code for unequal increments or equal increments not equal */
  45. /* to 1 */
  46. ix = 1;
  47. iy = 1;
  48. if (*incx < 0) {
  49. ix = (-(*n) + 1) * *incx + 1;
  50. }
  51. if (*incy < 0) {
  52. iy = (-(*n) + 1) * *incy + 1;
  53. }
  54. i__1 = *n;
  55. for (i__ = 1; i__ <= i__1; ++i__) {
  56. stemp = *c__ * sx[ix] + *s * sy[iy];
  57. sy[iy] = *c__ * sy[iy] - *s * sx[ix];
  58. sx[ix] = stemp;
  59. ix += *incx;
  60. iy += *incy;
  61. /* L10: */
  62. }
  63. return 0;
  64. /* code for both increments equal to 1 */
  65. L20:
  66. i__1 = *n;
  67. for (i__ = 1; i__ <= i__1; ++i__) {
  68. stemp = *c__ * sx[i__] + *s * sy[i__];
  69. sy[i__] = *c__ * sy[i__] - *s * sx[i__];
  70. sx[i__] = stemp;
  71. /* L30: */
  72. }
  73. return 0;
  74. } /* srot_ */