1 SUBROUTINE pzgeqrf( M, N, A, IA, JA, DESCA, TAU, WORK, LWORK,
10 INTEGER IA, INFO, JA, LWORK, M, N
14 COMPLEX*16 A( * ), TAU( * ), WORK( * )
164 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
165 $ lld_, mb_, m_, nb_, n_, rsrc_
166 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
167 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
168 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
172 CHARACTER COLBTOP, ROWBTOP
173 INTEGER I, IACOL, IAROW, ICOFF, ICTXT, IINFO, IPW, J,
174 $ jb, jn, k, lwmin, mp0, mycol, myrow, npcol,
178 INTEGER IDUM1( 1 ), IDUM2( 1 )
186 INTEGER ICEIL, INDXG2P, NUMROC
187 EXTERNAL iceil, indxg2p, numroc
190 INTRINSIC dble, dcmplx,
min, mod
196 ictxt = desca( ctxt_ )
197 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
202 IF( nprow.EQ.-1 )
THEN
205 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
207 icoff = mod( ja-1, desca( nb_ ) )
208 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
210 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
212 mp0 = numroc( m+mod( ia-1, desca( mb_ ) ), desca( mb_ ),
213 $ myrow, iarow, nprow )
214 nq0 = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
215 lwmin = desca( nb_ ) * ( mp0 + nq0 + desca( nb_ ) )
217 work( 1 ) = dcmplx( dble( lwmin ) )
218 lquery = ( lwork.EQ.-1 )
219 IF( lwork.LT.lwmin .AND. .NOT.lquery )
222 IF( lwork.EQ.-1 )
THEN
228 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
233 CALL pxerbla( ictxt,
'PZGEQRF', -info )
235 ELSE IF( lquery )
THEN
241 IF( m.EQ.0 .OR. n.EQ.0 )
245 ipw = desca( nb_ ) * desca( nb_ ) + 1
246 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
247 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
248 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
'I-ring' )
249 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
' ' )
253 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+k-1 )
258 CALL pzgeqr2( m, jb, a, ia, ja, desca, tau, work, lwork, iinfo )
260 IF( ja+jb.LE.ja+n-1 )
THEN
265 CALL pzlarft(
'Forward',
'Columnwise', m, jb, a, ia, ja, desca,
266 $ tau, work, work( ipw ) )
270 CALL pzlarfb(
'Left',
'Conjugate transpose',
'Forward',
271 $
'Columnwise', m, n-jb, jb, a, ia, ja, desca,
272 $ work, a, ia, ja+jb, desca, work( ipw ) )
277 DO 10 j = jn+1, ja+k-1, desca( nb_ )
278 jb =
min( k-j+ja, desca( nb_ ) )
284 CALL pzgeqr2( m-j+ja, jb, a, i, j, desca, tau, work, lwork,
287 IF( j+jb.LE.ja+n-1 )
THEN
292 CALL pzlarft(
'Forward',
'Columnwise', m-j+ja, jb, a, i, j,
293 $ desca, tau, work, work( ipw ) )
297 CALL pzlarfb(
'Left',
'Conjugate transpose',
'Forward',
298 $
'Columnwise', m-j+ja, n-j-jb+ja, jb, a, i, j,
299 $ desca, work, a, i, j+jb, desca, work( ipw ) )
304 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
305 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
307 work( 1 ) = dcmplx( dble( lwmin ) )