1 SUBROUTINE pcgerqf( M, N, A, IA, JA, DESCA, TAU, WORK, LWORK,
10 INTEGER IA, INFO, JA, LWORK, M, N
14 COMPLEX 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 )
185 INTEGER ICEIL, INDXG2P, NUMROC
186 EXTERNAL iceil, indxg2p, numroc
195 ictxt = desca( ctxt_ )
196 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
201 IF( nprow.EQ.-1 )
THEN
204 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
206 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
208 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
210 mp0 = numroc( m+mod( ia-1, desca( mb_ ) ), desca( mb_ ),
211 $ myrow, iarow, nprow )
212 nq0 = numroc( n+mod( ja-1, desca( nb_ ) ), desca( nb_ ),
213 $ mycol, iacol, npcol )
214 lwmin = desca( mb_ ) * ( mp0 + nq0 + desca( mb_ ) )
216 work( 1 ) =
cmplx( real( lwmin ) )
217 lquery = ( lwork.EQ.-1 )
218 IF( lwork.LT.lwmin .AND. .NOT.lquery )
227 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
232 CALL pxerbla( ictxt,
'PCGERQF', -info )
234 ELSE IF( lquery )
THEN
240 IF( m.EQ.0 .OR. n.EQ.0 )
244 ipw = desca( mb_ ) * desca( mb_ ) + 1
245 in =
min( iceil( ia+m-k, desca( mb_ ) ) * desca( mb_ ), ia+m-1 )
246 il =
max( ( (ia+m-2) / desca( mb_ ) ) * desca( mb_ ) + 1, ia )
247 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
248 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
249 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
250 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
252 IF( il.GE.in+1 )
THEN
256 DO 10 i = il, in+1, -desca( mb_ )
257 ib =
min( ia+m-i, desca( mb_ ) )
262 CALL pcgerq2( ib, n-m+i+ib-ia, a, i, ja, desca, tau, work,
270 CALL pclarft(
'Backward',
'Rowwise', n-m+i+ib-ia, ib, a,
271 $ i, ja, desca, tau, work, work( ipw ) )
276 CALL pclarfb(
'Right',
'No transpose',
'Backward',
277 $
'Rowwise', i-ia, n-m+i+ib-ia, ib, a, i, ja,
278 $ desca, work, a, ia, ja, desca,
285 nu = n - m + in - ia + 1
296 IF( mu.GT.0 .AND. nu.GT.0 )
297 $
CALL pcgerq2( mu, nu, a, ia, ja, desca, tau, work, lwork,
300 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
301 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
303 work( 1 ) =
cmplx( real( lwmin ) )