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.

ctpmlqt.f 9.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. *> \brief \b CTPMLQT
  2. *
  3. * Definition:
  4. * ===========
  5. *
  6. * SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
  7. * A, LDA, B, LDB, WORK, INFO )
  8. *
  9. * .. Scalar Arguments ..
  10. * CHARACTER SIDE, TRANS
  11. * INTEGER INFO, K, LDV, LDA, LDB, M, N, L, MB, LDT
  12. * ..
  13. * .. Array Arguments ..
  14. * COMPLEX V( LDV, * ), A( LDA, * ), B( LDB, * ),
  15. * $ T( LDT, * ), WORK( * )
  16. * ..
  17. *
  18. *
  19. *> \par Purpose:
  20. * =============
  21. *>
  22. *> \verbatim
  23. *>
  24. *> CTPMLQT applies a complex unitary matrix Q obtained from a
  25. *> "triangular-pentagonal" complex block reflector H to a general
  26. *> complex matrix C, which consists of two blocks A and B.
  27. *> \endverbatim
  28. *
  29. * Arguments:
  30. * ==========
  31. *
  32. *> \param[in] SIDE
  33. *> \verbatim
  34. *> SIDE is CHARACTER*1
  35. *> = 'L': apply Q or Q**H from the Left;
  36. *> = 'R': apply Q or Q**H from the Right.
  37. *> \endverbatim
  38. *>
  39. *> \param[in] TRANS
  40. *> \verbatim
  41. *> TRANS is CHARACTER*1
  42. *> = 'N': No transpose, apply Q;
  43. *> = 'C': Conjugate transpose, apply Q**H.
  44. *> \endverbatim
  45. *>
  46. *> \param[in] M
  47. *> \verbatim
  48. *> M is INTEGER
  49. *> The number of rows of the matrix B. M >= 0.
  50. *> \endverbatim
  51. *>
  52. *> \param[in] N
  53. *> \verbatim
  54. *> N is INTEGER
  55. *> The number of columns of the matrix B. N >= 0.
  56. *> \endverbatim
  57. *>
  58. *> \param[in] K
  59. *> \verbatim
  60. *> K is INTEGER
  61. *> The number of elementary reflectors whose product defines
  62. *> the matrix Q.
  63. *> \endverbatim
  64. *>
  65. *> \param[in] L
  66. *> \verbatim
  67. *> L is INTEGER
  68. *> The order of the trapezoidal part of V.
  69. *> K >= L >= 0. See Further Details.
  70. *> \endverbatim
  71. *>
  72. *> \param[in] MB
  73. *> \verbatim
  74. *> MB is INTEGER
  75. *> The block size used for the storage of T. K >= MB >= 1.
  76. *> This must be the same value of MB used to generate T
  77. *> in CTPLQT.
  78. *> \endverbatim
  79. *>
  80. *> \param[in] V
  81. *> \verbatim
  82. *> V is COMPLEX array, dimension (LDV,K)
  83. *> The i-th row must contain the vector which defines the
  84. *> elementary reflector H(i), for i = 1,2,...,k, as returned by
  85. *> CTPLQT in B. See Further Details.
  86. *> \endverbatim
  87. *>
  88. *> \param[in] LDV
  89. *> \verbatim
  90. *> LDV is INTEGER
  91. *> The leading dimension of the array V. LDV >= K.
  92. *> \endverbatim
  93. *>
  94. *> \param[in] T
  95. *> \verbatim
  96. *> T is COMPLEX array, dimension (LDT,K)
  97. *> The upper triangular factors of the block reflectors
  98. *> as returned by CTPLQT, stored as a MB-by-K matrix.
  99. *> \endverbatim
  100. *>
  101. *> \param[in] LDT
  102. *> \verbatim
  103. *> LDT is INTEGER
  104. *> The leading dimension of the array T. LDT >= MB.
  105. *> \endverbatim
  106. *>
  107. *> \param[in,out] A
  108. *> \verbatim
  109. *> A is COMPLEX array, dimension
  110. *> (LDA,N) if SIDE = 'L' or
  111. *> (LDA,K) if SIDE = 'R'
  112. *> On entry, the K-by-N or M-by-K matrix A.
  113. *> On exit, A is overwritten by the corresponding block of
  114. *> Q*C or Q**H*C or C*Q or C*Q**H. See Further Details.
  115. *> \endverbatim
  116. *>
  117. *> \param[in] LDA
  118. *> \verbatim
  119. *> LDA is INTEGER
  120. *> The leading dimension of the array A.
  121. *> If SIDE = 'L', LDA >= max(1,K);
  122. *> If SIDE = 'R', LDA >= max(1,M).
  123. *> \endverbatim
  124. *>
  125. *> \param[in,out] B
  126. *> \verbatim
  127. *> B is COMPLEX array, dimension (LDB,N)
  128. *> On entry, the M-by-N matrix B.
  129. *> On exit, B is overwritten by the corresponding block of
  130. *> Q*C or Q**H*C or C*Q or C*Q**H. See Further Details.
  131. *> \endverbatim
  132. *>
  133. *> \param[in] LDB
  134. *> \verbatim
  135. *> LDB is INTEGER
  136. *> The leading dimension of the array B.
  137. *> LDB >= max(1,M).
  138. *> \endverbatim
  139. *>
  140. *> \param[out] WORK
  141. *> \verbatim
  142. *> WORK is COMPLEX array. The dimension of WORK is
  143. *> N*MB if SIDE = 'L', or M*MB if SIDE = 'R'.
  144. *> \endverbatim
  145. *>
  146. *> \param[out] INFO
  147. *> \verbatim
  148. *> INFO is INTEGER
  149. *> = 0: successful exit
  150. *> < 0: if INFO = -i, the i-th argument had an illegal value
  151. *> \endverbatim
  152. *
  153. * Authors:
  154. * ========
  155. *
  156. *> \author Univ. of Tennessee
  157. *> \author Univ. of California Berkeley
  158. *> \author Univ. of Colorado Denver
  159. *> \author NAG Ltd.
  160. *
  161. *> \ingroup doubleOTHERcomputational
  162. *
  163. *> \par Further Details:
  164. * =====================
  165. *>
  166. *> \verbatim
  167. *>
  168. *> The columns of the pentagonal matrix V contain the elementary reflectors
  169. *> H(1), H(2), ..., H(K); V is composed of a rectangular block V1 and a
  170. *> trapezoidal block V2:
  171. *>
  172. *> V = [V1] [V2].
  173. *>
  174. *>
  175. *> The size of the trapezoidal block V2 is determined by the parameter L,
  176. *> where 0 <= L <= K; V2 is lower trapezoidal, consisting of the first L
  177. *> rows of a K-by-K upper triangular matrix. If L=K, V2 is lower triangular;
  178. *> if L=0, there is no trapezoidal block, hence V = V1 is rectangular.
  179. *>
  180. *> If SIDE = 'L': C = [A] where A is K-by-N, B is M-by-N and V is K-by-M.
  181. *> [B]
  182. *>
  183. *> If SIDE = 'R': C = [A B] where A is M-by-K, B is M-by-N and V is K-by-N.
  184. *>
  185. *> The complex unitary matrix Q is formed from V and T.
  186. *>
  187. *> If TRANS='N' and SIDE='L', C is on exit replaced with Q * C.
  188. *>
  189. *> If TRANS='C' and SIDE='L', C is on exit replaced with Q**H * C.
  190. *>
  191. *> If TRANS='N' and SIDE='R', C is on exit replaced with C * Q.
  192. *>
  193. *> If TRANS='C' and SIDE='R', C is on exit replaced with C * Q**H.
  194. *> \endverbatim
  195. *>
  196. * =====================================================================
  197. SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
  198. $ A, LDA, B, LDB, WORK, INFO )
  199. *
  200. * -- LAPACK computational 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 SIDE, TRANS
  206. INTEGER INFO, K, LDV, LDA, LDB, M, N, L, MB, LDT
  207. * ..
  208. * .. Array Arguments ..
  209. COMPLEX V( LDV, * ), A( LDA, * ), B( LDB, * ),
  210. $ T( LDT, * ), WORK( * )
  211. * ..
  212. *
  213. * =====================================================================
  214. *
  215. * ..
  216. * .. Local Scalars ..
  217. LOGICAL LEFT, RIGHT, TRAN, NOTRAN
  218. INTEGER I, IB, NB, LB, KF, LDAQ
  219. * ..
  220. * .. External Functions ..
  221. LOGICAL LSAME
  222. EXTERNAL LSAME
  223. * ..
  224. * .. External Subroutines ..
  225. EXTERNAL XERBLA, CTPRFB
  226. * ..
  227. * .. Intrinsic Functions ..
  228. INTRINSIC MAX, MIN
  229. * ..
  230. * .. Executable Statements ..
  231. *
  232. * .. Test the input arguments ..
  233. *
  234. INFO = 0
  235. LEFT = LSAME( SIDE, 'L' )
  236. RIGHT = LSAME( SIDE, 'R' )
  237. TRAN = LSAME( TRANS, 'C' )
  238. NOTRAN = LSAME( TRANS, 'N' )
  239. *
  240. IF ( LEFT ) THEN
  241. LDAQ = MAX( 1, K )
  242. ELSE IF ( RIGHT ) THEN
  243. LDAQ = MAX( 1, M )
  244. END IF
  245. IF( .NOT.LEFT .AND. .NOT.RIGHT ) THEN
  246. INFO = -1
  247. ELSE IF( .NOT.TRAN .AND. .NOT.NOTRAN ) THEN
  248. INFO = -2
  249. ELSE IF( M.LT.0 ) THEN
  250. INFO = -3
  251. ELSE IF( N.LT.0 ) THEN
  252. INFO = -4
  253. ELSE IF( K.LT.0 ) THEN
  254. INFO = -5
  255. ELSE IF( L.LT.0 .OR. L.GT.K ) THEN
  256. INFO = -6
  257. ELSE IF( MB.LT.1 .OR. (MB.GT.K .AND. K.GT.0) ) THEN
  258. INFO = -7
  259. ELSE IF( LDV.LT.K ) THEN
  260. INFO = -9
  261. ELSE IF( LDT.LT.MB ) THEN
  262. INFO = -11
  263. ELSE IF( LDA.LT.LDAQ ) THEN
  264. INFO = -13
  265. ELSE IF( LDB.LT.MAX( 1, M ) ) THEN
  266. INFO = -15
  267. END IF
  268. *
  269. IF( INFO.NE.0 ) THEN
  270. CALL XERBLA( 'CTPMLQT', -INFO )
  271. RETURN
  272. END IF
  273. *
  274. * .. Quick return if possible ..
  275. *
  276. IF( M.EQ.0 .OR. N.EQ.0 .OR. K.EQ.0 ) RETURN
  277. *
  278. IF( LEFT .AND. NOTRAN ) THEN
  279. *
  280. DO I = 1, K, MB
  281. IB = MIN( MB, K-I+1 )
  282. NB = MIN( M-L+I+IB-1, M )
  283. IF( I.GE.L ) THEN
  284. LB = 0
  285. ELSE
  286. LB = 0
  287. END IF
  288. CALL CTPRFB( 'L', 'C', 'F', 'R', NB, N, IB, LB,
  289. $ V( I, 1 ), LDV, T( 1, I ), LDT,
  290. $ A( I, 1 ), LDA, B, LDB, WORK, IB )
  291. END DO
  292. *
  293. ELSE IF( RIGHT .AND. TRAN ) THEN
  294. *
  295. DO I = 1, K, MB
  296. IB = MIN( MB, K-I+1 )
  297. NB = MIN( N-L+I+IB-1, N )
  298. IF( I.GE.L ) THEN
  299. LB = 0
  300. ELSE
  301. LB = NB-N+L-I+1
  302. END IF
  303. CALL CTPRFB( 'R', 'N', 'F', 'R', M, NB, IB, LB,
  304. $ V( I, 1 ), LDV, T( 1, I ), LDT,
  305. $ A( 1, I ), LDA, B, LDB, WORK, M )
  306. END DO
  307. *
  308. ELSE IF( LEFT .AND. TRAN ) THEN
  309. *
  310. KF = ((K-1)/MB)*MB+1
  311. DO I = KF, 1, -MB
  312. IB = MIN( MB, K-I+1 )
  313. NB = MIN( M-L+I+IB-1, M )
  314. IF( I.GE.L ) THEN
  315. LB = 0
  316. ELSE
  317. LB = 0
  318. END IF
  319. CALL CTPRFB( 'L', 'N', 'F', 'R', NB, N, IB, LB,
  320. $ V( I, 1 ), LDV, T( 1, I ), LDT,
  321. $ A( I, 1 ), LDA, B, LDB, WORK, IB )
  322. END DO
  323. *
  324. ELSE IF( RIGHT .AND. NOTRAN ) THEN
  325. *
  326. KF = ((K-1)/MB)*MB+1
  327. DO I = KF, 1, -MB
  328. IB = MIN( MB, K-I+1 )
  329. NB = MIN( N-L+I+IB-1, N )
  330. IF( I.GE.L ) THEN
  331. LB = 0
  332. ELSE
  333. LB = NB-N+L-I+1
  334. END IF
  335. CALL CTPRFB( 'R', 'C', 'F', 'R', M, NB, IB, LB,
  336. $ V( I, 1 ), LDV, T( 1, I ), LDT,
  337. $ A( 1, I ), LDA, B, LDB, WORK, M )
  338. END DO
  339. *
  340. END IF
  341. *
  342. RETURN
  343. *
  344. * End of CTPMLQT
  345. *
  346. END