1 SUBROUTINE pcgebrd( M, N, A, IA, JA, DESCA, D, E, TAUQ, TAUP,
10 INTEGER IA, INFO, JA, LWORK, M, N
15 COMPLEX A( * ), TAUP( * ), TAUQ( * ), WORK( * )
241 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
242 $ lld_, mb_, m_, nb_, n_, rsrc_
243 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
244 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
245 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
247 parameter( one = ( 1.0e+0, 0.0e+0 ) )
251 CHARACTER COLCTOP, ROWCTOP
252 INTEGER I, IACOL, IAROW, ICTXT, IINFO, IOFF, IPW, IPY,
253 $ iw, j, jb, js, jw, k, l, lwmin, mn, mp, mycol,
254 $ myrow, nb, npcol, nprow, nq
257 INTEGER DESCWX( DLEN_ ), DESCWY( DLEN_ ), IDUM1( 1 ),
263 $ pb_topget, pb_topset,
pxerbla
266 INTEGER INDXG2L, INDXG2P, NUMROC
267 EXTERNAL indxg2l, indxg2p, numroc
276 ictxt = desca( ctxt_ )
277 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
282 IF( nprow.EQ.-1 )
THEN
285 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
288 ioff = mod( ia-1, desca( mb_ ) )
289 iarow = indxg2p( ia, nb, myrow, desca( rsrc_ ), nprow )
290 iacol = indxg2p( ja, nb, mycol, desca( csrc_ ), npcol )
291 mp = numroc( m+ioff, nb, myrow, iarow, nprow )
292 nq = numroc( n+ioff, nb, mycol, iacol, npcol )
293 lwmin = nb*( mp+nq+1 ) + nq
295 work( 1 ) =
cmplx( real( lwmin ) )
296 lquery = ( lwork.EQ.-1 )
297 IF( ioff.NE.mod( ja-1, desca( nb_ ) ) )
THEN
299 ELSE IF( nb.NE.desca( nb_ ) )
THEN
301 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
311 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
316 CALL pxerbla( ictxt,
'PCGEBRD', -info )
318 ELSE IF( lquery )
THEN
330 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
331 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
332 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
333 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
338 CALL descset( descwx, m+ioff, nb, nb, nb, iarow, iacol, ictxt,
340 CALL descset( descwy, nb, n+ioff, nb, nb, iarow, iacol, ictxt,
343 mp = numroc( m+ia-1, nb, myrow, desca( rsrc_ ), nprow )
344 nq = numroc( n+ja-1, nb, mycol, desca( csrc_ ), npcol )
350 DO 10 l = 1, mn+ioff-nb, nb
358 CALL pclabrd( m-k+1, n-k+1, jb, a, i, j, desca, d, e, tauq,
359 $ taup, work, iw, jw, descwx, work( ipy ), iw,
360 $ jw, descwy, work( ipw ) )
365 CALL pcgemm(
'No transpose',
'No transpose', m-k-jb+1,
366 $ n-k-jb+1, jb, -one, a, i+jb, j, desca,
367 $ work( ipy ), iw, jw+jb, descwy, one, a, i+jb,
369 CALL pcgemm(
'No transpose',
'No transpose', m-k-jb+1,
370 $ n-k-jb+1, jb, -one, work, iw+jb, jw, descwx, a, i,
371 $ j+jb, desca, one, a, i+jb, j+jb, desca )
376 js =
min( indxg2l( i+jb-1, nb, 0, desca( rsrc_ ), nprow ),
379 $
CALL pcelset( a, i+jb-1, j+jb, desca,
cmplx( e( js ) ) )
381 js =
min( indxg2l( j+jb-1, nb, 0, desca( csrc_ ), npcol ),
384 $
CALL pcelset( a, i+jb, j+jb-1, desca,
cmplx( e( js ) ) )
391 descwx( m_ ) = descwx( m_ ) - jb
392 descwx( rsrc_ ) = mod( descwx( rsrc_ ) + 1, nprow )
393 descwx( csrc_ ) = mod( descwx( csrc_ ) + 1, npcol )
394 descwy( n_ ) = descwy( n_ ) - jb
395 descwy( rsrc_ ) = mod( descwy( rsrc_ ) + 1, nprow )
396 descwy( csrc_ ) = mod( descwy( csrc_ ) + 1, npcol )
402 CALL pcgebd2( m-k+1, n-k+1, a, ia+k-1, ja+k-1, desca, d, e, tauq,
403 $ taup, work, lwork, iinfo )
405 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
406 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
408 work( 1 ) =
cmplx( real( lwmin ) )