152 SUBROUTINE sgeqp3( M, N, A, LDA, JPVT, TAU, WORK, LWORK, INFO )
160 INTEGER INFO, LDA, LWORK, M, N
164 REAL A( lda, * ), TAU( * ), WORK( * )
170 INTEGER INB, INBMIN, IXOVER
171 parameter ( inb = 1, inbmin = 2, ixover = 3 )
175 INTEGER FJB, IWS, J, JB, LWKOPT, MINMN, MINWS, NA, NB,
176 $ nbmin, nfxd, nx, sm, sminmn, sn, topbmn
184 EXTERNAL ilaenv, snrm2
187 INTRINSIC int, max, min
192 lquery = ( lwork.EQ.-1 )
195 ELSE IF( n.LT.0 )
THEN
197 ELSE IF( lda.LT.max( 1, m ) )
THEN
203 IF( minmn.EQ.0 )
THEN
208 nb = ilaenv( inb,
'SGEQRF',
' ', m, n, -1, -1 )
209 lwkopt = 2*n + ( n + 1 )*nb
213 IF( ( lwork.LT.iws ) .AND. .NOT.lquery )
THEN
219 CALL xerbla(
'SGEQP3', -info )
221 ELSE IF( lquery )
THEN
229 IF( jpvt( j ).NE.0 )
THEN
231 CALL sswap( m, a( 1, j ), 1, a( 1, nfxd ), 1 )
232 jpvt( j ) = jpvt( nfxd )
253 CALL sgeqrf( m, na, a, lda, tau, work, lwork, info )
254 iws = max( iws, int( work( 1 ) ) )
258 CALL sormqr(
'Left',
'Transpose', m, n-na, na, a, lda, tau,
259 $ a( 1, na+1 ), lda, work, lwork, info )
260 iws = max( iws, int( work( 1 ) ) )
267 IF( nfxd.LT.minmn )
THEN
271 sminmn = minmn - nfxd
275 nb = ilaenv( inb,
'SGEQRF',
' ', sm, sn, -1, -1 )
279 IF( ( nb.GT.1 ) .AND. ( nb.LT.sminmn ) )
THEN
283 nx = max( 0, ilaenv( ixover,
'SGEQRF',
' ', sm, sn, -1,
287 IF( nx.LT.sminmn )
THEN
291 minws = 2*sn + ( sn+1 )*nb
292 iws = max( iws, minws )
293 IF( lwork.LT.minws )
THEN
298 nb = ( lwork-2*sn ) / ( sn+1 )
299 nbmin = max( 2, ilaenv( inbmin,
'SGEQRF',
' ', sm, sn,
310 DO 20 j = nfxd + 1, n
311 work( j ) = snrm2( sm, a( nfxd+1, j ), 1 )
312 work( n+j ) = work( j )
315 IF( ( nb.GE.nbmin ) .AND. ( nb.LT.sminmn ) .AND.
316 $ ( nx.LT.sminmn ) )
THEN
327 IF( j.LE.topbmn )
THEN
328 jb = min( nb, topbmn-j+1 )
332 CALL slaqps( m, n-j+1, j-1, jb, fjb, a( 1, j ), lda,
333 $ jpvt( j ), tau( j ), work( j ), work( n+j ),
334 $ work( 2*n+1 ), work( 2*n+jb+1 ), n-j+1 )
347 $
CALL slaqp2( m, n-j+1, j-1, a( 1, j ), lda, jpvt( j ),
348 $ tau( j ), work( j ), work( n+j ),
subroutine slaqp2(M, N, OFFSET, A, LDA, JPVT, TAU, VN1, VN2, WORK)
SLAQP2 computes a QR factorization with column pivoting of the matrix block.
subroutine sormqr(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
SORMQR
subroutine sgeqrf(M, N, A, LDA, TAU, WORK, LWORK, INFO)
SGEQRF
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine sgeqp3(M, N, A, LDA, JPVT, TAU, WORK, LWORK, INFO)
SGEQP3
subroutine slaqps(M, N, OFFSET, NB, KB, A, LDA, JPVT, TAU, VN1, VN2, AUXV, F, LDF)
SLAQPS computes a step of QR factorization with column pivoting of a real m-by-n matrix A by using BL...
subroutine sswap(N, SX, INCX, SY, INCY)
SSWAP