1 SUBROUTINE pzgelq2( 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, 0.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,
'PZGELQ2', -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',
'I-ring' )
248 CALL pzlacgv( n-j+ja, a, i, j, desca, desca( m_ ) )
249 CALL pzlarfg( n-j+ja, aii, i, j, a, i,
min( j+1, ja+n-1 ),
250 $ desca, desca( m_ ), tau )
252 IF( i.LT.ia+m-1 )
THEN
256 CALL pzelset( a, i, j, desca, one )
257 CALL pzlarf(
'Right', m-i+ia-1, n-j+ja, a, i, j, desca,
258 $ desca( m_ ), tau, a, i+1, j, desca, work )
260 CALL pzelset( a, i, j, desca, aii )
261 CALL pzlacgv( n-j+ja, a, i, j, desca, desca( m_ ) )
265 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
266 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
268 work( 1 ) = dcmplx( dble( lwmin ) )