1 SUBROUTINE pcgerq2( 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 )
170 parameter( one = 1.0e+0 )
174 CHARACTER COLBTOP, ROWBTOP
175 INTEGER IACOL, IAROW, I, ICTXT, J, K, LWMIN, MP, MYCOL,
176 $ myrow, npcol, nprow, nq
180 EXTERNAL blacs_abort, blacs_gridinfo,
chk1mat,
182 $ pb_topget, pb_topset,
pxerbla
185 INTEGER INDXG2P, NUMROC
186 EXTERNAL 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 mp = numroc( m+mod( ia-1, desca( mb_ ) ), desca( mb_ ),
211 $ myrow, iarow, nprow )
212 nq = numroc( n+mod( ja-1, desca( nb_ ) ), desca( nb_ ),
213 $ mycol, iacol, npcol )
214 lwmin = nq +
max( 1, mp )
216 work( 1 ) =
cmplx( real( lwmin ) )
217 lquery = ( lwork.EQ.-1 )
218 IF( lwork.LT.lwmin .AND. .NOT.lquery )
224 CALL pxerbla( ictxt,
'PCGERQ2', -info )
225 CALL blacs_abort( ictxt, 1 )
227 ELSE IF( lquery )
THEN
233 IF( m.EQ.0 .OR. n.EQ.0 )
236 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
237 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
238 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
239 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'D-ring' )
242 DO 10 i = ia+k-1, ia, -1
248 CALL pclacgv( n-k+j-ja+1, a, i+m-k, ja, desca, desca( m_ ) )
249 CALL pclarfg( n-k+j-ja+1, aii, i+m-k, j+n-k, a, i+m-k, ja,
250 $ desca, desca( m_ ), tau )
254 CALL pcelset( a, i+m-k, j+n-k, desca, one )
255 CALL pclarf(
'Right', m-k+i-ia, n-k+j-ja+1, a, m-k+i, ja,
256 $ desca, desca( m_ ), tau, a, ia, ja, desca, work )
257 CALL pcelset( a, i+m-k, j+n-k, desca, aii )
258 CALL pclacgv( n-k+j-ja+1, a, i+m-k, ja, desca, desca( m_ ) )
262 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
263 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
265 work( 1 ) =
cmplx( real( lwmin ) )