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.

295 lines
5.9 KiB

  1. /* srotmg.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 srotmg_(real *sd1, real *sd2, real *sx1, real *sy1, real
  13. *sparam)
  14. {
  15. /* Initialized data */
  16. static real zero = 0.f;
  17. static real one = 1.f;
  18. static real two = 2.f;
  19. static real gam = 4096.f;
  20. static real gamsq = 16777200.f;
  21. static real rgamsq = 5.96046e-8f;
  22. /* Format strings */
  23. static char fmt_120[] = "";
  24. static char fmt_150[] = "";
  25. static char fmt_180[] = "";
  26. static char fmt_210[] = "";
  27. /* System generated locals */
  28. real r__1;
  29. /* Local variables */
  30. real su, sp1, sp2, sq1, sq2, sh11, sh12, sh21, sh22;
  31. integer igo;
  32. real sflag, stemp;
  33. /* Assigned format variables */
  34. static char *igo_fmt;
  35. /* .. Scalar Arguments .. */
  36. /* .. */
  37. /* .. Array Arguments .. */
  38. /* .. */
  39. /* Purpose */
  40. /* ======= */
  41. /* CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS */
  42. /* THE SECOND COMPONENT OF THE 2-VECTOR (SQRT(SD1)*SX1,SQRT(SD2)* */
  43. /* SY2)**T. */
  44. /* WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */
  45. /* SFLAG=-1.E0 SFLAG=0.E0 SFLAG=1.E0 SFLAG=-2.E0 */
  46. /* (SH11 SH12) (1.E0 SH12) (SH11 1.E0) (1.E0 0.E0) */
  47. /* H=( ) ( ) ( ) ( ) */
  48. /* (SH21 SH22), (SH21 1.E0), (-1.E0 SH22), (0.E0 1.E0). */
  49. /* LOCATIONS 2-4 OF SPARAM CONTAIN SH11,SH21,SH12, AND SH22 */
  50. /* RESPECTIVELY. (VALUES OF 1.E0, -1.E0, OR 0.E0 IMPLIED BY THE */
  51. /* VALUE OF SPARAM(1) ARE NOT STORED IN SPARAM.) */
  52. /* THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE */
  53. /* INEXACT. THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE */
  54. /* OF SD1 AND SD2. ALL ACTUAL SCALING OF DATA IS DONE USING GAM. */
  55. /* Arguments */
  56. /* ========= */
  57. /* SD1 (input/output) REAL */
  58. /* SD2 (input/output) REAL */
  59. /* SX1 (input/output) REAL */
  60. /* SY1 (input) REAL */
  61. /* SPARAM (input/output) REAL array, dimension 5 */
  62. /* SPARAM(1)=SFLAG */
  63. /* SPARAM(2)=SH11 */
  64. /* SPARAM(3)=SH21 */
  65. /* SPARAM(4)=SH12 */
  66. /* SPARAM(5)=SH22 */
  67. /* ===================================================================== */
  68. /* .. Local Scalars .. */
  69. /* .. */
  70. /* .. Intrinsic Functions .. */
  71. /* .. */
  72. /* .. Data statements .. */
  73. /* Parameter adjustments */
  74. --sparam;
  75. /* Function Body */
  76. /* .. */
  77. if (! (*sd1 < zero)) {
  78. goto L10;
  79. }
  80. /* GO ZERO-H-D-AND-SX1.. */
  81. goto L60;
  82. L10:
  83. /* CASE-SD1-NONNEGATIVE */
  84. sp2 = *sd2 * *sy1;
  85. if (! (sp2 == zero)) {
  86. goto L20;
  87. }
  88. sflag = -two;
  89. goto L260;
  90. /* REGULAR-CASE.. */
  91. L20:
  92. sp1 = *sd1 * *sx1;
  93. sq2 = sp2 * *sy1;
  94. sq1 = sp1 * *sx1;
  95. if (! (dabs(sq1) > dabs(sq2))) {
  96. goto L40;
  97. }
  98. sh21 = -(*sy1) / *sx1;
  99. sh12 = sp2 / sp1;
  100. su = one - sh12 * sh21;
  101. if (! (su <= zero)) {
  102. goto L30;
  103. }
  104. /* GO ZERO-H-D-AND-SX1.. */
  105. goto L60;
  106. L30:
  107. sflag = zero;
  108. *sd1 /= su;
  109. *sd2 /= su;
  110. *sx1 *= su;
  111. /* GO SCALE-CHECK.. */
  112. goto L100;
  113. L40:
  114. if (! (sq2 < zero)) {
  115. goto L50;
  116. }
  117. /* GO ZERO-H-D-AND-SX1.. */
  118. goto L60;
  119. L50:
  120. sflag = one;
  121. sh11 = sp1 / sp2;
  122. sh22 = *sx1 / *sy1;
  123. su = one + sh11 * sh22;
  124. stemp = *sd2 / su;
  125. *sd2 = *sd1 / su;
  126. *sd1 = stemp;
  127. *sx1 = *sy1 * su;
  128. /* GO SCALE-CHECK */
  129. goto L100;
  130. /* PROCEDURE..ZERO-H-D-AND-SX1.. */
  131. L60:
  132. sflag = -one;
  133. sh11 = zero;
  134. sh12 = zero;
  135. sh21 = zero;
  136. sh22 = zero;
  137. *sd1 = zero;
  138. *sd2 = zero;
  139. *sx1 = zero;
  140. /* RETURN.. */
  141. goto L220;
  142. /* PROCEDURE..FIX-H.. */
  143. L70:
  144. if (! (sflag >= zero)) {
  145. goto L90;
  146. }
  147. if (! (sflag == zero)) {
  148. goto L80;
  149. }
  150. sh11 = one;
  151. sh22 = one;
  152. sflag = -one;
  153. goto L90;
  154. L80:
  155. sh21 = -one;
  156. sh12 = one;
  157. sflag = -one;
  158. L90:
  159. switch (igo) {
  160. case 0: goto L120;
  161. case 1: goto L150;
  162. case 2: goto L180;
  163. case 3: goto L210;
  164. }
  165. /* PROCEDURE..SCALE-CHECK */
  166. L100:
  167. L110:
  168. if (! (*sd1 <= rgamsq)) {
  169. goto L130;
  170. }
  171. if (*sd1 == zero) {
  172. goto L160;
  173. }
  174. igo = 0;
  175. igo_fmt = fmt_120;
  176. /* FIX-H.. */
  177. goto L70;
  178. L120:
  179. /* Computing 2nd power */
  180. r__1 = gam;
  181. *sd1 *= r__1 * r__1;
  182. *sx1 /= gam;
  183. sh11 /= gam;
  184. sh12 /= gam;
  185. goto L110;
  186. L130:
  187. L140:
  188. if (! (*sd1 >= gamsq)) {
  189. goto L160;
  190. }
  191. igo = 1;
  192. igo_fmt = fmt_150;
  193. /* FIX-H.. */
  194. goto L70;
  195. L150:
  196. /* Computing 2nd power */
  197. r__1 = gam;
  198. *sd1 /= r__1 * r__1;
  199. *sx1 *= gam;
  200. sh11 *= gam;
  201. sh12 *= gam;
  202. goto L140;
  203. L160:
  204. L170:
  205. if (! (dabs(*sd2) <= rgamsq)) {
  206. goto L190;
  207. }
  208. if (*sd2 == zero) {
  209. goto L220;
  210. }
  211. igo = 2;
  212. igo_fmt = fmt_180;
  213. /* FIX-H.. */
  214. goto L70;
  215. L180:
  216. /* Computing 2nd power */
  217. r__1 = gam;
  218. *sd2 *= r__1 * r__1;
  219. sh21 /= gam;
  220. sh22 /= gam;
  221. goto L170;
  222. L190:
  223. L200:
  224. if (! (dabs(*sd2) >= gamsq)) {
  225. goto L220;
  226. }
  227. igo = 3;
  228. igo_fmt = fmt_210;
  229. /* FIX-H.. */
  230. goto L70;
  231. L210:
  232. /* Computing 2nd power */
  233. r__1 = gam;
  234. *sd2 /= r__1 * r__1;
  235. sh21 *= gam;
  236. sh22 *= gam;
  237. goto L200;
  238. L220:
  239. if (sflag < 0.f) {
  240. goto L250;
  241. } else if (sflag == 0) {
  242. goto L230;
  243. } else {
  244. goto L240;
  245. }
  246. L230:
  247. sparam[3] = sh21;
  248. sparam[4] = sh12;
  249. goto L260;
  250. L240:
  251. sparam[2] = sh11;
  252. sparam[5] = sh22;
  253. goto L260;
  254. L250:
  255. sparam[2] = sh11;
  256. sparam[3] = sh21;
  257. sparam[4] = sh12;
  258. sparam[5] = sh22;
  259. L260:
  260. sparam[1] = sflag;
  261. return 0;
  262. } /* srotmg_ */