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.

slarrc.f 6.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. *> \brief \b SLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download SLARRC + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarrc.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarrc.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarrc.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE SLARRC( JOBT, N, VL, VU, D, E, PIVMIN,
  22. * EIGCNT, LCNT, RCNT, INFO )
  23. *
  24. * .. Scalar Arguments ..
  25. * CHARACTER JOBT
  26. * INTEGER EIGCNT, INFO, LCNT, N, RCNT
  27. * REAL PIVMIN, VL, VU
  28. * ..
  29. * .. Array Arguments ..
  30. * REAL D( * ), E( * )
  31. * ..
  32. *
  33. *
  34. *> \par Purpose:
  35. * =============
  36. *>
  37. *> \verbatim
  38. *>
  39. *> Find the number of eigenvalues of the symmetric tridiagonal matrix T
  40. *> that are in the interval (VL,VU] if JOBT = 'T', and of L D L^T
  41. *> if JOBT = 'L'.
  42. *> \endverbatim
  43. *
  44. * Arguments:
  45. * ==========
  46. *
  47. *> \param[in] JOBT
  48. *> \verbatim
  49. *> JOBT is CHARACTER*1
  50. *> = 'T': Compute Sturm count for matrix T.
  51. *> = 'L': Compute Sturm count for matrix L D L^T.
  52. *> \endverbatim
  53. *>
  54. *> \param[in] N
  55. *> \verbatim
  56. *> N is INTEGER
  57. *> The order of the matrix. N > 0.
  58. *> \endverbatim
  59. *>
  60. *> \param[in] VL
  61. *> \verbatim
  62. *> VL is REAL
  63. *> The lower bound for the eigenvalues.
  64. *> \endverbatim
  65. *>
  66. *> \param[in] VU
  67. *> \verbatim
  68. *> VU is REAL
  69. *> The upper bound for the eigenvalues.
  70. *> \endverbatim
  71. *>
  72. *> \param[in] D
  73. *> \verbatim
  74. *> D is REAL array, dimension (N)
  75. *> JOBT = 'T': The N diagonal elements of the tridiagonal matrix T.
  76. *> JOBT = 'L': The N diagonal elements of the diagonal matrix D.
  77. *> \endverbatim
  78. *>
  79. *> \param[in] E
  80. *> \verbatim
  81. *> E is REAL array, dimension (N)
  82. *> JOBT = 'T': The N-1 offdiagonal elements of the matrix T.
  83. *> JOBT = 'L': The N-1 offdiagonal elements of the matrix L.
  84. *> \endverbatim
  85. *>
  86. *> \param[in] PIVMIN
  87. *> \verbatim
  88. *> PIVMIN is REAL
  89. *> The minimum pivot in the Sturm sequence for T.
  90. *> \endverbatim
  91. *>
  92. *> \param[out] EIGCNT
  93. *> \verbatim
  94. *> EIGCNT is INTEGER
  95. *> The number of eigenvalues of the symmetric tridiagonal matrix T
  96. *> that are in the interval (VL,VU]
  97. *> \endverbatim
  98. *>
  99. *> \param[out] LCNT
  100. *> \verbatim
  101. *> LCNT is INTEGER
  102. *> \endverbatim
  103. *>
  104. *> \param[out] RCNT
  105. *> \verbatim
  106. *> RCNT is INTEGER
  107. *> The left and right negcounts of the interval.
  108. *> \endverbatim
  109. *>
  110. *> \param[out] INFO
  111. *> \verbatim
  112. *> INFO is INTEGER
  113. *> \endverbatim
  114. *
  115. * Authors:
  116. * ========
  117. *
  118. *> \author Univ. of Tennessee
  119. *> \author Univ. of California Berkeley
  120. *> \author Univ. of Colorado Denver
  121. *> \author NAG Ltd.
  122. *
  123. *> \ingroup OTHERauxiliary
  124. *
  125. *> \par Contributors:
  126. * ==================
  127. *>
  128. *> Beresford Parlett, University of California, Berkeley, USA \n
  129. *> Jim Demmel, University of California, Berkeley, USA \n
  130. *> Inderjit Dhillon, University of Texas, Austin, USA \n
  131. *> Osni Marques, LBNL/NERSC, USA \n
  132. *> Christof Voemel, University of California, Berkeley, USA
  133. *
  134. * =====================================================================
  135. SUBROUTINE SLARRC( JOBT, N, VL, VU, D, E, PIVMIN,
  136. $ EIGCNT, LCNT, RCNT, INFO )
  137. *
  138. * -- LAPACK auxiliary routine --
  139. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  140. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  141. *
  142. * .. Scalar Arguments ..
  143. CHARACTER JOBT
  144. INTEGER EIGCNT, INFO, LCNT, N, RCNT
  145. REAL PIVMIN, VL, VU
  146. * ..
  147. * .. Array Arguments ..
  148. REAL D( * ), E( * )
  149. * ..
  150. *
  151. * =====================================================================
  152. *
  153. * .. Parameters ..
  154. REAL ZERO
  155. PARAMETER ( ZERO = 0.0E0 )
  156. * ..
  157. * .. Local Scalars ..
  158. INTEGER I
  159. LOGICAL MATT
  160. REAL LPIVOT, RPIVOT, SL, SU, TMP, TMP2
  161. * ..
  162. * .. External Functions ..
  163. LOGICAL LSAME
  164. EXTERNAL LSAME
  165. * ..
  166. * .. Executable Statements ..
  167. *
  168. INFO = 0
  169. *
  170. * Quick return if possible
  171. *
  172. IF( N.LE.0 ) THEN
  173. RETURN
  174. END IF
  175. *
  176. LCNT = 0
  177. RCNT = 0
  178. EIGCNT = 0
  179. MATT = LSAME( JOBT, 'T' )
  180. IF (MATT) THEN
  181. * Sturm sequence count on T
  182. LPIVOT = D( 1 ) - VL
  183. RPIVOT = D( 1 ) - VU
  184. IF( LPIVOT.LE.ZERO ) THEN
  185. LCNT = LCNT + 1
  186. ENDIF
  187. IF( RPIVOT.LE.ZERO ) THEN
  188. RCNT = RCNT + 1
  189. ENDIF
  190. DO 10 I = 1, N-1
  191. TMP = E(I)**2
  192. LPIVOT = ( D( I+1 )-VL ) - TMP/LPIVOT
  193. RPIVOT = ( D( I+1 )-VU ) - TMP/RPIVOT
  194. IF( LPIVOT.LE.ZERO ) THEN
  195. LCNT = LCNT + 1
  196. ENDIF
  197. IF( RPIVOT.LE.ZERO ) THEN
  198. RCNT = RCNT + 1
  199. ENDIF
  200. 10 CONTINUE
  201. ELSE
  202. * Sturm sequence count on L D L^T
  203. SL = -VL
  204. SU = -VU
  205. DO 20 I = 1, N - 1
  206. LPIVOT = D( I ) + SL
  207. RPIVOT = D( I ) + SU
  208. IF( LPIVOT.LE.ZERO ) THEN
  209. LCNT = LCNT + 1
  210. ENDIF
  211. IF( RPIVOT.LE.ZERO ) THEN
  212. RCNT = RCNT + 1
  213. ENDIF
  214. TMP = E(I) * D(I) * E(I)
  215. *
  216. TMP2 = TMP / LPIVOT
  217. IF( TMP2.EQ.ZERO ) THEN
  218. SL = TMP - VL
  219. ELSE
  220. SL = SL*TMP2 - VL
  221. END IF
  222. *
  223. TMP2 = TMP / RPIVOT
  224. IF( TMP2.EQ.ZERO ) THEN
  225. SU = TMP - VU
  226. ELSE
  227. SU = SU*TMP2 - VU
  228. END IF
  229. 20 CONTINUE
  230. LPIVOT = D( N ) + SL
  231. RPIVOT = D( N ) + SU
  232. IF( LPIVOT.LE.ZERO ) THEN
  233. LCNT = LCNT + 1
  234. ENDIF
  235. IF( RPIVOT.LE.ZERO ) THEN
  236. RCNT = RCNT + 1
  237. ENDIF
  238. ENDIF
  239. EIGCNT = RCNT - LCNT
  240. RETURN
  241. *
  242. * End of SLARRC
  243. *
  244. END