1 SUBROUTINE pdgebd2( 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( * ),
238 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
239 $ lld_, mb_, m_, nb_, n_, rsrc_
240 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
241 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
242 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
243 DOUBLE PRECISION ONE, ZERO
244 parameter( one = 1.0d+0, zero = 0.0d+0 )
248 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, II, IROFFA, J,
249 $ jj, k, lwmin, mpa0, mycol, myrow, npcol, nprow,
251 DOUBLE PRECISION ALPHA
254 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ )
258 $ dgebr2d, dgebs2d, dlarfg,
infog2l,
262 INTEGER INDXG2P, NUMROC
263 EXTERNAL indxg2p, numroc
266 INTRINSIC dble,
max,
min, mod
272 ictxt = desca( ctxt_ )
273 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
278 IF( nprow.EQ.-1 )
THEN
281 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
283 iroffa = mod( ia-1, desca( mb_ ) )
284 icoffa = mod( ja-1, desca( nb_ ) )
285 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
287 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
289 mpa0 = numroc( m+iroffa, desca( mb_ ), myrow, iarow, nprow )
290 nqa0 = numroc( n+icoffa, desca( nb_ ), mycol, iacol, npcol )
291 lwmin =
max( mpa0, nqa0 )
293 work( 1 ) = dble( lwmin )
294 lquery = ( lwork.EQ.-1 )
295 IF( iroffa.NE.icoffa )
THEN
297 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
299 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
306 CALL pxerbla( ictxt,
'PDGEBD2', -info )
307 CALL blacs_abort( ictxt, 1 )
309 ELSE IF( lquery )
THEN
313 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
316 IF( m.EQ.1 .AND. n.EQ.1 )
THEN
317 IF( mycol.EQ.iacol )
THEN
318 IF( myrow.EQ.iarow )
THEN
319 i = ii+(jj-1)*desca( lld_ )
320 CALL dlarfg( 1, a( i ), a( i ), 1, tauq( jj ) )
322 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 1, d( jj ),
324 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 1, tauq( jj ),
327 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 1, d( jj ),
329 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 1, tauq( jj ),
344 CALL descset( descd, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
345 $ desca( csrc_ ), desca( ctxt_ ), 1 )
346 CALL descset( desce, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
347 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
356 CALL pdlarfg( m-k+1, alpha, i, j, a,
min( i+1, m+ia-1 ),
357 $ j, desca, 1, tauq )
358 CALL pdelset( d, 1, j, descd, alpha )
359 CALL pdelset( a, i, j, desca, one )
363 CALL pdlarf(
'Left', m-k+1, n-k, a, i, j, desca, 1, tauq, a,
364 $ i, j+1, desca, work )
365 CALL pdelset( a, i, j, desca, alpha )
372 CALL pdlarfg( n-k, alpha, i, j+1, a, i,
373 $
min( j+2, ja+n-1 ), desca, desca( m_ ),
375 CALL pdelset( e, i, 1, desce, alpha )
376 CALL pdelset( a, i, j+1, desca, one )
380 CALL pdlarf(
'Right', m-k, n-k, a, i, j+1, desca,
381 $ desca( m_ ), taup, a, i+1, j+1, desca,
383 CALL pdelset( a, i, j+1, desca, alpha )
385 CALL pdelset( taup, i, 1, desce, zero )
393 CALL descset( descd, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
394 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
396 CALL descset( desce, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
397 $ desca( csrc_ ), desca( ctxt_ ), 1 )
405 CALL pdlarfg( n-k+1, alpha, i, j, a, i,
406 $
min( j+1, ja+n-1 ), desca, desca( m_ ), taup )
407 CALL pdelset( d, i, 1, descd, alpha )
408 CALL pdelset( a, i, j, desca, one )
412 CALL pdlarf(
'Right', m-k, n-k+1, a, i, j, desca,
413 $ desca( m_ ), taup, a,
min( i+1, ia+m-1 ), j,
415 CALL pdelset( a, i, j, desca, alpha )
422 CALL pdlarfg( m-k, alpha, i+1, j, a,
423 $
min( i+2, ia+m-1 ), j, desca, 1, tauq )
424 CALL pdelset( e, 1, j, desce, alpha )
425 CALL pdelset( a, i+1, j, desca, one )
429 CALL pdlarf(
'Left', m-k, n-k, a, i+1, j, desca, 1, tauq,
430 $ a, i+1, j+1, desca, work )
431 CALL pdelset( a, i+1, j, desca, alpha )
433 CALL pdelset( tauq, 1, j, desce, zero )
438 work( 1 ) = dble( lwmin )