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.

claqr1.f 4.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. *> \brief \b CLAQR1 sets a scalar multiple of the first column of the product of 2-by-2 or 3-by-3 matrix H and specified shifts.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download CLAQR1 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/claqr1.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/claqr1.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/claqr1.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE CLAQR1( N, H, LDH, S1, S2, V )
  22. *
  23. * .. Scalar Arguments ..
  24. * COMPLEX S1, S2
  25. * INTEGER LDH, N
  26. * ..
  27. * .. Array Arguments ..
  28. * COMPLEX H( LDH, * ), V( * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *> Given a 2-by-2 or 3-by-3 matrix H, CLAQR1 sets v to a
  38. *> scalar multiple of the first column of the product
  39. *>
  40. *> (*) K = (H - s1*I)*(H - s2*I)
  41. *>
  42. *> scaling to avoid overflows and most underflows.
  43. *>
  44. *> This is useful for starting double implicit shift bulges
  45. *> in the QR algorithm.
  46. *> \endverbatim
  47. *
  48. * Arguments:
  49. * ==========
  50. *
  51. *> \param[in] N
  52. *> \verbatim
  53. *> N is INTEGER
  54. *> Order of the matrix H. N must be either 2 or 3.
  55. *> \endverbatim
  56. *>
  57. *> \param[in] H
  58. *> \verbatim
  59. *> H is COMPLEX array, dimension (LDH,N)
  60. *> The 2-by-2 or 3-by-3 matrix H in (*).
  61. *> \endverbatim
  62. *>
  63. *> \param[in] LDH
  64. *> \verbatim
  65. *> LDH is INTEGER
  66. *> The leading dimension of H as declared in
  67. *> the calling procedure. LDH >= N
  68. *> \endverbatim
  69. *>
  70. *> \param[in] S1
  71. *> \verbatim
  72. *> S1 is COMPLEX
  73. *> \endverbatim
  74. *>
  75. *> \param[in] S2
  76. *> \verbatim
  77. *> S2 is COMPLEX
  78. *>
  79. *> S1 and S2 are the shifts defining K in (*) above.
  80. *> \endverbatim
  81. *>
  82. *> \param[out] V
  83. *> \verbatim
  84. *> V is COMPLEX array, dimension (N)
  85. *> A scalar multiple of the first column of the
  86. *> matrix K in (*).
  87. *> \endverbatim
  88. *
  89. * Authors:
  90. * ========
  91. *
  92. *> \author Univ. of Tennessee
  93. *> \author Univ. of California Berkeley
  94. *> \author Univ. of Colorado Denver
  95. *> \author NAG Ltd.
  96. *
  97. *> \date June 2017
  98. *
  99. *> \ingroup complexOTHERauxiliary
  100. *
  101. *> \par Contributors:
  102. * ==================
  103. *>
  104. *> Karen Braman and Ralph Byers, Department of Mathematics,
  105. *> University of Kansas, USA
  106. *>
  107. * =====================================================================
  108. SUBROUTINE CLAQR1( N, H, LDH, S1, S2, V )
  109. *
  110. * -- LAPACK auxiliary routine (version 3.7.1) --
  111. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  112. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  113. * June 2017
  114. *
  115. * .. Scalar Arguments ..
  116. COMPLEX S1, S2
  117. INTEGER LDH, N
  118. * ..
  119. * .. Array Arguments ..
  120. COMPLEX H( LDH, * ), V( * )
  121. * ..
  122. *
  123. * ================================================================
  124. *
  125. * .. Parameters ..
  126. COMPLEX ZERO
  127. PARAMETER ( ZERO = ( 0.0e0, 0.0e0 ) )
  128. REAL RZERO
  129. PARAMETER ( RZERO = 0.0e0 )
  130. * ..
  131. * .. Local Scalars ..
  132. COMPLEX CDUM, H21S, H31S
  133. REAL S
  134. * ..
  135. * .. Intrinsic Functions ..
  136. INTRINSIC ABS, AIMAG, REAL
  137. * ..
  138. * .. Statement Functions ..
  139. REAL CABS1
  140. * ..
  141. * .. Statement Function definitions ..
  142. CABS1( CDUM ) = ABS( REAL( CDUM ) ) + ABS( AIMAG( CDUM ) )
  143. * ..
  144. * .. Executable Statements ..
  145. *
  146. * Quick return if possible
  147. *
  148. IF( N.NE.2 .AND. N.NE.3 ) THEN
  149. RETURN
  150. END IF
  151. *
  152. IF( N.EQ.2 ) THEN
  153. S = CABS1( H( 1, 1 )-S2 ) + CABS1( H( 2, 1 ) )
  154. IF( S.EQ.RZERO ) THEN
  155. V( 1 ) = ZERO
  156. V( 2 ) = ZERO
  157. ELSE
  158. H21S = H( 2, 1 ) / S
  159. V( 1 ) = H21S*H( 1, 2 ) + ( H( 1, 1 )-S1 )*
  160. $ ( ( H( 1, 1 )-S2 ) / S )
  161. V( 2 ) = H21S*( H( 1, 1 )+H( 2, 2 )-S1-S2 )
  162. END IF
  163. ELSE
  164. S = CABS1( H( 1, 1 )-S2 ) + CABS1( H( 2, 1 ) ) +
  165. $ CABS1( H( 3, 1 ) )
  166. IF( S.EQ.ZERO ) THEN
  167. V( 1 ) = ZERO
  168. V( 2 ) = ZERO
  169. V( 3 ) = ZERO
  170. ELSE
  171. H21S = H( 2, 1 ) / S
  172. H31S = H( 3, 1 ) / S
  173. V( 1 ) = ( H( 1, 1 )-S1 )*( ( H( 1, 1 )-S2 ) / S ) +
  174. $ H( 1, 2 )*H21S + H( 1, 3 )*H31S
  175. V( 2 ) = H21S*( H( 1, 1 )+H( 2, 2 )-S1-S2 ) + H( 2, 3 )*H31S
  176. V( 3 ) = H31S*( H( 1, 1 )+H( 3, 3 )-S1-S2 ) + H21S*H( 3, 2 )
  177. END IF
  178. END IF
  179. END