1 SUBROUTINE pzgerq2( 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 )
170 parameter( one = 1.0d+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,
185 INTEGER INDXG2P, NUMROC
186 EXTERNAL indxg2p, numroc
189 INTRINSIC dble, dcmplx,
max,
min, mod
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 ) = dcmplx( dble( lwmin ) )
217 lquery = ( lwork.EQ.-1 )
218 IF( lwork.LT.lwmin .AND. .NOT.lquery )
224 CALL pxerbla( ictxt,
'PZGERQ2', -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 pzlacgv( n-k+j-ja+1, a, i+m-k, ja, desca, desca( m_ ) )
249 CALL pzlarfg( n-k+j-ja+1, aii, i+m-k, j+n-k, a, i+m-k, ja,
250 $ desca, desca( m_ ), tau )
254 CALL pzelset( a, i+m-k, j+n-k, desca, one )
255 CALL pzlarf(
'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 pzelset( a, i+m-k, j+n-k, desca, aii )
258 CALL pzlacgv( 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 ) = dcmplx( dble( lwmin ) )