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.

208 lines
4.7 KiB

  1. SUBROUTINE SROTMG(SD1,SD2,SX1,SY1,SPARAM)
  2. * .. Scalar Arguments ..
  3. REAL SD1,SD2,SX1,SY1
  4. * ..
  5. * .. Array Arguments ..
  6. REAL SPARAM(5)
  7. * ..
  8. *
  9. * Purpose
  10. * =======
  11. *
  12. * CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS
  13. * THE SECOND COMPONENT OF THE 2-VECTOR (SQRT(SD1)*SX1,SQRT(SD2)*
  14. * SY2)**T.
  15. * WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS..
  16. *
  17. * SFLAG=-1.E0 SFLAG=0.E0 SFLAG=1.E0 SFLAG=-2.E0
  18. *
  19. * (SH11 SH12) (1.E0 SH12) (SH11 1.E0) (1.E0 0.E0)
  20. * H=( ) ( ) ( ) ( )
  21. * (SH21 SH22), (SH21 1.E0), (-1.E0 SH22), (0.E0 1.E0).
  22. * LOCATIONS 2-4 OF SPARAM CONTAIN SH11,SH21,SH12, AND SH22
  23. * RESPECTIVELY. (VALUES OF 1.E0, -1.E0, OR 0.E0 IMPLIED BY THE
  24. * VALUE OF SPARAM(1) ARE NOT STORED IN SPARAM.)
  25. *
  26. * THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE
  27. * INEXACT. THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE
  28. * OF SD1 AND SD2. ALL ACTUAL SCALING OF DATA IS DONE USING GAM.
  29. *
  30. *
  31. * Arguments
  32. * =========
  33. *
  34. *
  35. * SD1 (input/output) REAL
  36. *
  37. * SD2 (input/output) REAL
  38. *
  39. * SX1 (input/output) REAL
  40. *
  41. * SY1 (input) REAL
  42. *
  43. *
  44. * SPARAM (input/output) REAL array, dimension 5
  45. * SPARAM(1)=SFLAG
  46. * SPARAM(2)=SH11
  47. * SPARAM(3)=SH21
  48. * SPARAM(4)=SH12
  49. * SPARAM(5)=SH22
  50. *
  51. * =====================================================================
  52. *
  53. * .. Local Scalars ..
  54. REAL GAM,GAMSQ,ONE,RGAMSQ,SFLAG,SH11,SH12,SH21,SH22,SP1,SP2,SQ1,
  55. + SQ2,STEMP,SU,TWO,ZERO
  56. INTEGER IGO
  57. * ..
  58. * .. Intrinsic Functions ..
  59. INTRINSIC ABS
  60. * ..
  61. * .. Data statements ..
  62. *
  63. DATA ZERO,ONE,TWO/0.E0,1.E0,2.E0/
  64. DATA GAM,GAMSQ,RGAMSQ/4096.E0,1.67772E7,5.96046E-8/
  65. * ..
  66. IF (.NOT.SD1.LT.ZERO) GO TO 10
  67. * GO ZERO-H-D-AND-SX1..
  68. GO TO 60
  69. 10 CONTINUE
  70. * CASE-SD1-NONNEGATIVE
  71. SP2 = SD2*SY1
  72. IF (.NOT.SP2.EQ.ZERO) GO TO 20
  73. SFLAG = -TWO
  74. GO TO 260
  75. * REGULAR-CASE..
  76. 20 CONTINUE
  77. SP1 = SD1*SX1
  78. SQ2 = SP2*SY1
  79. SQ1 = SP1*SX1
  80. *
  81. IF (.NOT.ABS(SQ1).GT.ABS(SQ2)) GO TO 40
  82. SH21 = -SY1/SX1
  83. SH12 = SP2/SP1
  84. *
  85. SU = ONE - SH12*SH21
  86. *
  87. IF (.NOT.SU.LE.ZERO) GO TO 30
  88. * GO ZERO-H-D-AND-SX1..
  89. GO TO 60
  90. 30 CONTINUE
  91. SFLAG = ZERO
  92. SD1 = SD1/SU
  93. SD2 = SD2/SU
  94. SX1 = SX1*SU
  95. * GO SCALE-CHECK..
  96. GO TO 100
  97. 40 CONTINUE
  98. IF (.NOT.SQ2.LT.ZERO) GO TO 50
  99. * GO ZERO-H-D-AND-SX1..
  100. GO TO 60
  101. 50 CONTINUE
  102. SFLAG = ONE
  103. SH11 = SP1/SP2
  104. SH22 = SX1/SY1
  105. SU = ONE + SH11*SH22
  106. STEMP = SD2/SU
  107. SD2 = SD1/SU
  108. SD1 = STEMP
  109. SX1 = SY1*SU
  110. * GO SCALE-CHECK
  111. GO TO 100
  112. * PROCEDURE..ZERO-H-D-AND-SX1..
  113. 60 CONTINUE
  114. SFLAG = -ONE
  115. SH11 = ZERO
  116. SH12 = ZERO
  117. SH21 = ZERO
  118. SH22 = ZERO
  119. *
  120. SD1 = ZERO
  121. SD2 = ZERO
  122. SX1 = ZERO
  123. * RETURN..
  124. GO TO 220
  125. * PROCEDURE..FIX-H..
  126. 70 CONTINUE
  127. IF (.NOT.SFLAG.GE.ZERO) GO TO 90
  128. *
  129. IF (.NOT.SFLAG.EQ.ZERO) GO TO 80
  130. SH11 = ONE
  131. SH22 = ONE
  132. SFLAG = -ONE
  133. GO TO 90
  134. 80 CONTINUE
  135. SH21 = -ONE
  136. SH12 = ONE
  137. SFLAG = -ONE
  138. 90 CONTINUE
  139. GO TO IGO(120,150,180,210)
  140. * PROCEDURE..SCALE-CHECK
  141. 100 CONTINUE
  142. 110 CONTINUE
  143. IF (.NOT.SD1.LE.RGAMSQ) GO TO 130
  144. IF (SD1.EQ.ZERO) GO TO 160
  145. ASSIGN 120 TO IGO
  146. * FIX-H..
  147. GO TO 70
  148. 120 CONTINUE
  149. SD1 = SD1*GAM**2
  150. SX1 = SX1/GAM
  151. SH11 = SH11/GAM
  152. SH12 = SH12/GAM
  153. GO TO 110
  154. 130 CONTINUE
  155. 140 CONTINUE
  156. IF (.NOT.SD1.GE.GAMSQ) GO TO 160
  157. ASSIGN 150 TO IGO
  158. * FIX-H..
  159. GO TO 70
  160. 150 CONTINUE
  161. SD1 = SD1/GAM**2
  162. SX1 = SX1*GAM
  163. SH11 = SH11*GAM
  164. SH12 = SH12*GAM
  165. GO TO 140
  166. 160 CONTINUE
  167. 170 CONTINUE
  168. IF (.NOT.ABS(SD2).LE.RGAMSQ) GO TO 190
  169. IF (SD2.EQ.ZERO) GO TO 220
  170. ASSIGN 180 TO IGO
  171. * FIX-H..
  172. GO TO 70
  173. 180 CONTINUE
  174. SD2 = SD2*GAM**2
  175. SH21 = SH21/GAM
  176. SH22 = SH22/GAM
  177. GO TO 170
  178. 190 CONTINUE
  179. 200 CONTINUE
  180. IF (.NOT.ABS(SD2).GE.GAMSQ) GO TO 220
  181. ASSIGN 210 TO IGO
  182. * FIX-H..
  183. GO TO 70
  184. 210 CONTINUE
  185. SD2 = SD2/GAM**2
  186. SH21 = SH21*GAM
  187. SH22 = SH22*GAM
  188. GO TO 200
  189. 220 CONTINUE
  190. IF (SFLAG) 250,230,240
  191. 230 CONTINUE
  192. SPARAM(3) = SH21
  193. SPARAM(4) = SH12
  194. GO TO 260
  195. 240 CONTINUE
  196. SPARAM(2) = SH11
  197. SPARAM(5) = SH22
  198. GO TO 260
  199. 250 CONTINUE
  200. SPARAM(2) = SH11
  201. SPARAM(3) = SH21
  202. SPARAM(4) = SH12
  203. SPARAM(5) = SH22
  204. 260 CONTINUE
  205. SPARAM(1) = SFLAG
  206. RETURN
  207. END