1 SUBROUTINE pcgeqrf( 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, ICOFF, ICTXT, IINFO, IPW, J,
174 $ jb, jn, 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 icoff = mod( ja-1, desca( nb_ ) )
207 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
209 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
211 mp0 = numroc( m+mod( ia-1, desca( mb_ ) ), desca( mb_ ),
212 $ myrow, iarow, nprow )
213 nq0 = numroc( n+icoff, desca( nb_ ), mycol, iacol, npcol )
214 lwmin = desca( nb_ ) * ( mp0 + nq0 + desca( nb_ ) )
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,
'PCGEQRF', -info )
234 ELSE IF( lquery )
THEN
240 IF( m.EQ.0 .OR. n.EQ.0 )
244 ipw = desca( nb_ ) * desca( nb_ ) + 1
245 CALL pb_topget( ictxt,
'Broadcast',
'Rowwise', rowbtop )
246 CALL pb_topget( ictxt,
'Broadcast',
'Columnwise', colbtop )
247 CALL pb_topset( ictxt,
'Broadcast',
'Rowwise',
'I-ring' )
248 CALL pb_topset( ictxt,
'Broadcast',
'Columnwise',
' ' )
252 jn =
min( iceil( ja, desca( nb_ ) ) * desca( nb_ ), ja+k-1 )
257 CALL pcgeqr2( m, jb, a, ia, ja, desca, tau, work, lwork, iinfo )
259 IF( ja+jb.LE.ja+n-1 )
THEN
264 CALL pclarft(
'Forward',
'Columnwise', m, jb, a, ia, ja, desca,
265 $ tau, work, work( ipw ) )
269 CALL pclarfb(
'Left',
'Conjugate transpose',
'Forward',
270 $
'Columnwise', m, n-jb, jb, a, ia, ja, desca,
271 $ work, a, ia, ja+jb, desca, work( ipw ) )
276 DO 10 j = jn+1, ja+k-1, desca( nb_ )
277 jb =
min( k-j+ja, desca( nb_ ) )
283 CALL pcgeqr2( m-j+ja, jb, a, i, j, desca, tau, work, lwork,
286 IF( j+jb.LE.ja+n-1 )
THEN
291 CALL pclarft(
'Forward',
'Columnwise', m-j+ja, jb, a, i, j,
292 $ desca, tau, work, work( ipw ) )
296 CALL pclarfb(
'Left',
'Conjugate transpose',
'Forward',
297 $
'Columnwise', m-j+ja, n-j-jb+ja, jb, a, i, j,
298 $ desca, work, a, i, j+jb, 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 ) )