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.

dlaed9.f 7.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. *> \brief \b DLAED9 used by DSTEDC. Finds the roots of the secular equation and updates the eigenvectors. Used when the original matrix is dense.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download DLAED9 + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlaed9.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlaed9.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlaed9.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE DLAED9( K, KSTART, KSTOP, N, D, Q, LDQ, RHO, DLAMBDA,
  22. * W, S, LDS, INFO )
  23. *
  24. * .. Scalar Arguments ..
  25. * INTEGER INFO, K, KSTART, KSTOP, LDQ, LDS, N
  26. * DOUBLE PRECISION RHO
  27. * ..
  28. * .. Array Arguments ..
  29. * DOUBLE PRECISION D( * ), DLAMBDA( * ), Q( LDQ, * ), S( LDS, * ),
  30. * $ W( * )
  31. * ..
  32. *
  33. *
  34. *> \par Purpose:
  35. * =============
  36. *>
  37. *> \verbatim
  38. *>
  39. *> DLAED9 finds the roots of the secular equation, as defined by the
  40. *> values in D, Z, and RHO, between KSTART and KSTOP. It makes the
  41. *> appropriate calls to DLAED4 and then stores the new matrix of
  42. *> eigenvectors for use in calculating the next level of Z vectors.
  43. *> \endverbatim
  44. *
  45. * Arguments:
  46. * ==========
  47. *
  48. *> \param[in] K
  49. *> \verbatim
  50. *> K is INTEGER
  51. *> The number of terms in the rational function to be solved by
  52. *> DLAED4. K >= 0.
  53. *> \endverbatim
  54. *>
  55. *> \param[in] KSTART
  56. *> \verbatim
  57. *> KSTART is INTEGER
  58. *> \endverbatim
  59. *>
  60. *> \param[in] KSTOP
  61. *> \verbatim
  62. *> KSTOP is INTEGER
  63. *> The updated eigenvalues Lambda(I), KSTART <= I <= KSTOP
  64. *> are to be computed. 1 <= KSTART <= KSTOP <= K.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] N
  68. *> \verbatim
  69. *> N is INTEGER
  70. *> The number of rows and columns in the Q matrix.
  71. *> N >= K (delation may result in N > K).
  72. *> \endverbatim
  73. *>
  74. *> \param[out] D
  75. *> \verbatim
  76. *> D is DOUBLE PRECISION array, dimension (N)
  77. *> D(I) contains the updated eigenvalues
  78. *> for KSTART <= I <= KSTOP.
  79. *> \endverbatim
  80. *>
  81. *> \param[out] Q
  82. *> \verbatim
  83. *> Q is DOUBLE PRECISION array, dimension (LDQ,N)
  84. *> \endverbatim
  85. *>
  86. *> \param[in] LDQ
  87. *> \verbatim
  88. *> LDQ is INTEGER
  89. *> The leading dimension of the array Q. LDQ >= max( 1, N ).
  90. *> \endverbatim
  91. *>
  92. *> \param[in] RHO
  93. *> \verbatim
  94. *> RHO is DOUBLE PRECISION
  95. *> The value of the parameter in the rank one update equation.
  96. *> RHO >= 0 required.
  97. *> \endverbatim
  98. *>
  99. *> \param[in] DLAMBDA
  100. *> \verbatim
  101. *> DLAMBDA is DOUBLE PRECISION array, dimension (K)
  102. *> The first K elements of this array contain the old roots
  103. *> of the deflated updating problem. These are the poles
  104. *> of the secular equation.
  105. *> \endverbatim
  106. *>
  107. *> \param[in] W
  108. *> \verbatim
  109. *> W is DOUBLE PRECISION array, dimension (K)
  110. *> The first K elements of this array contain the components
  111. *> of the deflation-adjusted updating vector.
  112. *> \endverbatim
  113. *>
  114. *> \param[out] S
  115. *> \verbatim
  116. *> S is DOUBLE PRECISION array, dimension (LDS, K)
  117. *> Will contain the eigenvectors of the repaired matrix which
  118. *> will be stored for subsequent Z vector calculation and
  119. *> multiplied by the previously accumulated eigenvectors
  120. *> to update the system.
  121. *> \endverbatim
  122. *>
  123. *> \param[in] LDS
  124. *> \verbatim
  125. *> LDS is INTEGER
  126. *> The leading dimension of S. LDS >= max( 1, K ).
  127. *> \endverbatim
  128. *>
  129. *> \param[out] INFO
  130. *> \verbatim
  131. *> INFO is INTEGER
  132. *> = 0: successful exit.
  133. *> < 0: if INFO = -i, the i-th argument had an illegal value.
  134. *> > 0: if INFO = 1, an eigenvalue did not converge
  135. *> \endverbatim
  136. *
  137. * Authors:
  138. * ========
  139. *
  140. *> \author Univ. of Tennessee
  141. *> \author Univ. of California Berkeley
  142. *> \author Univ. of Colorado Denver
  143. *> \author NAG Ltd.
  144. *
  145. *> \ingroup auxOTHERcomputational
  146. *
  147. *> \par Contributors:
  148. * ==================
  149. *>
  150. *> Jeff Rutter, Computer Science Division, University of California
  151. *> at Berkeley, USA
  152. *
  153. * =====================================================================
  154. SUBROUTINE DLAED9( K, KSTART, KSTOP, N, D, Q, LDQ, RHO, DLAMBDA,
  155. $ W, S, LDS, INFO )
  156. *
  157. * -- LAPACK computational routine --
  158. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  159. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  160. *
  161. * .. Scalar Arguments ..
  162. INTEGER INFO, K, KSTART, KSTOP, LDQ, LDS, N
  163. DOUBLE PRECISION RHO
  164. * ..
  165. * .. Array Arguments ..
  166. DOUBLE PRECISION D( * ), DLAMBDA( * ), Q( LDQ, * ), S( LDS, * ),
  167. $ W( * )
  168. * ..
  169. *
  170. * =====================================================================
  171. *
  172. * .. Local Scalars ..
  173. INTEGER I, J
  174. DOUBLE PRECISION TEMP
  175. * ..
  176. * .. External Functions ..
  177. DOUBLE PRECISION DNRM2
  178. EXTERNAL DNRM2
  179. * ..
  180. * .. External Subroutines ..
  181. EXTERNAL DCOPY, DLAED4, XERBLA
  182. * ..
  183. * .. Intrinsic Functions ..
  184. INTRINSIC MAX, SIGN, SQRT
  185. * ..
  186. * .. Executable Statements ..
  187. *
  188. * Test the input parameters.
  189. *
  190. INFO = 0
  191. *
  192. IF( K.LT.0 ) THEN
  193. INFO = -1
  194. ELSE IF( KSTART.LT.1 .OR. KSTART.GT.MAX( 1, K ) ) THEN
  195. INFO = -2
  196. ELSE IF( MAX( 1, KSTOP ).LT.KSTART .OR. KSTOP.GT.MAX( 1, K ) )
  197. $ THEN
  198. INFO = -3
  199. ELSE IF( N.LT.K ) THEN
  200. INFO = -4
  201. ELSE IF( LDQ.LT.MAX( 1, K ) ) THEN
  202. INFO = -7
  203. ELSE IF( LDS.LT.MAX( 1, K ) ) THEN
  204. INFO = -12
  205. END IF
  206. IF( INFO.NE.0 ) THEN
  207. CALL XERBLA( 'DLAED9', -INFO )
  208. RETURN
  209. END IF
  210. *
  211. * Quick return if possible
  212. *
  213. IF( K.EQ.0 )
  214. $ RETURN
  215. *
  216. DO 20 J = KSTART, KSTOP
  217. CALL DLAED4( K, J, DLAMBDA, W, Q( 1, J ), RHO, D( J ), INFO )
  218. *
  219. * If the zero finder fails, the computation is terminated.
  220. *
  221. IF( INFO.NE.0 )
  222. $ GO TO 120
  223. 20 CONTINUE
  224. *
  225. IF( K.EQ.1 .OR. K.EQ.2 ) THEN
  226. DO 40 I = 1, K
  227. DO 30 J = 1, K
  228. S( J, I ) = Q( J, I )
  229. 30 CONTINUE
  230. 40 CONTINUE
  231. GO TO 120
  232. END IF
  233. *
  234. * Compute updated W.
  235. *
  236. CALL DCOPY( K, W, 1, S, 1 )
  237. *
  238. * Initialize W(I) = Q(I,I)
  239. *
  240. CALL DCOPY( K, Q, LDQ+1, W, 1 )
  241. DO 70 J = 1, K
  242. DO 50 I = 1, J - 1
  243. W( I ) = W( I )*( Q( I, J )/( DLAMBDA( I )-DLAMBDA( J ) ) )
  244. 50 CONTINUE
  245. DO 60 I = J + 1, K
  246. W( I ) = W( I )*( Q( I, J )/( DLAMBDA( I )-DLAMBDA( J ) ) )
  247. 60 CONTINUE
  248. 70 CONTINUE
  249. DO 80 I = 1, K
  250. W( I ) = SIGN( SQRT( -W( I ) ), S( I, 1 ) )
  251. 80 CONTINUE
  252. *
  253. * Compute eigenvectors of the modified rank-1 modification.
  254. *
  255. DO 110 J = 1, K
  256. DO 90 I = 1, K
  257. Q( I, J ) = W( I ) / Q( I, J )
  258. 90 CONTINUE
  259. TEMP = DNRM2( K, Q( 1, J ), 1 )
  260. DO 100 I = 1, K
  261. S( I, J ) = Q( I, J ) / TEMP
  262. 100 CONTINUE
  263. 110 CONTINUE
  264. *
  265. 120 CONTINUE
  266. RETURN
  267. *
  268. * End of DLAED9
  269. *
  270. END