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.

215 lines
4.9 KiB

  1. /* drotm.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 drotm_(integer *n, doublereal *dx, integer *incx,
  13. doublereal *dy, integer *incy, doublereal *dparam)
  14. {
  15. /* Initialized data */
  16. static doublereal zero = 0.;
  17. static doublereal two = 2.;
  18. /* System generated locals */
  19. integer i__1, i__2;
  20. /* Local variables */
  21. integer i__;
  22. doublereal w, z__;
  23. integer kx, ky;
  24. doublereal dh11, dh12, dh21, dh22, dflag;
  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. /* (DX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF DX ARE IN */
  34. /* (DY**T) */
  35. /* DX(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 LY AND INCY. */
  37. /* WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */
  38. /* DFLAG=-1.D0 DFLAG=0.D0 DFLAG=1.D0 DFLAG=-2.D0 */
  39. /* (DH11 DH12) (1.D0 DH12) (DH11 1.D0) (1.D0 0.D0) */
  40. /* H=( ) ( ) ( ) ( ) */
  41. /* (DH21 DH22), (DH21 1.D0), (-1.D0 DH22), (0.D0 1.D0). */
  42. /* SEE DROTMG FOR A DESCRIPTION OF DATA STORAGE IN DPARAM. */
  43. /* Arguments */
  44. /* ========= */
  45. /* N (input) INTEGER */
  46. /* number of elements in input vector(s) */
  47. /* DX (input/output) DOUBLE PRECISION array, dimension N */
  48. /* double precision vector with N elements */
  49. /* INCX (input) INTEGER */
  50. /* storage spacing between elements of DX */
  51. /* DY (input/output) DOUBLE PRECISION array, dimension N */
  52. /* double precision vector with N elements */
  53. /* INCY (input) INTEGER */
  54. /* storage spacing between elements of DY */
  55. /* DPARAM (input/output) DOUBLE PRECISION array, dimension 5 */
  56. /* DPARAM(1)=DFLAG */
  57. /* DPARAM(2)=DH11 */
  58. /* DPARAM(3)=DH21 */
  59. /* DPARAM(4)=DH12 */
  60. /* DPARAM(5)=DH22 */
  61. /* ===================================================================== */
  62. /* .. Local Scalars .. */
  63. /* .. */
  64. /* .. Data statements .. */
  65. /* Parameter adjustments */
  66. --dparam;
  67. --dy;
  68. --dx;
  69. /* Function Body */
  70. /* .. */
  71. dflag = dparam[1];
  72. if (*n <= 0 || dflag + two == zero) {
  73. goto L140;
  74. }
  75. if (! (*incx == *incy && *incx > 0)) {
  76. goto L70;
  77. }
  78. nsteps = *n * *incx;
  79. if (dflag < 0.) {
  80. goto L50;
  81. } else if (dflag == 0) {
  82. goto L10;
  83. } else {
  84. goto L30;
  85. }
  86. L10:
  87. dh12 = dparam[4];
  88. dh21 = dparam[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 = dx[i__];
  93. z__ = dy[i__];
  94. dx[i__] = w + z__ * dh12;
  95. dy[i__] = w * dh21 + z__;
  96. /* L20: */
  97. }
  98. goto L140;
  99. L30:
  100. dh11 = dparam[2];
  101. dh22 = dparam[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 = dx[i__];
  106. z__ = dy[i__];
  107. dx[i__] = w * dh11 + z__;
  108. dy[i__] = -w + dh22 * z__;
  109. /* L40: */
  110. }
  111. goto L140;
  112. L50:
  113. dh11 = dparam[2];
  114. dh12 = dparam[4];
  115. dh21 = dparam[3];
  116. dh22 = dparam[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 = dx[i__];
  121. z__ = dy[i__];
  122. dx[i__] = w * dh11 + z__ * dh12;
  123. dy[i__] = w * dh21 + z__ * dh22;
  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 (dflag < 0.) {
  137. goto L120;
  138. } else if (dflag == 0) {
  139. goto L80;
  140. } else {
  141. goto L100;
  142. }
  143. L80:
  144. dh12 = dparam[4];
  145. dh21 = dparam[3];
  146. i__2 = *n;
  147. for (i__ = 1; i__ <= i__2; ++i__) {
  148. w = dx[kx];
  149. z__ = dy[ky];
  150. dx[kx] = w + z__ * dh12;
  151. dy[ky] = w * dh21 + z__;
  152. kx += *incx;
  153. ky += *incy;
  154. /* L90: */
  155. }
  156. goto L140;
  157. L100:
  158. dh11 = dparam[2];
  159. dh22 = dparam[5];
  160. i__2 = *n;
  161. for (i__ = 1; i__ <= i__2; ++i__) {
  162. w = dx[kx];
  163. z__ = dy[ky];
  164. dx[kx] = w * dh11 + z__;
  165. dy[ky] = -w + dh22 * z__;
  166. kx += *incx;
  167. ky += *incy;
  168. /* L110: */
  169. }
  170. goto L140;
  171. L120:
  172. dh11 = dparam[2];
  173. dh12 = dparam[4];
  174. dh21 = dparam[3];
  175. dh22 = dparam[5];
  176. i__2 = *n;
  177. for (i__ = 1; i__ <= i__2; ++i__) {
  178. w = dx[kx];
  179. z__ = dy[ky];
  180. dx[kx] = w * dh11 + z__ * dh12;
  181. dy[ky] = w * dh21 + z__ * dh22;
  182. kx += *incx;
  183. ky += *incy;
  184. /* L130: */
  185. }
  186. L140:
  187. return 0;
  188. } /* drotm_ */