1 SUBROUTINE pzgerqf( 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, IB, ICTXT, IINFO, IL, IN, IPW,
174 $ k, lwmin, mp0, mu, mycol, myrow, npcol, nprow,
178 INTEGER IDUM1( 1 ), IDUM2( 1 )
186 INTEGER ICEIL, INDXG2P, NUMROC
187 EXTERNAL iceil, indxg2p, numroc
190 INTRINSIC dble, dcmplx,
max,
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 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
209 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
211 mp0 = numroc( m+mod( ia-1, desca( mb_ ) ), desca( mb_ ),
212 $ myrow, iarow, nprow )
213 nq0 = numroc( n+mod( ja-1, desca( nb_ ) ), desca( nb_ ),
214 $ mycol, iacol, npcol )
215 lwmin = desca( mb_ ) * ( mp0 + nq0 + desca( mb_ ) )
217 work( 1 ) = dcmplx( dble( lwmin ) )
218 lquery = ( lwork.EQ.-1 )
219 IF( lwork.LT.lwmin .AND. .NOT.lquery )
228 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
233 CALL pxerbla( ictxt,
'PZGERQF', -info )
235 ELSE IF( lquery )
THEN
241 IF( m.EQ.0 .OR. n.EQ.0 )
245 ipw = desca( mb_ ) * desca( mb_ ) + 1
246 in =
min( iceil( ia+m-k, desca( mb_ ) ) * desca( mb_ ), ia+m-1 )
247 il =
max( ( (ia+m-2) / desca( mb_ ) ) * desca( mb_ ) + 1, ia )
248 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
249 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
250 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
251 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
253 IF( il.GE.in+1 )
THEN
257 DO 10 i = il, in+1, -desca( mb_ )
258 ib =
min( ia+m-i, desca( mb_ ) )
263 CALL pzgerq2( ib, n-m+i+ib-ia, a, i, ja, desca, tau, work,
271 CALL pzlarft(
'Backward',
'Rowwise', n-m+i+ib-ia, ib, a,
272 $ i, ja, desca, tau, work, work( ipw ) )
277 CALL pzlarfb(
'Right',
'No transpose',
'Backward',
278 $
'Rowwise', i-ia, n-m+i+ib-ia, ib, a, i, ja,
279 $ desca, work, a, ia, ja, desca,
286 nu = n - m + in - ia + 1
297 IF( mu.GT.0 .AND. nu.GT.0 )
298 $
CALL pzgerq2( mu, nu, a, ia, ja, desca, tau, work, lwork,
301 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
302 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
304 work( 1 ) = dcmplx( dble( lwmin ) )