1 SUBROUTINE pdgebrd( M, N, A, IA, JA, DESCA, D, E, TAUQ, TAUP,
10 INTEGER IA, INFO, JA, LWORK, M, N
14 DOUBLE PRECISION A( * ), D( * ), E( * ), TAUP( * ), TAUQ( * ),
239 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
240 $ lld_, mb_, m_, nb_, n_, rsrc_
241 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
242 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
243 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
245 parameter( one = 1.0d+0 )
249 CHARACTER COLCTOP, ROWCTOP
250 INTEGER I, IACOL, IAROW, ICTXT, IINFO, IOFF, IPW, IPY,
251 $ iw, j, jb, js, jw, k, l, lwmin, mn, mp, mycol,
252 $ myrow, nb, npcol, nprow, nq
255 INTEGER DESCWX( DLEN_ ), DESCWY( DLEN_ ), IDUM1( 1 ),
261 $ pb_topget, pb_topset,
pxerbla
264 INTEGER INDXG2L, INDXG2P, NUMROC
265 EXTERNAL indxg2l, indxg2p, numroc
268 INTRINSIC dble,
max,
min, mod
274 ictxt = desca( ctxt_ )
275 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
280 IF( nprow.EQ.-1 )
THEN
283 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
286 ioff = mod( ia-1, desca( mb_ ) )
287 iarow = indxg2p( ia, nb, myrow, desca( rsrc_ ), nprow )
288 iacol = indxg2p( ja, nb, mycol, desca( csrc_ ), npcol )
289 mp = numroc( m+ioff, nb, myrow, iarow, nprow )
290 nq = numroc( n+ioff, nb, mycol, iacol, npcol )
291 lwmin = nb*( mp+nq+1 ) + nq
293 work( 1 ) = dble( lwmin )
294 lquery = ( lwork.EQ.-1 )
295 IF( ioff.NE.mod( ja-1, desca( nb_ ) ) )
THEN
297 ELSE IF( nb.NE.desca( nb_ ) )
THEN
299 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
309 CALL pchk1mat( m, 1, n, 2, ia, ja, desca, 6, 1, idum1, idum2,
314 CALL pxerbla( ictxt,
'PDGEBRD', -info )
316 ELSE IF( lquery )
THEN
328 CALL pb_topget( ictxt,
'Combine',
'Columnwise', colctop )
329 CALL pb_topget( ictxt,
'Combine',
'Rowwise', rowctop )
330 CALL pb_topset( ictxt,
'Combine',
'Columnwise',
'1-tree' )
331 CALL pb_topset( ictxt,
'Combine',
'Rowwise',
'1-tree' )
336 CALL descset( descwx, m+ioff, nb, nb, nb, iarow, iacol, ictxt,
338 CALL descset( descwy, nb, n+ioff, nb, nb, iarow, iacol, ictxt,
341 mp = numroc( m+ia-1, nb, myrow, desca( rsrc_ ), nprow )
342 nq = numroc( n+ja-1, nb, mycol, desca( csrc_ ), npcol )
348 DO 10 l = 1, mn+ioff-nb, nb
356 CALL pdlabrd( m-k+1, n-k+1, jb, a, i, j, desca, d, e, tauq,
357 $ taup, work, iw, jw, descwx, work( ipy ), iw,
358 $ jw, descwy, work( ipw ) )
363 CALL pdgemm(
'No transpose',
'No transpose', m-k-jb+1,
364 $ n-k-jb+1, jb, -one, a, i+jb, j, desca,
365 $ work( ipy ), iw, jw+jb, descwy, one, a, i+jb,
367 CALL pdgemm(
'No transpose',
'No transpose', m-k-jb+1,
368 $ n-k-jb+1, jb, -one, work, iw+jb, jw, descwx, a, i,
369 $ j+jb, desca, one, a, i+jb, j+jb, desca )
374 js =
min( indxg2l( i+jb-1, nb, 0, desca( rsrc_ ), nprow ),
377 $
CALL pdelset( a, i+jb-1, j+jb, desca, e( js ) )
379 js =
min( indxg2l( j+jb-1, nb, 0, desca( csrc_ ), npcol ),
382 $
CALL pdelset( a, i+jb, j+jb-1, desca, e( js ) )
389 descwx( m_ ) = descwx( m_ ) - jb
390 descwx( rsrc_ ) = mod( descwx( rsrc_ ) + 1, nprow )
391 descwx( csrc_ ) = mod( descwx( csrc_ ) + 1, npcol )
392 descwy( n_ ) = descwy( n_ ) - jb
393 descwy( rsrc_ ) = mod( descwy( rsrc_ ) + 1, nprow )
394 descwy( csrc_ ) = mod( descwy( csrc_ ) + 1, npcol )
400 CALL pdgebd2( m-k+1, n-k+1, a, ia+k-1, ja+k-1, desca, d, e, tauq,
401 $ taup, work, lwork, iinfo )
403 CALL pb_topset( ictxt,
'Combine',
'Columnwise', colctop )
404 CALL pb_topset( ictxt,
'Combine',
'Rowwise', rowctop )
406 work( 1 ) = dble( lwmin )