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 1.9 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. * Authors:
  27. * ========
  28. *
  29. *> \author Univ. of Tennessee
  30. *> \author Univ. of California Berkeley
  31. *> \author Univ. of Colorado Denver
  32. *> \author NAG Ltd.
  33. *
  34. *> \date December 2016
  35. *
  36. *> \ingroup single_blas_level1
  37. *
  38. *> \par Further Details:
  39. * =====================
  40. *>
  41. *> \verbatim
  42. *>
  43. *> jack dongarra, linpack, 3/11/78.
  44. *> \endverbatim
  45. *>
  46. * =====================================================================
  47. SUBROUTINE SROTG(SA,SB,C,S)
  48. *
  49. * -- Reference BLAS level1 routine (version 3.7.0) --
  50. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  51. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  52. * December 2016
  53. *
  54. * .. Scalar Arguments ..
  55. REAL C,S,SA,SB
  56. * ..
  57. *
  58. * =====================================================================
  59. *
  60. * .. Local Scalars ..
  61. REAL R,ROE,SCALE,Z
  62. * ..
  63. * .. Intrinsic Functions ..
  64. INTRINSIC ABS,SIGN,SQRT
  65. * ..
  66. ROE = SB
  67. IF (ABS(SA).GT.ABS(SB)) ROE = SA
  68. SCALE = ABS(SA) + ABS(SB)
  69. IF (SCALE.EQ.0.0) THEN
  70. C = 1.0
  71. S = 0.0
  72. R = 0.0
  73. Z = 0.0
  74. ELSE
  75. R = SCALE*SQRT((SA/SCALE)**2+ (SB/SCALE)**2)
  76. R = SIGN(1.0,ROE)*R
  77. C = SA/R
  78. S = SB/R
  79. Z = 1.0
  80. IF (ABS(SA).GT.ABS(SB)) Z = S
  81. IF (ABS(SB).GE.ABS(SA) .AND. C.NE.0.0) Z = 1.0/C
  82. END IF
  83. SA = R
  84. SB = Z
  85. RETURN
  86. END