LAPACK 3.12.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches
ctplqt2.f
Go to the documentation of this file.
1*> \brief \b CTPLQT2
2*
3* Definition:
4* ===========
5*
6* SUBROUTINE CTPLQT2( M, N, L, A, LDA, B, LDB, T, LDT, INFO )
7*
8* .. Scalar Arguments ..
9* INTEGER INFO, LDA, LDB, LDT, N, M, L
10* ..
11* .. Array Arguments ..
12* COMPLEX A( LDA, * ), B( LDB, * ), T( LDT, * )
13* ..
14*
15*
16*> \par Purpose:
17* =============
18*>
19*> \verbatim
20*>
21*> CTPLQT2 computes a LQ a factorization of a complex "triangular-pentagonal"
22*> matrix C, which is composed of a triangular block A and pentagonal block B,
23*> using the compact WY representation for Q.
24*> \endverbatim
25*
26* Arguments:
27* ==========
28*
29*> \param[in] M
30*> \verbatim
31*> M is INTEGER
32*> The total number of rows of the matrix B.
33*> M >= 0.
34*> \endverbatim
35*>
36*> \param[in] N
37*> \verbatim
38*> N is INTEGER
39*> The number of columns of the matrix B, and the order of
40*> the triangular matrix A.
41*> N >= 0.
42*> \endverbatim
43*>
44*> \param[in] L
45*> \verbatim
46*> L is INTEGER
47*> The number of rows of the lower trapezoidal part of B.
48*> MIN(M,N) >= L >= 0. See Further Details.
49*> \endverbatim
50*>
51*> \param[in,out] A
52*> \verbatim
53*> A is COMPLEX array, dimension (LDA,M)
54*> On entry, the lower triangular M-by-M matrix A.
55*> On exit, the elements on and below the diagonal of the array
56*> contain the lower triangular matrix L.
57*> \endverbatim
58*>
59*> \param[in] LDA
60*> \verbatim
61*> LDA is INTEGER
62*> The leading dimension of the array A. LDA >= max(1,M).
63*> \endverbatim
64*>
65*> \param[in,out] B
66*> \verbatim
67*> B is COMPLEX array, dimension (LDB,N)
68*> On entry, the pentagonal M-by-N matrix B. The first N-L columns
69*> are rectangular, and the last L columns are lower trapezoidal.
70*> On exit, B contains the pentagonal matrix V. See Further Details.
71*> \endverbatim
72*>
73*> \param[in] LDB
74*> \verbatim
75*> LDB is INTEGER
76*> The leading dimension of the array B. LDB >= max(1,M).
77*> \endverbatim
78*>
79*> \param[out] T
80*> \verbatim
81*> T is COMPLEX array, dimension (LDT,M)
82*> The N-by-N upper triangular factor T of the block reflector.
83*> See Further Details.
84*> \endverbatim
85*>
86*> \param[in] LDT
87*> \verbatim
88*> LDT is INTEGER
89*> The leading dimension of the array T. LDT >= max(1,M)
90*> \endverbatim
91*>
92*> \param[out] INFO
93*> \verbatim
94*> INFO is INTEGER
95*> = 0: successful exit
96*> < 0: if INFO = -i, the i-th argument had an illegal value
97*> \endverbatim
98*
99* Authors:
100* ========
101*
102*> \author Univ. of Tennessee
103*> \author Univ. of California Berkeley
104*> \author Univ. of Colorado Denver
105*> \author NAG Ltd.
106*
107*> \ingroup tplqt2
108*
109*> \par Further Details:
110* =====================
111*>
112*> \verbatim
113*>
114*> The input matrix C is a M-by-(M+N) matrix
115*>
116*> C = [ A ][ B ]
117*>
118*>
119*> where A is an lower triangular M-by-M matrix, and B is M-by-N pentagonal
120*> matrix consisting of a M-by-(N-L) rectangular matrix B1 left of a M-by-L
121*> upper trapezoidal matrix B2:
122*>
123*> B = [ B1 ][ B2 ]
124*> [ B1 ] <- M-by-(N-L) rectangular
125*> [ B2 ] <- M-by-L lower trapezoidal.
126*>
127*> The lower trapezoidal matrix B2 consists of the first L columns of a
128*> N-by-N lower triangular matrix, where 0 <= L <= MIN(M,N). If L=0,
129*> B is rectangular M-by-N; if M=L=N, B is lower triangular.
130*>
131*> The matrix W stores the elementary reflectors H(i) in the i-th row
132*> above the diagonal (of A) in the M-by-(M+N) input matrix C
133*>
134*> C = [ A ][ B ]
135*> [ A ] <- lower triangular M-by-M
136*> [ B ] <- M-by-N pentagonal
137*>
138*> so that W can be represented as
139*>
140*> W = [ I ][ V ]
141*> [ I ] <- identity, M-by-M
142*> [ V ] <- M-by-N, same form as B.
143*>
144*> Thus, all of information needed for W is contained on exit in B, which
145*> we call V above. Note that V has the same form as B; that is,
146*>
147*> W = [ V1 ][ V2 ]
148*> [ V1 ] <- M-by-(N-L) rectangular
149*> [ V2 ] <- M-by-L lower trapezoidal.
150*>
151*> The rows of V represent the vectors which define the H(i)'s.
152*> The (M+N)-by-(M+N) block reflector H is then given by
153*>
154*> H = I - W**T * T * W
155*>
156*> where W^H is the conjugate transpose of W and T is the upper triangular
157*> factor of the block reflector.
158*> \endverbatim
159*>
160* =====================================================================
161 SUBROUTINE ctplqt2( M, N, L, A, LDA, B, LDB, T, LDT, INFO )
162*
163* -- LAPACK computational routine --
164* -- LAPACK is a software package provided by Univ. of Tennessee, --
165* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
166*
167* .. Scalar Arguments ..
168 INTEGER INFO, LDA, LDB, LDT, N, M, L
169* ..
170* .. Array Arguments ..
171 COMPLEX A( LDA, * ), B( LDB, * ), T( LDT, * )
172* ..
173*
174* =====================================================================
175*
176* .. Parameters ..
177 COMPLEX ONE, ZERO
178 parameter( zero = ( 0.0e+0, 0.0e+0 ),one = ( 1.0e+0, 0.0e+0 ) )
179* ..
180* .. Local Scalars ..
181 INTEGER I, J, P, MP, NP
182 COMPLEX ALPHA
183* ..
184* .. External Subroutines ..
185 EXTERNAL clarfg, cgemv, cgerc, ctrmv, xerbla
186* ..
187* .. Intrinsic Functions ..
188 INTRINSIC max, min
189* ..
190* .. Executable Statements ..
191*
192* Test the input arguments
193*
194 info = 0
195 IF( m.LT.0 ) THEN
196 info = -1
197 ELSE IF( n.LT.0 ) THEN
198 info = -2
199 ELSE IF( l.LT.0 .OR. l.GT.min(m,n) ) THEN
200 info = -3
201 ELSE IF( lda.LT.max( 1, m ) ) THEN
202 info = -5
203 ELSE IF( ldb.LT.max( 1, m ) ) THEN
204 info = -7
205 ELSE IF( ldt.LT.max( 1, m ) ) THEN
206 info = -9
207 END IF
208 IF( info.NE.0 ) THEN
209 CALL xerbla( 'CTPLQT2', -info )
210 RETURN
211 END IF
212*
213* Quick return if possible
214*
215 IF( n.EQ.0 .OR. m.EQ.0 ) RETURN
216*
217 DO i = 1, m
218*
219* Generate elementary reflector H(I) to annihilate B(I,:)
220*
221 p = n-l+min( l, i )
222 CALL clarfg( p+1, a( i, i ), b( i, 1 ), ldb, t( 1, i ) )
223 t(1,i)=conjg(t(1,i))
224 IF( i.LT.m ) THEN
225 DO j = 1, p
226 b( i, j ) = conjg(b(i,j))
227 END DO
228*
229* W(M-I:1) := C(I+1:M,I:N) * C(I,I:N) [use W = T(M,:)]
230*
231 DO j = 1, m-i
232 t( m, j ) = (a( i+j, i ))
233 END DO
234 CALL cgemv( 'N', m-i, p, one, b( i+1, 1 ), ldb,
235 \$ b( i, 1 ), ldb, one, t( m, 1 ), ldt )
236*
237* C(I+1:M,I:N) = C(I+1:M,I:N) + alpha * C(I,I:N)*W(M-1:1)^H
238*
239 alpha = -(t( 1, i ))
240 DO j = 1, m-i
241 a( i+j, i ) = a( i+j, i ) + alpha*(t( m, j ))
242 END DO
243 CALL cgerc( m-i, p, (alpha), t( m, 1 ), ldt,
244 \$ b( i, 1 ), ldb, b( i+1, 1 ), ldb )
245 DO j = 1, p
246 b( i, j ) = conjg(b(i,j))
247 END DO
248 END IF
249 END DO
250*
251 DO i = 2, m
252*
253* T(I,1:I-1) := C(I:I-1,1:N)**H * (alpha * C(I,I:N))
254*
255 alpha = -(t( 1, i ))
256 DO j = 1, i-1
257 t( i, j ) = zero
258 END DO
259 p = min( i-1, l )
260 np = min( n-l+1, n )
261 mp = min( p+1, m )
262 DO j = 1, n-l+p
263 b(i,j)=conjg(b(i,j))
264 END DO
265*
266* Triangular part of B2
267*
268 DO j = 1, p
269 t( i, j ) = (alpha*b( i, n-l+j ))
270 END DO
271 CALL ctrmv( 'L', 'N', 'N', p, b( 1, np ), ldb,
272 \$ t( i, 1 ), ldt )
273*
274* Rectangular part of B2
275*
276 CALL cgemv( 'N', i-1-p, l, alpha, b( mp, np ), ldb,
277 \$ b( i, np ), ldb, zero, t( i,mp ), ldt )
278*
279* B1
280
281*
282 CALL cgemv( 'N', i-1, n-l, alpha, b, ldb, b( i, 1 ), ldb,
283 \$ one, t( i, 1 ), ldt )
284*
285
286*
287* T(1:I-1,I) := T(1:I-1,1:I-1) * T(I,1:I-1)
288*
289 DO j = 1, i-1
290 t(i,j)=conjg(t(i,j))
291 END DO
292 CALL ctrmv( 'L', 'C', 'N', i-1, t, ldt, t( i, 1 ), ldt )
293 DO j = 1, i-1
294 t(i,j)=conjg(t(i,j))
295 END DO
296 DO j = 1, n-l+p
297 b(i,j)=conjg(b(i,j))
298 END DO
299*
300* T(I,I) = tau(I)
301*
302 t( i, i ) = t( 1, i )
303 t( 1, i ) = zero
304 END DO
305 DO i=1,m
306 DO j= i+1,m
307 t(i,j)=(t(j,i))
308 t(j,i)=zero
309 END DO
310 END DO
311
312*
313* End of CTPLQT2
314*
315 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
Definition cgemv.f:160
subroutine cgerc(m, n, alpha, x, incx, y, incy, a, lda)
CGERC
Definition cgerc.f:130
subroutine clarfg(n, alpha, x, incx, tau)
CLARFG generates an elementary reflector (Householder matrix).
Definition clarfg.f:106
subroutine ctplqt2(m, n, l, a, lda, b, ldb, t, ldt, info)
CTPLQT2
Definition ctplqt2.f:162
subroutine ctrmv(uplo, trans, diag, n, a, lda, x, incx)
CTRMV
Definition ctrmv.f:147