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