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