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.

ctplqt.f 7.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. *> \brief \b CTPLQT
  2. *
  3. * Definition:
  4. * ===========
  5. *
  6. * SUBROUTINE CTPLQT( M, N, L, MB, A, LDA, B, LDB, T, LDT, WORK,
  7. * INFO )
  8. *
  9. * .. Scalar Arguments ..
  10. * INTEGER INFO, LDA, LDB, LDT, N, M, L, MB
  11. * ..
  12. * .. Array Arguments ..
  13. * COMPLEX A( LDA, * ), B( LDB, * ), T( LDT, * ), WORK( * )
  14. * ..
  15. *
  16. *
  17. *> \par Purpose:
  18. * =============
  19. *>
  20. *> \verbatim
  21. *>
  22. *> CTPLQT computes a blocked LQ factorization of a complex
  23. *> "triangular-pentagonal" matrix C, which is composed of a
  24. *> triangular block A and pentagonal block B, using the compact
  25. *> WY representation for Q.
  26. *> \endverbatim
  27. *
  28. * Arguments:
  29. * ==========
  30. *
  31. *> \param[in] M
  32. *> \verbatim
  33. *> M is INTEGER
  34. *> The number of rows of the matrix B, and the order of the
  35. *> triangular matrix A.
  36. *> M >= 0.
  37. *> \endverbatim
  38. *>
  39. *> \param[in] N
  40. *> \verbatim
  41. *> N is INTEGER
  42. *> The number of columns of the matrix B.
  43. *> N >= 0.
  44. *> \endverbatim
  45. *>
  46. *> \param[in] L
  47. *> \verbatim
  48. *> L is INTEGER
  49. *> The number of rows of the lower trapezoidal part of B.
  50. *> MIN(M,N) >= L >= 0. See Further Details.
  51. *> \endverbatim
  52. *>
  53. *> \param[in] MB
  54. *> \verbatim
  55. *> MB is INTEGER
  56. *> The block size to be used in the blocked QR. M >= MB >= 1.
  57. *> \endverbatim
  58. *>
  59. *> \param[in,out] A
  60. *> \verbatim
  61. *> A is COMPLEX array, dimension (LDA,M)
  62. *> On entry, the lower triangular M-by-M matrix A.
  63. *> On exit, the elements on and below the diagonal of the array
  64. *> contain the lower triangular matrix L.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] LDA
  68. *> \verbatim
  69. *> LDA is INTEGER
  70. *> The leading dimension of the array A. LDA >= max(1,M).
  71. *> \endverbatim
  72. *>
  73. *> \param[in,out] B
  74. *> \verbatim
  75. *> B is COMPLEX array, dimension (LDB,N)
  76. *> On entry, the pentagonal M-by-N matrix B. The first N-L columns
  77. *> are rectangular, and the last L columns are lower trapezoidal.
  78. *> On exit, B contains the pentagonal matrix V. See Further Details.
  79. *> \endverbatim
  80. *>
  81. *> \param[in] LDB
  82. *> \verbatim
  83. *> LDB is INTEGER
  84. *> The leading dimension of the array B. LDB >= max(1,M).
  85. *> \endverbatim
  86. *>
  87. *> \param[out] T
  88. *> \verbatim
  89. *> T is COMPLEX array, dimension (LDT,N)
  90. *> The lower triangular block reflectors stored in compact form
  91. *> as a sequence of upper triangular blocks. See Further Details.
  92. *> \endverbatim
  93. *>
  94. *> \param[in] LDT
  95. *> \verbatim
  96. *> LDT is INTEGER
  97. *> The leading dimension of the array T. LDT >= MB.
  98. *> \endverbatim
  99. *>
  100. *> \param[out] WORK
  101. *> \verbatim
  102. *> WORK is COMPLEX array, dimension (MB*M)
  103. *> \endverbatim
  104. *>
  105. *> \param[out] INFO
  106. *> \verbatim
  107. *> INFO is INTEGER
  108. *> = 0: successful exit
  109. *> < 0: if INFO = -i, the i-th argument had an illegal value
  110. *> \endverbatim
  111. *
  112. * Authors:
  113. * ========
  114. *
  115. *> \author Univ. of Tennessee
  116. *> \author Univ. of California Berkeley
  117. *> \author Univ. of Colorado Denver
  118. *> \author NAG Ltd.
  119. *
  120. *> \date June 2017
  121. *
  122. *> \ingroup doubleOTHERcomputational
  123. *
  124. *> \par Further Details:
  125. * =====================
  126. *>
  127. *> \verbatim
  128. *>
  129. *> The input matrix C is a M-by-(M+N) matrix
  130. *>
  131. *> C = [ A ] [ B ]
  132. *>
  133. *>
  134. *> where A is an lower triangular M-by-M matrix, and B is M-by-N pentagonal
  135. *> matrix consisting of a M-by-(N-L) rectangular matrix B1 on left of a M-by-L
  136. *> upper trapezoidal matrix B2:
  137. *> [ B ] = [ B1 ] [ B2 ]
  138. *> [ B1 ] <- M-by-(N-L) rectangular
  139. *> [ B2 ] <- M-by-L lower trapezoidal.
  140. *>
  141. *> The lower trapezoidal matrix B2 consists of the first L columns of a
  142. *> M-by-M lower triangular matrix, where 0 <= L <= MIN(M,N). If L=0,
  143. *> B is rectangular M-by-N; if M=L=N, B is lower triangular.
  144. *>
  145. *> The matrix W stores the elementary reflectors H(i) in the i-th row
  146. *> above the diagonal (of A) in the M-by-(M+N) input matrix C
  147. *> [ C ] = [ A ] [ B ]
  148. *> [ A ] <- lower triangular M-by-M
  149. *> [ B ] <- M-by-N pentagonal
  150. *>
  151. *> so that W can be represented as
  152. *> [ W ] = [ I ] [ V ]
  153. *> [ I ] <- identity, M-by-M
  154. *> [ V ] <- M-by-N, same form as B.
  155. *>
  156. *> Thus, all of information needed for W is contained on exit in B, which
  157. *> we call V above. Note that V has the same form as B; that is,
  158. *> [ V ] = [ V1 ] [ V2 ]
  159. *> [ V1 ] <- M-by-(N-L) rectangular
  160. *> [ V2 ] <- M-by-L lower trapezoidal.
  161. *>
  162. *> The rows of V represent the vectors which define the H(i)'s.
  163. *>
  164. *> The number of blocks is B = ceiling(M/MB), where each
  165. *> block is of order MB except for the last block, which is of order
  166. *> IB = M - (M-1)*MB. For each of the B blocks, a upper triangular block
  167. *> reflector factor is computed: T1, T2, ..., TB. The MB-by-MB (and IB-by-IB
  168. *> for the last block) T's are stored in the MB-by-N matrix T as
  169. *>
  170. *> T = [T1 T2 ... TB].
  171. *> \endverbatim
  172. *>
  173. * =====================================================================
  174. SUBROUTINE CTPLQT( M, N, L, MB, A, LDA, B, LDB, T, LDT, WORK,
  175. $ INFO )
  176. *
  177. * -- LAPACK computational routine (version 3.7.1) --
  178. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  179. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  180. * June 2017
  181. *
  182. * .. Scalar Arguments ..
  183. INTEGER INFO, LDA, LDB, LDT, N, M, L, MB
  184. * ..
  185. * .. Array Arguments ..
  186. COMPLEX A( LDA, * ), B( LDB, * ), T( LDT, * ), WORK( * )
  187. * ..
  188. *
  189. * =====================================================================
  190. *
  191. * ..
  192. * .. Local Scalars ..
  193. INTEGER I, IB, LB, NB, IINFO
  194. * ..
  195. * .. External Subroutines ..
  196. EXTERNAL CTPLQT2, CTPRFB, XERBLA
  197. * ..
  198. * .. Executable Statements ..
  199. *
  200. * Test the input arguments
  201. *
  202. INFO = 0
  203. IF( M.LT.0 ) THEN
  204. INFO = -1
  205. ELSE IF( N.LT.0 ) THEN
  206. INFO = -2
  207. ELSE IF( L.LT.0 .OR. (L.GT.MIN(M,N) .AND. MIN(M,N).GE.0)) THEN
  208. INFO = -3
  209. ELSE IF( MB.LT.1 .OR. (MB.GT.M .AND. M.GT.0)) THEN
  210. INFO = -4
  211. ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
  212. INFO = -6
  213. ELSE IF( LDB.LT.MAX( 1, M ) ) THEN
  214. INFO = -8
  215. ELSE IF( LDT.LT.MB ) THEN
  216. INFO = -10
  217. END IF
  218. IF( INFO.NE.0 ) THEN
  219. CALL XERBLA( 'CTPLQT', -INFO )
  220. RETURN
  221. END IF
  222. *
  223. * Quick return if possible
  224. *
  225. IF( M.EQ.0 .OR. N.EQ.0 ) RETURN
  226. *
  227. DO I = 1, M, MB
  228. *
  229. * Compute the QR factorization of the current block
  230. *
  231. IB = MIN( M-I+1, MB )
  232. NB = MIN( N-L+I+IB-1, N )
  233. IF( I.GE.L ) THEN
  234. LB = 0
  235. ELSE
  236. LB = NB-N+L-I+1
  237. END IF
  238. *
  239. CALL CTPLQT2( IB, NB, LB, A(I,I), LDA, B( I, 1 ), LDB,
  240. $ T(1, I ), LDT, IINFO )
  241. *
  242. * Update by applying H**T to B(I+IB:M,:) from the right
  243. *
  244. IF( I+IB.LE.M ) THEN
  245. CALL CTPRFB( 'R', 'N', 'F', 'R', M-I-IB+1, NB, IB, LB,
  246. $ B( I, 1 ), LDB, T( 1, I ), LDT,
  247. $ A( I+IB, I ), LDA, B( I+IB, 1 ), LDB,
  248. $ WORK, M-I-IB+1)
  249. END IF
  250. END DO
  251. RETURN
  252. *
  253. * End of CTPLQT
  254. *
  255. END