LAPACK  3.7.0
LAPACK: Linear Algebra PACKage
ctpmlqt.f
Go to the documentation of this file.
1 * Definition:
2 * ===========
3 *
4 * SUBROUTINE CTPMLQT( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
5 * A, LDA, B, LDB, WORK, INFO )
6 *
7 * .. Scalar Arguments ..
8 * CHARACTER SIDE, TRANS
9 * INTEGER INFO, K, LDV, LDA, LDB, M, N, L, MB, LDT
10 * ..
11 * .. Array Arguments ..
12 * COMPLEX V( LDV, * ), A( LDA, * ), B( LDB, * ),
13 * $ T( LDT, * ), WORK( * )
14 * ..
15 *
16 *
17 *> \par Purpose:
18 * =============
19 *>
20 *> \verbatim
21 *>
22 *> CTPMQRT applies a complex orthogonal matrix Q obtained from a
23 *> "triangular-pentagonal" real block reflector H to a general
24 *> real matrix C, which consists of two blocks A and B.
25 *> \endverbatim
26 *
27 * Arguments:
28 * ==========
29 *
30 *> \param[in] SIDE
31 *> \verbatim
32 *> SIDE is CHARACTER*1
33 *> = 'L': apply Q or Q**C from the Left;
34 *> = 'R': apply Q or Q**C from the Right.
35 *> \endverbatim
36 *>
37 *> \param[in] TRANS
38 *> \verbatim
39 *> TRANS is CHARACTER*1
40 *> = 'N': No transpose, apply Q;
41 *> = 'C': Transpose, apply Q**C.
42 *> \endverbatim
43 *>
44 *> \param[in] M
45 *> \verbatim
46 *> M is INTEGER
47 *> The number of rows of the matrix B. M >= 0.
48 *> \endverbatim
49 *>
50 *> \param[in] N
51 *> \verbatim
52 *> N is INTEGER
53 *> The number of columns of the matrix B. N >= 0.
54 *> \endverbatim
55 *>
56 *> \param[in] K
57 *> \verbatim
58 *> K is INTEGER
59 *> The number of elementary reflectors whose product defines
60 *> the matrix Q.
61 *> \endverbatim
62 *>
63 *> \param[in] L
64 *> \verbatim
65 *> L is INTEGER
66 *> The order of the trapezoidal part of V.
67 *> K >= L >= 0. See Further Details.
68 *> \endverbatim
69 *>
70 *> \param[in] MB
71 *> \verbatim
72 *> MB is INTEGER
73 *> The block size used for the storage of T. K >= MB >= 1.
74 *> This must be the same value of MB used to generate T
75 *> in DTPLQT.
76 *> \endverbatim
77 *>
78 *> \param[in] V
79 *> \verbatim
80 *> V is COMPLEX array, dimension (LDA,K)
81 *> The i-th row must contain the vector which defines the
82 *> elementary reflector H(i), for i = 1,2,...,k, as returned by
83 *> DTPLQT in B. See Further Details.
84 *> \endverbatim
85 *>
86 *> \param[in] LDV
87 *> \verbatim
88 *> LDV is INTEGER
89 *> The leading dimension of the array V.
90 *> If SIDE = 'L', LDV >= max(1,M);
91 *> if SIDE = 'R', LDV >= max(1,N).
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 DTPLQT, 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**C*C or C*Q or C*Q**C. 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', LDC >= max(1,K);
122 *> If SIDE = 'R', LDC >= 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**C*C or C*Q or C*Q**C. 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 *> \date December 2016
162 *
163 *> \ingroup doubleOTHERcomputational
164 *
165 *> \par Further Details:
166 * =====================
167 *>
168 *> \verbatim
169 *>
170 *> The columns of the pentagonal matrix V contain the elementary reflectors
171 *> H(1), H(2), ..., H(K); V is composed of a rectangular block V1 and a
172 *> trapezoidal block V2:
173 *>
174 *> V = [V1] [V2].
175 *>
176 *>
177 *> The size of the trapezoidal block V2 is determined by the parameter L,
178 *> where 0 <= L <= K; V2 is lower trapezoidal, consisting of the first L
179 *> rows of a K-by-K upper triangular matrix. If L=K, V2 is lower triangular;
180 *> if L=0, there is no trapezoidal block, hence V = V1 is rectangular.
181 *>
182 *> If SIDE = 'L': C = [A] where A is K-by-N, B is M-by-N and V is K-by-M.
183 *> [B]
184 *>
185 *> If SIDE = 'R': C = [A B] where A is M-by-K, B is M-by-N and V is K-by-N.
186 *>
187 *> The real orthogonal matrix Q is formed from V and T.
188 *>
189 *> If TRANS='N' and SIDE='L', C is on exit replaced with Q * C.
190 *>
191 *> If TRANS='C' and SIDE='L', C is on exit replaced with Q**C * C.
192 *>
193 *> If TRANS='N' and SIDE='R', C is on exit replaced with C * Q.
194 *>
195 *> If TRANS='C' and SIDE='R', C is on exit replaced with C * Q**C.
196 *> \endverbatim
197 *>
198 * =====================================================================
199  SUBROUTINE ctpmlqt( SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT,
200  $ a, lda, b, ldb, work, info )
201 *
202 * -- LAPACK computational routine (version 3.7.0) --
203 * -- LAPACK is a software package provided by Univ. of Tennessee, --
204 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
205 * December 2016
206 *
207 * .. Scalar Arguments ..
208  CHARACTER SIDE, TRANS
209  INTEGER INFO, K, LDV, LDA, LDB, M, N, L, MB, LDT
210 * ..
211 * .. Array Arguments ..
212  COMPLEX V( ldv, * ), A( lda, * ), B( ldb, * ),
213  $ t( ldt, * ), work( * )
214 * ..
215 *
216 * =====================================================================
217 *
218 * ..
219 * .. Local Scalars ..
220  LOGICAL LEFT, RIGHT, TRAN, NOTRAN
221  INTEGER I, IB, NB, LB, KF, LDAQ
222 * ..
223 * .. External Functions ..
224  LOGICAL LSAME
225  EXTERNAL lsame
226 * ..
227 * .. External Subroutines ..
228  EXTERNAL xerbla, ctprfb
229 * ..
230 * .. Intrinsic Functions ..
231  INTRINSIC max, min
232 * ..
233 * .. Executable Statements ..
234 *
235 * .. Test the input arguments ..
236 *
237  info = 0
238  left = lsame( side, 'L' )
239  right = lsame( side, 'R' )
240  tran = lsame( trans, 'C' )
241  notran = lsame( trans, 'N' )
242 *
243  IF ( left ) THEN
244  ldaq = max( 1, k )
245  ELSE IF ( right ) THEN
246  ldaq = max( 1, m )
247  END IF
248  IF( .NOT.left .AND. .NOT.right ) THEN
249  info = -1
250  ELSE IF( .NOT.tran .AND. .NOT.notran ) THEN
251  info = -2
252  ELSE IF( m.LT.0 ) THEN
253  info = -3
254  ELSE IF( n.LT.0 ) THEN
255  info = -4
256  ELSE IF( k.LT.0 ) THEN
257  info = -5
258  ELSE IF( l.LT.0 .OR. l.GT.k ) THEN
259  info = -6
260  ELSE IF( mb.LT.1 .OR. (mb.GT.k .AND. k.GT.0) ) THEN
261  info = -7
262  ELSE IF( ldv.LT.k ) THEN
263  info = -9
264  ELSE IF( ldt.LT.mb ) THEN
265  info = -11
266  ELSE IF( lda.LT.ldaq ) THEN
267  info = -13
268  ELSE IF( ldb.LT.max( 1, m ) ) THEN
269  info = -15
270  END IF
271 *
272  IF( info.NE.0 ) THEN
273  CALL xerbla( 'CTPMLQT', -info )
274  RETURN
275  END IF
276 *
277 * .. Quick return if possible ..
278 *
279  IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 ) RETURN
280 *
281  IF( left .AND. notran ) THEN
282 *
283  DO i = 1, k, mb
284  ib = min( mb, k-i+1 )
285  nb = min( m-l+i+ib-1, m )
286  IF( i.GE.l ) THEN
287  lb = 0
288  ELSE
289  lb = 0
290  END IF
291  CALL ctprfb( 'L', 'C', 'F', 'R', nb, n, ib, lb,
292  $ v( i, 1 ), ldv, t( 1, i ), ldt,
293  $ a( i, 1 ), lda, b, ldb, work, ib )
294  END DO
295 *
296  ELSE IF( right .AND. tran ) THEN
297 *
298  DO i = 1, k, mb
299  ib = min( mb, k-i+1 )
300  nb = min( n-l+i+ib-1, n )
301  IF( i.GE.l ) THEN
302  lb = 0
303  ELSE
304  lb = nb-n+l-i+1
305  END IF
306  CALL ctprfb( 'R', 'N', 'F', 'R', m, nb, ib, lb,
307  $ v( i, 1 ), ldv, t( 1, i ), ldt,
308  $ a( 1, i ), lda, b, ldb, work, m )
309  END DO
310 *
311  ELSE IF( left .AND. tran ) THEN
312 *
313  kf = ((k-1)/mb)*mb+1
314  DO i = kf, 1, -mb
315  ib = min( mb, k-i+1 )
316  nb = min( m-l+i+ib-1, m )
317  IF( i.GE.l ) THEN
318  lb = 0
319  ELSE
320  lb = 0
321  END IF
322  CALL ctprfb( 'L', 'N', 'F', 'R', nb, n, ib, lb,
323  $ v( i, 1 ), ldv, t( 1, i ), ldt,
324  $ a( i, 1 ), lda, b, ldb, work, ib )
325  END DO
326 *
327  ELSE IF( right .AND. notran ) THEN
328 *
329  kf = ((k-1)/mb)*mb+1
330  DO i = kf, 1, -mb
331  ib = min( mb, k-i+1 )
332  nb = min( n-l+i+ib-1, n )
333  IF( i.GE.l ) THEN
334  lb = 0
335  ELSE
336  lb = nb-n+l-i+1
337  END IF
338  CALL ctprfb( 'R', 'C', 'F', 'R', m, nb, ib, lb,
339  $ v( i, 1 ), ldv, t( 1, i ), ldt,
340  $ a( 1, i ), lda, b, ldb, work, m )
341  END DO
342 *
343  END IF
344 *
345  RETURN
346 *
347 * End of CTPMLQT
348 *
349  END
subroutine ctpmlqt(SIDE, TRANS, M, N, K, L, MB, V, LDV, T, LDT, A, LDA, B, LDB, WORK, INFO)
Definition: ctpmlqt.f:201
subroutine ctprfb(SIDE, TRANS, DIRECT, STOREV, M, N, K, L, V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK)
CTPRFB applies a real or complex "triangular-pentagonal" blocked reflector to a real or complex matri...
Definition: ctprfb.f:253
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62