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.

cupgtr.f 6.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. *> \brief \b CUPGTR
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download CUPGTR + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cupgtr.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cupgtr.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cupgtr.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE CUPGTR( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
  22. *
  23. * .. Scalar Arguments ..
  24. * CHARACTER UPLO
  25. * INTEGER INFO, LDQ, N
  26. * ..
  27. * .. Array Arguments ..
  28. * COMPLEX AP( * ), Q( LDQ, * ), TAU( * ), WORK( * )
  29. * ..
  30. *
  31. *
  32. *> \par Purpose:
  33. * =============
  34. *>
  35. *> \verbatim
  36. *>
  37. *> CUPGTR generates a complex unitary matrix Q which is defined as the
  38. *> product of n-1 elementary reflectors H(i) of order n, as returned by
  39. *> CHPTRD using packed storage:
  40. *>
  41. *> if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
  42. *>
  43. *> if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
  44. *> \endverbatim
  45. *
  46. * Arguments:
  47. * ==========
  48. *
  49. *> \param[in] UPLO
  50. *> \verbatim
  51. *> UPLO is CHARACTER*1
  52. *> = 'U': Upper triangular packed storage used in previous
  53. *> call to CHPTRD;
  54. *> = 'L': Lower triangular packed storage used in previous
  55. *> call to CHPTRD.
  56. *> \endverbatim
  57. *>
  58. *> \param[in] N
  59. *> \verbatim
  60. *> N is INTEGER
  61. *> The order of the matrix Q. N >= 0.
  62. *> \endverbatim
  63. *>
  64. *> \param[in] AP
  65. *> \verbatim
  66. *> AP is COMPLEX array, dimension (N*(N+1)/2)
  67. *> The vectors which define the elementary reflectors, as
  68. *> returned by CHPTRD.
  69. *> \endverbatim
  70. *>
  71. *> \param[in] TAU
  72. *> \verbatim
  73. *> TAU is COMPLEX array, dimension (N-1)
  74. *> TAU(i) must contain the scalar factor of the elementary
  75. *> reflector H(i), as returned by CHPTRD.
  76. *> \endverbatim
  77. *>
  78. *> \param[out] Q
  79. *> \verbatim
  80. *> Q is COMPLEX array, dimension (LDQ,N)
  81. *> The N-by-N unitary matrix Q.
  82. *> \endverbatim
  83. *>
  84. *> \param[in] LDQ
  85. *> \verbatim
  86. *> LDQ is INTEGER
  87. *> The leading dimension of the array Q. LDQ >= max(1,N).
  88. *> \endverbatim
  89. *>
  90. *> \param[out] WORK
  91. *> \verbatim
  92. *> WORK is COMPLEX array, dimension (N-1)
  93. *> \endverbatim
  94. *>
  95. *> \param[out] INFO
  96. *> \verbatim
  97. *> INFO is INTEGER
  98. *> = 0: successful exit
  99. *> < 0: if INFO = -i, the i-th argument had an illegal value
  100. *> \endverbatim
  101. *
  102. * Authors:
  103. * ========
  104. *
  105. *> \author Univ. of Tennessee
  106. *> \author Univ. of California Berkeley
  107. *> \author Univ. of Colorado Denver
  108. *> \author NAG Ltd.
  109. *
  110. *> \ingroup complexOTHERcomputational
  111. *
  112. * =====================================================================
  113. SUBROUTINE CUPGTR( UPLO, N, AP, TAU, Q, LDQ, WORK, INFO )
  114. *
  115. * -- LAPACK computational routine --
  116. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  117. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  118. *
  119. * .. Scalar Arguments ..
  120. CHARACTER UPLO
  121. INTEGER INFO, LDQ, N
  122. * ..
  123. * .. Array Arguments ..
  124. COMPLEX AP( * ), Q( LDQ, * ), TAU( * ), WORK( * )
  125. * ..
  126. *
  127. * =====================================================================
  128. *
  129. * .. Parameters ..
  130. COMPLEX CZERO, CONE
  131. PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
  132. $ CONE = ( 1.0E+0, 0.0E+0 ) )
  133. * ..
  134. * .. Local Scalars ..
  135. LOGICAL UPPER
  136. INTEGER I, IINFO, IJ, J
  137. * ..
  138. * .. External Functions ..
  139. LOGICAL LSAME
  140. EXTERNAL LSAME
  141. * ..
  142. * .. External Subroutines ..
  143. EXTERNAL CUNG2L, CUNG2R, XERBLA
  144. * ..
  145. * .. Intrinsic Functions ..
  146. INTRINSIC MAX
  147. * ..
  148. * .. Executable Statements ..
  149. *
  150. * Test the input arguments
  151. *
  152. INFO = 0
  153. UPPER = LSAME( UPLO, 'U' )
  154. IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
  155. INFO = -1
  156. ELSE IF( N.LT.0 ) THEN
  157. INFO = -2
  158. ELSE IF( LDQ.LT.MAX( 1, N ) ) THEN
  159. INFO = -6
  160. END IF
  161. IF( INFO.NE.0 ) THEN
  162. CALL XERBLA( 'CUPGTR', -INFO )
  163. RETURN
  164. END IF
  165. *
  166. * Quick return if possible
  167. *
  168. IF( N.EQ.0 )
  169. $ RETURN
  170. *
  171. IF( UPPER ) THEN
  172. *
  173. * Q was determined by a call to CHPTRD with UPLO = 'U'
  174. *
  175. * Unpack the vectors which define the elementary reflectors and
  176. * set the last row and column of Q equal to those of the unit
  177. * matrix
  178. *
  179. IJ = 2
  180. DO 20 J = 1, N - 1
  181. DO 10 I = 1, J - 1
  182. Q( I, J ) = AP( IJ )
  183. IJ = IJ + 1
  184. 10 CONTINUE
  185. IJ = IJ + 2
  186. Q( N, J ) = CZERO
  187. 20 CONTINUE
  188. DO 30 I = 1, N - 1
  189. Q( I, N ) = CZERO
  190. 30 CONTINUE
  191. Q( N, N ) = CONE
  192. *
  193. * Generate Q(1:n-1,1:n-1)
  194. *
  195. CALL CUNG2L( N-1, N-1, N-1, Q, LDQ, TAU, WORK, IINFO )
  196. *
  197. ELSE
  198. *
  199. * Q was determined by a call to CHPTRD with UPLO = 'L'.
  200. *
  201. * Unpack the vectors which define the elementary reflectors and
  202. * set the first row and column of Q equal to those of the unit
  203. * matrix
  204. *
  205. Q( 1, 1 ) = CONE
  206. DO 40 I = 2, N
  207. Q( I, 1 ) = CZERO
  208. 40 CONTINUE
  209. IJ = 3
  210. DO 60 J = 2, N
  211. Q( 1, J ) = CZERO
  212. DO 50 I = J + 1, N
  213. Q( I, J ) = AP( IJ )
  214. IJ = IJ + 1
  215. 50 CONTINUE
  216. IJ = IJ + 2
  217. 60 CONTINUE
  218. IF( N.GT.1 ) THEN
  219. *
  220. * Generate Q(2:n,2:n)
  221. *
  222. CALL CUNG2R( N-1, N-1, N-1, Q( 2, 2 ), LDQ, TAU, WORK,
  223. $ IINFO )
  224. END IF
  225. END IF
  226. RETURN
  227. *
  228. * End of CUPGTR
  229. *
  230. END