1 SUBROUTINE pcgelqf( 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, IN, IPW,
174 $ iroff, j, k, lwmin, mp0, mycol, myrow, npcol,
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 iroff = mod( ia-1, desca( mb_ ) )
207 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
209 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
211 mp0 = numroc( m+iroff, desca( mb_ ), 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 )
221 IF( lwork.EQ.-1 )
THEN
227 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
232 CALL pxerbla( ictxt,
'PCGELQF', -info )
234 ELSE IF( lquery )
THEN
240 IF( m.EQ.0 .OR. n.EQ.0 )
244 ipw = desca( mb_ ) * desca( mb_ ) + 1
245 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
246 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
247 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
248 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
252 in =
min( iceil( ia, desca( mb_ ) ) * desca( mb_ ), ia+k-1 )
257 CALL pcgelq2( ib, n, a, ia, ja, desca, tau, work, lwork, iinfo )
259 IF( ia+ib.LE.ia+m-1 )
THEN
264 CALL pclarft(
'Forward',
'Rowwise', n, ib, a, ia, ja, desca,
265 $ tau, work, work( ipw ) )
269 CALL pclarfb(
'Right',
'No transpose',
'Forward',
'Rowwise',
270 $ m-ib, n, ib, a, ia, ja, desca, work, a, ia+ib,
271 $ ja, desca, work( ipw ) )
276 DO 10 i = in+1, ia+k-1, desca( mb_ )
277 ib =
min( k-i+ia, desca( mb_ ) )
283 CALL pcgelq2( ib, n-i+ia, a, i, j, desca, tau, work, lwork,
286 IF( i+ib.LE.ia+m-1 )
THEN
291 CALL pclarft(
'Forward',
'Rowwise', n-i+ia, ib, a, i, j,
292 $ desca, tau, work, work( ipw ) )
296 CALL pclarfb(
'Right',
'No transpose',
'Forward',
'Rowwise',
297 $ m-i-ib+ia, n-j+ja, ib, a, i, j, desca, work,
298 $ a, i+ib, j, desca, work( ipw ) )
303 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
304 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
306 work( 1 ) =
cmplx( real( lwmin ) )