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

srotg.f 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. *> \brief \b SROTG
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. * Definition:
  9. * ===========
  10. *
  11. * SUBROUTINE SROTG(SA,SB,C,S)
  12. *
  13. * .. Scalar Arguments ..
  14. * REAL C,S,SA,SB
  15. * ..
  16. *
  17. *
  18. *> \par Purpose:
  19. * =============
  20. *>
  21. *> \verbatim
  22. *>
  23. *> SROTG construct givens plane rotation.
  24. *> \endverbatim
  25. *
  26. * Arguments:
  27. * ==========
  28. *
  29. *> \param[in] SA
  30. *> \verbatim
  31. *> SA is REAL
  32. *> \endverbatim
  33. *>
  34. *> \param[in] SB
  35. *> \verbatim
  36. *> SB is REAL
  37. *> \endverbatim
  38. *>
  39. *> \param[out] C
  40. *> \verbatim
  41. *> C is REAL
  42. *> \endverbatim
  43. *>
  44. *> \param[out] S
  45. *> \verbatim
  46. *> S is REAL
  47. *> \endverbatim
  48. *
  49. * Authors:
  50. * ========
  51. *
  52. *> \author Univ. of Tennessee
  53. *> \author Univ. of California Berkeley
  54. *> \author Univ. of Colorado Denver
  55. *> \author NAG Ltd.
  56. *
  57. *> \date November 2017
  58. *
  59. *> \ingroup single_blas_level1
  60. *
  61. *> \par Further Details:
  62. * =====================
  63. *>
  64. *> \verbatim
  65. *>
  66. *> jack dongarra, linpack, 3/11/78.
  67. *> \endverbatim
  68. *>
  69. * =====================================================================
  70. SUBROUTINE SROTG(SA,SB,C,S)
  71. *
  72. * -- Reference BLAS level1 routine (version 3.8.0) --
  73. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  74. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  75. * November 2017
  76. *
  77. * .. Scalar Arguments ..
  78. REAL C,S,SA,SB
  79. * ..
  80. *
  81. * =====================================================================
  82. *
  83. * .. Local Scalars ..
  84. REAL R,ROE,SCALE,Z
  85. * ..
  86. * .. Intrinsic Functions ..
  87. INTRINSIC ABS,SIGN,SQRT
  88. * ..
  89. ROE = SB
  90. IF (ABS(SA).GT.ABS(SB)) ROE = SA
  91. SCALE = ABS(SA) + ABS(SB)
  92. IF (SCALE.EQ.0.0) THEN
  93. C = 1.0
  94. S = 0.0
  95. R = 0.0
  96. Z = 0.0
  97. ELSE
  98. R = SCALE*SQRT((SA/SCALE)**2+ (SB/SCALE)**2)
  99. R = SIGN(1.0,ROE)*R
  100. C = SA/R
  101. S = SB/R
  102. Z = 1.0
  103. IF (ABS(SA).GT.ABS(SB)) Z = S
  104. IF (ABS(SB).GE.ABS(SA) .AND. C.NE.0.0) Z = 1.0/C
  105. END IF
  106. SA = R
  107. SB = Z
  108. RETURN
  109. END