145 SUBROUTINE zgeqpf( M, N, A, LDA, JPVT, TAU, WORK, RWORK, INFO )
152 INTEGER INFO, LDA, M, N
156 DOUBLE PRECISION RWORK( * )
157 COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
163 DOUBLE PRECISION ZERO, ONE
164 parameter( zero = 0.0d+0, one = 1.0d+0 )
167 INTEGER I, ITEMP, J, MA, MN, PVT
168 DOUBLE PRECISION TEMP, TEMP2, TOL3Z
175 INTRINSIC abs, dcmplx, dconjg, max, min, sqrt
179 DOUBLE PRECISION DLAMCH, DZNRM2
180 EXTERNAL idamax, dlamch, dznrm2
189 ELSE IF( n.LT.0 )
THEN
191 ELSE IF( lda.LT.max( 1, m ) )
THEN
195 CALL xerbla(
'ZGEQPF', -info )
200 tol3z = sqrt(dlamch(
'Epsilon'))
206 IF( jpvt( i ).NE.0 )
THEN
207 IF( i.NE.itemp )
THEN
208 CALL zswap( m, a( 1, i ), 1, a( 1, itemp ), 1 )
209 jpvt( i ) = jpvt( itemp )
223 IF( itemp.GT.0 )
THEN
225 CALL zgeqr2( m, ma, a, lda, tau, work, info )
227 CALL zunm2r(
'Left',
'Conjugate transpose', m, n-ma, ma, a,
228 $ lda, tau, a( 1, ma+1 ), lda, work, info )
232 IF( itemp.LT.mn )
THEN
237 DO 20 i = itemp + 1, n
238 rwork( i ) = dznrm2( m-itemp, a( itemp+1, i ), 1 )
239 rwork( n+i ) = rwork( i )
244 DO 40 i = itemp + 1, mn
248 pvt = ( i-1 ) + idamax( n-i+1, rwork( i ), 1 )
251 CALL zswap( m, a( 1, pvt ), 1, a( 1, i ), 1 )
253 jpvt( pvt ) = jpvt( i )
255 rwork( pvt ) = rwork( i )
256 rwork( n+pvt ) = rwork( n+i )
262 CALL zlarfg( m-i+1, aii, a( min( i+1, m ), i ), 1,
271 a( i, i ) = dcmplx( one )
272 CALL zlarf(
'Left', m-i+1, n-i, a( i, i ), 1,
273 $ dconjg( tau( i ) ), a( i, i+1 ), lda, work )
280 IF( rwork( j ).NE.zero )
THEN
285 temp = abs( a( i, j ) ) / rwork( j )
286 temp = max( zero, ( one+temp )*( one-temp ) )
287 temp2 = temp*( rwork( j ) / rwork( n+j ) )**2
288 IF( temp2 .LE. tol3z )
THEN
290 rwork( j ) = dznrm2( m-i, a( i+1, j ), 1 )
291 rwork( n+j ) = rwork( j )
297 rwork( j ) = rwork( j )*sqrt( temp )
subroutine zgeqr2(m, n, a, lda, tau, work, info)
ZGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
subroutine zlarf(side, m, n, v, incv, tau, c, ldc, work)
ZLARF applies an elementary reflector to a general rectangular matrix.
subroutine zunm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...