You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
4.8 KiB

  1. /* srotm.f -- translated by f2c (version 20100827).
  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 "datatypes.h"
  12. /* Subroutine */ int srotm_(integer *n, real *sx, integer *incx, real *sy,
  13. integer *incy, real *sparam)
  14. {
  15. /* Initialized data */
  16. static real zero = 0.f;
  17. static real two = 2.f;
  18. /* System generated locals */
  19. integer i__1, i__2;
  20. /* Local variables */
  21. integer i__;
  22. real w, z__;
  23. integer kx, ky;
  24. real sh11, sh12, sh21, sh22, sflag;
  25. integer nsteps;
  26. /* .. Scalar Arguments .. */
  27. /* .. */
  28. /* .. Array Arguments .. */
  29. /* .. */
  30. /* Purpose */
  31. /* ======= */
  32. /* APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIX */
  33. /* (SX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF SX ARE IN */
  34. /* (DX**T) */
  35. /* SX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSE */
  36. /* LX = (-INCX)*N, AND SIMILARLY FOR SY USING USING LY AND INCY. */
  37. /* WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */
  38. /* SFLAG=-1.E0 SFLAG=0.E0 SFLAG=1.E0 SFLAG=-2.E0 */
  39. /* (SH11 SH12) (1.E0 SH12) (SH11 1.E0) (1.E0 0.E0) */
  40. /* H=( ) ( ) ( ) ( ) */
  41. /* (SH21 SH22), (SH21 1.E0), (-1.E0 SH22), (0.E0 1.E0). */
  42. /* SEE SROTMG FOR A DESCRIPTION OF DATA STORAGE IN SPARAM. */
  43. /* Arguments */
  44. /* ========= */
  45. /* N (input) INTEGER */
  46. /* number of elements in input vector(s) */
  47. /* SX (input/output) REAL array, dimension N */
  48. /* double precision vector with N elements */
  49. /* INCX (input) INTEGER */
  50. /* storage spacing between elements of SX */
  51. /* SY (input/output) REAL array, dimension N */
  52. /* double precision vector with N elements */
  53. /* INCY (input) INTEGER */
  54. /* storage spacing between elements of SY */
  55. /* SPARAM (input/output) REAL array, dimension 5 */
  56. /* SPARAM(1)=SFLAG */
  57. /* SPARAM(2)=SH11 */
  58. /* SPARAM(3)=SH21 */
  59. /* SPARAM(4)=SH12 */
  60. /* SPARAM(5)=SH22 */
  61. /* ===================================================================== */
  62. /* .. Local Scalars .. */
  63. /* .. */
  64. /* .. Data statements .. */
  65. /* Parameter adjustments */
  66. --sparam;
  67. --sy;
  68. --sx;
  69. /* Function Body */
  70. /* .. */
  71. sflag = sparam[1];
  72. if (*n <= 0 || sflag + two == zero) {
  73. goto L140;
  74. }
  75. if (! (*incx == *incy && *incx > 0)) {
  76. goto L70;
  77. }
  78. nsteps = *n * *incx;
  79. if (sflag < 0.f) {
  80. goto L50;
  81. } else if (sflag == 0) {
  82. goto L10;
  83. } else {
  84. goto L30;
  85. }
  86. L10:
  87. sh12 = sparam[4];
  88. sh21 = sparam[3];
  89. i__1 = nsteps;
  90. i__2 = *incx;
  91. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  92. w = sx[i__];
  93. z__ = sy[i__];
  94. sx[i__] = w + z__ * sh12;
  95. sy[i__] = w * sh21 + z__;
  96. /* L20: */
  97. }
  98. goto L140;
  99. L30:
  100. sh11 = sparam[2];
  101. sh22 = sparam[5];
  102. i__2 = nsteps;
  103. i__1 = *incx;
  104. for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
  105. w = sx[i__];
  106. z__ = sy[i__];
  107. sx[i__] = w * sh11 + z__;
  108. sy[i__] = -w + sh22 * z__;
  109. /* L40: */
  110. }
  111. goto L140;
  112. L50:
  113. sh11 = sparam[2];
  114. sh12 = sparam[4];
  115. sh21 = sparam[3];
  116. sh22 = sparam[5];
  117. i__1 = nsteps;
  118. i__2 = *incx;
  119. for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
  120. w = sx[i__];
  121. z__ = sy[i__];
  122. sx[i__] = w * sh11 + z__ * sh12;
  123. sy[i__] = w * sh21 + z__ * sh22;
  124. /* L60: */
  125. }
  126. goto L140;
  127. L70:
  128. kx = 1;
  129. ky = 1;
  130. if (*incx < 0) {
  131. kx = (1 - *n) * *incx + 1;
  132. }
  133. if (*incy < 0) {
  134. ky = (1 - *n) * *incy + 1;
  135. }
  136. if (sflag < 0.f) {
  137. goto L120;
  138. } else if (sflag == 0) {
  139. goto L80;
  140. } else {
  141. goto L100;
  142. }
  143. L80:
  144. sh12 = sparam[4];
  145. sh21 = sparam[3];
  146. i__2 = *n;
  147. for (i__ = 1; i__ <= i__2; ++i__) {
  148. w = sx[kx];
  149. z__ = sy[ky];
  150. sx[kx] = w + z__ * sh12;
  151. sy[ky] = w * sh21 + z__;
  152. kx += *incx;
  153. ky += *incy;
  154. /* L90: */
  155. }
  156. goto L140;
  157. L100:
  158. sh11 = sparam[2];
  159. sh22 = sparam[5];
  160. i__2 = *n;
  161. for (i__ = 1; i__ <= i__2; ++i__) {
  162. w = sx[kx];
  163. z__ = sy[ky];
  164. sx[kx] = w * sh11 + z__;
  165. sy[ky] = -w + sh22 * z__;
  166. kx += *incx;
  167. ky += *incy;
  168. /* L110: */
  169. }
  170. goto L140;
  171. L120:
  172. sh11 = sparam[2];
  173. sh12 = sparam[4];
  174. sh21 = sparam[3];
  175. sh22 = sparam[5];
  176. i__2 = *n;
  177. for (i__ = 1; i__ <= i__2; ++i__) {
  178. w = sx[kx];
  179. z__ = sy[ky];
  180. sx[kx] = w * sh11 + z__ * sh12;
  181. sy[ky] = w * sh21 + z__ * sh22;
  182. kx += *incx;
  183. ky += *incy;
  184. /* L130: */
  185. }
  186. L140:
  187. return 0;
  188. } /* srotm_ */