Télécharger dlatrd.eso

Retour à la liste

Numérotation des lignes :

dlatrd
  1. C DLATRD SOURCE BP208322 22/09/16 21:15:04 11454
  2. *> \brief \b DLATRD reduces the first nb rows and columns of a symmetric/Hermitian matrix A to real tridiagonal form by an orthogonal similarity transformation.
  3. *
  4. * =========== DOCUMENTATION ===========
  5. *
  6. * Online html documentation available at
  7. * http://www.netlib.org/lapack/explore-html/
  8. *
  9. *> \htmlonly
  10. *> Download DLATRD + dependencies
  11. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlatrd.f">
  12. *> [TGZ]</a>
  13. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlatrd.f">
  14. *> [ZIP]</a>
  15. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlatrd.f">
  16. *> [TXT]</a>
  17. *> \endhtmlonly
  18. *
  19. * Definition:
  20. * ===========
  21. *
  22. * SUBROUTINE DLATRD( UPLO, N, NB, A, LDA, E, TAU, W, LDW )
  23. *
  24. * .. Scalar Arguments ..
  25. * CHARACTER UPLO
  26. * INTEGER LDA, LDW, N, NB
  27. * ..
  28. * .. Array Arguments ..
  29. * REAL*8 A( LDA, * ), E( * ), TAU( * ), W( LDW, * )
  30. * ..
  31. *
  32. *
  33. *> \par Purpose:
  34. * =============
  35. *>
  36. *> \verbatim
  37. *>
  38. *> DLATRD reduces NB rows and columns of a real symmetric matrix A to
  39. *> symmetric tridiagonal form by an orthogonal similarity
  40. *> transformation Q**T * A * Q, and returns the matrices V and W which are
  41. *> needed to apply the transformation to the unreduced part of A.
  42. *>
  43. *> If UPLO = 'U', DLATRD reduces the last NB rows and columns of a
  44. *> matrix, of which the upper triangle is supplied;
  45. *> if UPLO = 'L', DLATRD reduces the first NB rows and columns of a
  46. *> matrix, of which the lower triangle is supplied.
  47. *>
  48. *> This is an auxiliary routine called by DSYTRD.
  49. *> \endverbatim
  50. *
  51. * Arguments:
  52. * ==========
  53. *
  54. *> \param[in] UPLO
  55. *> \verbatim
  56. *> UPLO is CHARACTER*1
  57. *> Specifies whether the upper or lower triangular part of the
  58. *> symmetric matrix A is stored:
  59. *> = 'U': Upper triangular
  60. *> = 'L': Lower triangular
  61. *> \endverbatim
  62. *>
  63. *> \param[in] N
  64. *> \verbatim
  65. *> N is INTEGER
  66. *> The order of the matrix A.
  67. *> \endverbatim
  68. *>
  69. *> \param[in] NB
  70. *> \verbatim
  71. *> NB is INTEGER
  72. *> The number of rows and columns to be reduced.
  73. *> \endverbatim
  74. *>
  75. *> \param[in,out] A
  76. *> \verbatim
  77. *> A is REAL*8 array, dimension (LDA,N)
  78. *> On entry, the symmetric matrix A. If UPLO = 'U', the leading
  79. *> n-by-n upper triangular part of A contains the upper
  80. *> triangular part of the matrix A, and the strictly lower
  81. *> triangular part of A is not referenced. If UPLO = 'L', the
  82. *> leading n-by-n lower triangular part of A contains the lower
  83. *> triangular part of the matrix A, and the strictly upper
  84. *> triangular part of A is not referenced.
  85. *> On exit:
  86. *> if UPLO = 'U', the last NB columns have been reduced to
  87. *> tridiagonal form, with the diagonal elements overwriting
  88. *> the diagonal elements of A; the elements above the diagonal
  89. *> with the array TAU, represent the orthogonal matrix Q as a
  90. *> product of elementary reflectors;
  91. *> if UPLO = 'L', the first NB columns have been reduced to
  92. *> tridiagonal form, with the diagonal elements overwriting
  93. *> the diagonal elements of A; the elements below the diagonal
  94. *> with the array TAU, represent the orthogonal matrix Q as a
  95. *> product of elementary reflectors.
  96. *> See Further Details.
  97. *> \endverbatim
  98. *>
  99. *> \param[in] LDA
  100. *> \verbatim
  101. *> LDA is INTEGER
  102. *> The leading dimension of the array A. LDA >= (1,N).
  103. *> \endverbatim
  104. *>
  105. *> \param[out] E
  106. *> \verbatim
  107. *> E is REAL*8 array, dimension (N-1)
  108. *> If UPLO = 'U', E(n-nb:n-1) contains the superdiagonal
  109. *> elements of the last NB columns of the reduced matrix;
  110. *> if UPLO = 'L', E(1:nb) contains the subdiagonal elements of
  111. *> the first NB columns of the reduced matrix.
  112. *> \endverbatim
  113. *>
  114. *> \param[out] TAU
  115. *> \verbatim
  116. *> TAU is REAL*8 array, dimension (N-1)
  117. *> The scalar factors of the elementary reflectors, stored in
  118. *> TAU(n-nb:n-1) if UPLO = 'U', and in TAU(1:nb) if UPLO = 'L'.
  119. *> See Further Details.
  120. *> \endverbatim
  121. *>
  122. *> \param[out] W
  123. *> \verbatim
  124. *> W is REAL*8 array, dimension (LDW,NB)
  125. *> The n-by-nb matrix W required to update the unreduced part
  126. *> of A.
  127. *> \endverbatim
  128. *>
  129. *> \param[in] LDW
  130. *> \verbatim
  131. *> LDW is INTEGER
  132. *> The leading dimension of the array W. LDW >= max(1,N).
  133. *> \endverbatim
  134. *
  135. * Authors:
  136. * ========
  137. *
  138. *> \author Univ. of Tennessee
  139. *> \author Univ. of California Berkeley
  140. *> \author Univ. of Colorado Denver
  141. *> \author NAG Ltd.
  142. *
  143. *> \ingroup doubleOTHERauxiliary
  144. *
  145. *> \par Further Details:
  146. * =====================
  147. *>
  148. *> \verbatim
  149. *>
  150. *> If UPLO = 'U', the matrix Q is represented as a product of elementary
  151. *> reflectors
  152. *>
  153. *> Q = H(n) H(n-1) . . . H(n-nb+1).
  154. *>
  155. *> Each H(i) has the form
  156. *>
  157. *> H(i) = I - tau * v * v**T
  158. *>
  159. *> where tau is a real scalar, and v is a real vector with
  160. *> v(i:n) = 0 and v(i-1) = 1; v(1:i-1) is stored on exit in A(1:i-1,i),
  161. *> and tau in TAU(i-1).
  162. *>
  163. *> If UPLO = 'L', the matrix Q is represented as a product of elementary
  164. *> reflectors
  165. *>
  166. *> Q = H(1) H(2) . . . H(nb).
  167. *>
  168. *> Each H(i) has the form
  169. *>
  170. *> H(i) = I - tau * v * v**T
  171. *>
  172. *> where tau is a real scalar, and v is a real vector with
  173. *> v(1:i) = 0 and v(i+1) = 1; v(i+1:n) is stored on exit in A(i+1:n,i),
  174. *> and tau in TAU(i).
  175. *>
  176. *> The elements of the vectors v together form the n-by-nb matrix V
  177. *> which is needed, with W, to apply the transformation to the unreduced
  178. *> part of the matrix, using a symmetric rank-2k update of the form:
  179. *> A := A - V*W**T - W*V**T.
  180. *>
  181. *> The contents of A on exit are illustrated by the following examples
  182. *> with n = 5 and nb = 2:
  183. *>
  184. *> if UPLO = 'U': if UPLO = 'L':
  185. *>
  186. *> ( a a a v4 v5 ) ( d )
  187. *> ( a a v4 v5 ) ( 1 d )
  188. *> ( a 1 v5 ) ( v1 1 a )
  189. *> ( d 1 ) ( v1 v2 a a )
  190. *> ( d ) ( v1 v2 a a a )
  191. *>
  192. *> where d denotes a diagonal element of the reduced matrix, a denotes
  193. *> an element of the original matrix that is unchanged, and vi denotes
  194. *> an element of the vector defining H(i).
  195. *> \endverbatim
  196. *>
  197. * =====================================================================
  198. SUBROUTINE DLATRD( UPLO, N, NB, A, LDA, E, TAU, W, LDW )
  199. *
  200. * -- LAPACK auxiliary routine --
  201. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  202. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  203. *
  204. * .. Scalar Arguments ..
  205. CHARACTER UPLO
  206. INTEGER LDA, LDW, N, NB
  207. * ..
  208. * .. Array Arguments ..
  209. REAL*8 A( LDA, * ), E( * ), TAU( * ), W( LDW, * )
  210. * ..
  211. *
  212. * =====================================================================
  213. *
  214. * .. Parameters ..
  215. REAL*8 ZERO, ONE, HALF
  216. PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, HALF = 0.5D+0 )
  217. * ..
  218. * .. Local Scalars ..
  219. INTEGER I, IW
  220. REAL*8 ALPHA
  221. * ..
  222. * .. External Subroutines ..
  223. EXTERNAL DAXPY, DGEMV, DLARFG, DSCAL, DSYMV
  224. * ..
  225. * .. External Functions ..
  226. LOGICAL LSAME
  227. REAL*8 DDOT
  228. EXTERNAL LSAME, DDOT
  229. * ..
  230. * .. Intrinsic Functions ..
  231. * INTRINSIC MIN
  232. * ..
  233. * .. Executable Statements ..
  234. *
  235. * Quick return if possible
  236. *
  237. IF( N.LE.0 )
  238. $ RETURN
  239. *
  240. IF( LSAME( UPLO, 'U' ) ) THEN
  241. *
  242. * Reduce last NB columns of upper triangle
  243. *
  244. DO 10 I = N, N - NB + 1, -1
  245. IW = I - N + NB
  246. IF( I.LT.N ) THEN
  247. *
  248. * Update A(1:i,i)
  249. *
  250. CALL DGEMV( 'No transpose', I, N-I, -ONE, A( 1, I+1 ),
  251. $ LDA, W( I, IW+1 ), LDW, ONE, A( 1, I ), 1 )
  252. CALL DGEMV( 'No transpose', I, N-I, -ONE, W( 1, IW+1 ),
  253. $ LDW, A( I, I+1 ), LDA, ONE, A( 1, I ), 1 )
  254. END IF
  255. IF( I.GT.1 ) THEN
  256. *
  257. * Generate elementary reflector H(i) to annihilate
  258. * A(1:i-2,i)
  259. *
  260. CALL DLARFG( I-1, A( I-1, I ), A( 1, I ), 1, TAU( I-1 ) )
  261. E( I-1 ) = A( I-1, I )
  262. A( I-1, I ) = ONE
  263. *
  264. * Compute W(1:i-1,i)
  265. *
  266. CALL DSYMV( 'Upper', I-1, ONE, A, LDA, A( 1, I ), 1,
  267. $ ZERO, W( 1, IW ), 1 )
  268. IF( I.LT.N ) THEN
  269. CALL DGEMV( 'Transpose', I-1, N-I, ONE, W( 1, IW+1 ),
  270. $ LDW, A( 1, I ), 1, ZERO, W( I+1, IW ), 1 )
  271. CALL DGEMV( 'No transpose', I-1, N-I, -ONE,
  272. $ A( 1, I+1 ), LDA, W( I+1, IW ), 1, ONE,
  273. $ W( 1, IW ), 1 )
  274. CALL DGEMV( 'Transpose', I-1, N-I, ONE, A( 1, I+1 ),
  275. $ LDA, A( 1, I ), 1, ZERO, W( I+1, IW ), 1 )
  276. CALL DGEMV( 'No transpose', I-1, N-I, -ONE,
  277. $ W( 1, IW+1 ), LDW, W( I+1, IW ), 1, ONE,
  278. $ W( 1, IW ), 1 )
  279. END IF
  280. CALL DSCAL( I-1, TAU( I-1 ), W( 1, IW ), 1 )
  281. ALPHA = -HALF*TAU( I-1 )*DDOT( I-1, W( 1, IW ), 1,
  282. $ A( 1, I ), 1 )
  283. CALL DAXPY( I-1, ALPHA, A( 1, I ), 1, W( 1, IW ), 1 )
  284. END IF
  285. *
  286. 10 CONTINUE
  287. ELSE
  288. *
  289. * Reduce first NB columns of lower triangle
  290. *
  291. DO 20 I = 1, NB
  292. *
  293. * Update A(i:n,i)
  294. *
  295. CALL DGEMV( 'No transpose', N-I+1, I-1, -ONE, A( I, 1 ),
  296. $ LDA, W( I, 1 ), LDW, ONE, A( I, I ), 1 )
  297. CALL DGEMV( 'No transpose', N-I+1, I-1, -ONE, W( I, 1 ),
  298. $ LDW, A( I, 1 ), LDA, ONE, A( I, I ), 1 )
  299. IF( I.LT.N ) THEN
  300. *
  301. * Generate elementary reflector H(i) to annihilate
  302. * A(i+2:n,i)
  303. *
  304. CALL DLARFG( N-I, A( I+1, I ), A( MIN( I+2, N ), I ), 1,
  305. $ TAU( I ) )
  306. E( I ) = A( I+1, I )
  307. A( I+1, I ) = ONE
  308. *
  309. * Compute W(i+1:n,i)
  310. *
  311. CALL DSYMV( 'Lower', N-I, ONE, A( I+1, I+1 ), LDA,
  312. $ A( I+1, I ), 1, ZERO, W( I+1, I ), 1 )
  313. CALL DGEMV( 'Transpose', N-I, I-1, ONE, W( I+1, 1 ), LDW,
  314. $ A( I+1, I ), 1, ZERO, W( 1, I ), 1 )
  315. CALL DGEMV( 'No transpose', N-I, I-1, -ONE, A( I+1, 1 ),
  316. $ LDA, W( 1, I ), 1, ONE, W( I+1, I ), 1 )
  317. CALL DGEMV( 'Transpose', N-I, I-1, ONE, A( I+1, 1 ), LDA,
  318. $ A( I+1, I ), 1, ZERO, W( 1, I ), 1 )
  319. CALL DGEMV( 'No transpose', N-I, I-1, -ONE, W( I+1, 1 ),
  320. $ LDW, W( 1, I ), 1, ONE, W( I+1, I ), 1 )
  321. CALL DSCAL( N-I, TAU( I ), W( I+1, I ), 1 )
  322. ALPHA = -HALF*TAU( I )*DDOT( N-I, W( I+1, I ), 1,
  323. $ A( I+1, I ), 1 )
  324. CALL DAXPY( N-I, ALPHA, A( I+1, I ), 1, W( I+1, I ), 1 )
  325. END IF
  326. *
  327. 20 CONTINUE
  328. END IF
  329. *
  330. RETURN
  331. *
  332. * End of DLATRD
  333. *
  334. END
  335.  
  336.  

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