127 SUBROUTINE cungqr( M, N, K, A, LDA, TAU, WORK, LWORK, INFO )
134 INTEGER INFO, K, LDA, LWORK, M, N
137 COMPLEX A( LDA, * ), TAU( * ), WORK( * )
144 parameter( zero = ( 0.0e+0, 0.0e+0 ) )
148 INTEGER I, IB, IINFO, IWS, J, KI, KK, L, LDWORK,
149 $ LWKOPT, NB, NBMIN, NX
160 EXTERNAL ilaenv, sroundup_lwork
167 nb = ilaenv( 1,
'CUNGQR',
' ', m, n, k, -1 )
168 lwkopt = max( 1, n )*nb
169 work( 1 ) = sroundup_lwork(lwkopt)
170 lquery = ( lwork.EQ.-1 )
173 ELSE IF( n.LT.0 .OR. n.GT.m )
THEN
175 ELSE IF( k.LT.0 .OR. k.GT.n )
THEN
177 ELSE IF( lda.LT.max( 1, m ) )
THEN
179 ELSE IF( lwork.LT.max( 1, n ) .AND. .NOT.lquery )
THEN
183 CALL xerbla(
'CUNGQR', -info )
185 ELSE IF( lquery )
THEN
199 IF( nb.GT.1 .AND. nb.LT.k )
THEN
203 nx = max( 0, ilaenv( 3,
'CUNGQR',
' ', m, n, k, -1 ) )
210 IF( lwork.LT.iws )
THEN
216 nbmin = max( 2, ilaenv( 2,
'CUNGQR',
' ', m, n, k, -1 ) )
221 IF( nb.GE.nbmin .AND. nb.LT.k .AND. nx.LT.k )
THEN
226 ki = ( ( k-nx-1 ) / nb )*nb
243 $
CALL cung2r( m-kk, n-kk, k-kk, a( kk+1, kk+1 ), lda,
244 $ tau( kk+1 ), work, iinfo )
250 DO 50 i = ki + 1, 1, -nb
251 ib = min( nb, k-i+1 )
257 CALL clarft(
'Forward',
'Columnwise', m-i+1, ib,
258 $ a( i, i ), lda, tau( i ), work, ldwork )
262 CALL clarfb(
'Left',
'No transpose',
'Forward',
263 $
'Columnwise', m-i+1, n-i-ib+1, ib,
264 $ a( i, i ), lda, work, ldwork, a( i, i+ib ),
265 $ lda, work( ib+1 ), ldwork )
270 CALL cung2r( m-i+1, ib, ib, a( i, i ), lda, tau( i ), work,
275 DO 40 j = i, i + ib - 1
283 work( 1 ) = sroundup_lwork(iws)
subroutine xerbla(srname, info)
subroutine clarfb(side, trans, direct, storev, m, n, k, v, ldv, t, ldt, c, ldc, work, ldwork)
CLARFB applies a block reflector or its conjugate-transpose to a general rectangular matrix.
subroutine clarft(direct, storev, n, k, v, ldv, tau, t, ldt)
CLARFT forms the triangular factor T of a block reflector H = I - vtvH
subroutine cung2r(m, n, k, a, lda, tau, work, info)
CUNG2R
subroutine cungqr(m, n, k, a, lda, tau, work, lwork, info)
CUNGQR