Télécharger dlae2.eso

Retour à la liste

Numérotation des lignes :

  1. C DLAE2 SOURCE BP208322 15/10/13 21:15:26 8670
  2. *> \brief \b DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix.
  3. *
  4. * =========== DOCUMENTATION ===========
  5. *
  6. * Online html documentation available at
  7. * http://www.netlib.org/lapack/explore-html/
  8. *
  9. *> \htmlonly
  10. *> Download DLAE2 + dependencies
  11. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlae2.f">
  12. *> [TGZ]</a>
  13. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlae2.f">
  14. *> [ZIP]</a>
  15. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlae2.f">
  16. *> [TXT]</a>
  17. *> \endhtmlonly
  18. *
  19. * Definition:
  20. * ===========
  21. *
  22. * SUBROUTINE DLAE2( A, B, C, RT1, RT2 )
  23. *
  24. * .. Scalar Arguments ..
  25. * REAL*8 A, B, C, RT1, RT2
  26. * ..
  27. *
  28. *
  29. *> \par Purpose:
  30. * =============
  31. *>
  32. *> \verbatim
  33. *>
  34. *> DLAE2 computes the eigenvalues of a 2-by-2 symmetric matrix
  35. *> [ A B ]
  36. *> [ B C ].
  37. *> On return, RT1 is the eigenvalue of larger absolute value, and RT2
  38. *> is the eigenvalue of smaller absolute value.
  39. *> \endverbatim
  40. *
  41. * Arguments:
  42. * ==========
  43. *
  44. *> \param[in] A
  45. *> \verbatim
  46. *> A is DOUBLE PRECISION
  47. *> The (1,1) element of the 2-by-2 matrix.
  48. *> \endverbatim
  49. *>
  50. *> \param[in] B
  51. *> \verbatim
  52. *> B is DOUBLE PRECISION
  53. *> The (1,2) and (2,1) elements of the 2-by-2 matrix.
  54. *> \endverbatim
  55. *>
  56. *> \param[in] C
  57. *> \verbatim
  58. *> C is DOUBLE PRECISION
  59. *> The (2,2) element of the 2-by-2 matrix.
  60. *> \endverbatim
  61. *>
  62. *> \param[out] RT1
  63. *> \verbatim
  64. *> RT1 is DOUBLE PRECISION
  65. *> The eigenvalue of larger absolute value.
  66. *> \endverbatim
  67. *>
  68. *> \param[out] RT2
  69. *> \verbatim
  70. *> RT2 is DOUBLE PRECISION
  71. *> The eigenvalue of smaller absolute value.
  72. *> \endverbatim
  73. *
  74. * Authors:
  75. * ========
  76. *
  77. *> \author Univ. of Tennessee
  78. *> \author Univ. of California Berkeley
  79. *> \author Univ. of Colorado Denver
  80. *> \author NAG Ltd.
  81. *
  82. *> \date September 2012
  83. *
  84. *> \ingroup auxOTHERauxiliary
  85. *
  86. *> \par Further Details:
  87. * =====================
  88. *>
  89. *> \verbatim
  90. *>
  91. *> RT1 is accurate to a few ulps barring over/underflow.
  92. *>
  93. *> RT2 may be inaccurate if there is massive cancellation in the
  94. *> determinant A*C-B*B; higher precision or correctly rounded or
  95. *> correctly truncated arithmetic would be needed to compute RT2
  96. *> accurately in all cases.
  97. *>
  98. *> Overflow is possible only if RT1 is within a factor of 5 of overflow.
  99. *> Underflow is harmless if the input data is 0 or exceeds
  100. *> underflow_threshold / macheps.
  101. *> \endverbatim
  102. *>
  103. * =====================================================================
  104. SUBROUTINE DLAE2( A, B, C, RT1, RT2 )
  105. *
  106. * -- LAPACK auxiliary routine (version 3.4.2) --
  107. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  108. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  109. * September 2012
  110. *
  111. * .. Scalar Arguments ..
  112. REAL*8 A, B, C, RT1, RT2
  113. * ..
  114. *
  115. * =====================================================================
  116. *
  117. * .. Parameters ..
  118. REAL*8 ONE
  119. PARAMETER ( ONE = 1.0D0 )
  120. REAL*8 TWO
  121. PARAMETER ( TWO = 2.0D0 )
  122. REAL*8 ZERO
  123. PARAMETER ( ZERO = 0.0D0 )
  124. REAL*8 HALF
  125. PARAMETER ( HALF = 0.5D0 )
  126. * ..
  127. * .. Local Scalars ..
  128. REAL*8 AB, ACMN, ACMX, ADF, DF, RT, SM, TB
  129. * ..
  130. ** .. Intrinsic Functions ..
  131. * INTRINSIC ABS, SQRT
  132. ** ..
  133. ** .. Executable Statements ..
  134. *
  135. * Compute the eigenvalues
  136. *
  137. SM = A + C
  138. DF = A - C
  139. ADF = ABS( DF )
  140. TB = B + B
  141. AB = ABS( TB )
  142. IF( ABS( A ).GT.ABS( C ) ) THEN
  143. ACMX = A
  144. ACMN = C
  145. ELSE
  146. ACMX = C
  147. ACMN = A
  148. END IF
  149. IF( ADF.GT.AB ) THEN
  150. RT = ADF*SQRT( ONE+( AB / ADF )**2 )
  151. ELSE IF( ADF.LT.AB ) THEN
  152. RT = AB*SQRT( ONE+( ADF / AB )**2 )
  153. ELSE
  154. *
  155. * Includes case AB=ADF=0
  156. *
  157. RT = AB*SQRT( TWO )
  158. END IF
  159. IF( SM.LT.ZERO ) THEN
  160. RT1 = HALF*( SM-RT )
  161. *
  162. * Order of execution important.
  163. * To get fully accurate smaller eigenvalue,
  164. * next line needs to be executed in higher precision.
  165. *
  166. RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
  167. ELSE IF( SM.GT.ZERO ) THEN
  168. RT1 = HALF*( SM+RT )
  169. *
  170. * Order of execution important.
  171. * To get fully accurate smaller eigenvalue,
  172. * next line needs to be executed in higher precision.
  173. *
  174. RT2 = ( ACMX / RT1 )*ACMN - ( B / RT1 )*B
  175. ELSE
  176. *
  177. * Includes case RT1 = RT2 = 0
  178. *
  179. RT1 = HALF*RT
  180. RT2 = -HALF*RT
  181. END IF
  182. RETURN
  183. *
  184. * End of DLAE2
  185. *
  186. END
  187.  
  188.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales