127 SUBROUTINE sorgqr( M, N, K, A, LDA, TAU, WORK, LWORK, INFO )
134 INTEGER INFO, K, LDA, LWORK, M, N
137 REAL A( LDA, * ), TAU( * ), WORK( * )
144 parameter( zero = 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,
'SORGQR',
' ', 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(
'SORGQR', -info )
185 ELSE IF( lquery )
THEN
199 IF( nb.GT.1 .AND. nb.LT.k )
THEN
203 nx = max( 0, ilaenv( 3,
'SORGQR',
' ', m, n, k, -1 ) )
210 IF( lwork.LT.iws )
THEN
216 nbmin = max( 2, ilaenv( 2,
'SORGQR',
' ', 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 sorg2r( 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 slarft(
'Forward',
'Columnwise', m-i+1, ib,
258 $ a( i, i ), lda, tau( i ), work, ldwork )
262 CALL slarfb(
'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 sorg2r( 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 slarfb(side, trans, direct, storev, m, n, k, v, ldv, t, ldt, c, ldc, work, ldwork)
SLARFB applies a block reflector or its transpose to a general rectangular matrix.
subroutine slarft(direct, storev, n, k, v, ldv, tau, t, ldt)
SLARFT forms the triangular factor T of a block reflector H = I - vtvH
subroutine sorg2r(m, n, k, a, lda, tau, work, info)
SORG2R generates all or part of the orthogonal matrix Q from a QR factorization determined by sgeqrf ...
subroutine sorgqr(m, n, k, a, lda, tau, work, lwork, info)
SORGQR