1 SUBROUTINE pzgelqf( 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 )
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 )
186 INTEGER ICEIL, INDXG2P, NUMROC
187 EXTERNAL iceil, indxg2p, numroc
190 INTRINSIC dble, dcmplx,
min, mod
196 ictxt = desca( ctxt_ )
197 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
202 IF( nprow.EQ.-1 )
THEN
205 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
207 iroff = mod( ia-1, desca( mb_ ) )
208 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
210 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
212 mp0 = numroc( m+iroff, desca( mb_ ), myrow, iarow, nprow )
213 nq0 = numroc( n+mod( ja-1, desca( nb_ ) ), desca( nb_ ),
214 $ mycol, iacol, npcol )
215 lwmin = desca( mb_ ) * ( mp0 + nq0 + desca( mb_ ) )
217 work( 1 ) = dcmplx( dble( lwmin ) )
218 lquery = ( lwork.EQ.-1 )
219 IF( lwork.LT.lwmin .AND. .NOT.lquery )
222 IF( lwork.EQ.-1 )
THEN
228 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
233 CALL pxerbla( ictxt,
'PZGELQF', -info )
235 ELSE IF( lquery )
THEN
241 IF( m.EQ.0 .OR. n.EQ.0 )
245 ipw = desca( mb_ ) * desca( mb_ ) + 1
246 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
247 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
248 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
' ' )
249 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
'I-ring' )
253 in =
min( iceil( ia, desca( mb_ ) ) * desca( mb_ ), ia+k-1 )
258 CALL pzgelq2( ib, n, a, ia, ja, desca, tau, work, lwork, iinfo )
260 IF( ia+ib.LE.ia+m-1 )
THEN
265 CALL pzlarft(
'Forward',
'Rowwise', n, ib, a, ia, ja, desca,
266 $ tau, work, work( ipw ) )
270 CALL pzlarfb(
'Right',
'No transpose',
'Forward',
'Rowwise',
271 $ m-ib, n, ib, a, ia, ja, desca, work, a, ia+ib,
272 $ ja, desca, work( ipw ) )
277 DO 10 i = in+1, ia+k-1, desca( mb_ )
278 ib =
min( k-i+ia, desca( mb_ ) )
284 CALL pzgelq2( ib, n-i+ia, a, i, j, desca, tau, work, lwork,
287 IF( i+ib.LE.ia+m-1 )
THEN
292 CALL pzlarft(
'Forward',
'Rowwise', n-i+ia, ib, a, i, j,
293 $ desca, tau, work, work( ipw ) )
297 CALL pzlarfb(
'Right',
'No transpose',
'Forward',
'Rowwise',
298 $ m-i-ib+ia, n-j+ja, ib, a, i, j, desca, work,
299 $ a, i+ib, j, desca, work( ipw ) )
304 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise', rowbtop )
305 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise', colbtop )
307 work( 1 ) = dcmplx( dble( lwmin ) )