1 SUBROUTINE pzgebd2( M, N, A, IA, JA, DESCA, D, E, TAUQ, TAUP,
10 INTEGER IA, INFO, JA, LWORK, M, N
14 DOUBLE PRECISION D( * ), E( * )
15 COMPLEX*16 A( * ), TAUP( * ), TAUQ( * ), WORK( * )
240 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
241 $ lld_, mb_, m_, nb_, n_, rsrc_
242 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
243 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
244 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
246 parameter( one = ( 1.0d+0, 0.0d+0 ),
247 $ zero = ( 0.0d+0, 0.0d+0 ) )
251 INTEGER I, IACOL, IAROW, ICOFFA, ICTXT, II, IROFFA, J,
252 $ jj, k, lwmin, mpa0, mycol, myrow, npcol, nprow,
257 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ )
267 INTEGER INDXG2P, NUMROC
268 EXTERNAL indxg2p, numroc
271 INTRINSIC dble, dcmplx,
max,
min, mod
277 ictxt = desca( ctxt_ )
278 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
283 IF( nprow.EQ.-1 )
THEN
286 CALL chk1mat( m, 1, n, 2, ia, ja, desca, 6, info )
288 iroffa = mod( ia-1, desca( mb_ ) )
289 icoffa = mod( ja-1, desca( nb_ ) )
290 iarow = indxg2p( ia, desca( mb_ ), myrow, desca( rsrc_ ),
292 iacol = indxg2p( ja, desca( nb_ ), mycol, desca( csrc_ ),
294 mpa0 = numroc( m+iroffa, desca( mb_ ), myrow, iarow, nprow )
295 nqa0 = numroc( n+icoffa, desca( nb_ ), mycol, iacol, npcol )
296 lwmin =
max( mpa0, nqa0 )
298 work( 1 ) = dcmplx( dble( lwmin ) )
299 lquery = ( lwork.EQ.-1 )
300 IF( iroffa.NE.icoffa )
THEN
302 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
304 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
311 CALL pxerbla( ictxt,
'PZGEBD2', -info )
312 CALL blacs_abort( ictxt, 1 )
314 ELSE IF( lquery )
THEN
318 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
321 IF( m.EQ.1 .AND. n.EQ.1 )
THEN
322 IF( mycol.EQ.iacol )
THEN
323 IF( myrow.EQ.iarow )
THEN
324 i = ii+(jj-1)*desca( lld_ )
325 CALL zlarfg( 1, a( i ), a( i ), 1, tauq( jj ) )
326 d( jj ) = dble( a( i ) )
327 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 1, d( jj ),
329 CALL zgebs2d( ictxt,
'Columnwise',
' ', 1, 1, tauq( jj ),
332 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 1, d( jj ),
334 CALL zgebr2d( ictxt,
'Columnwise',
' ', 1, 1, tauq( jj ),
349 CALL descset( descd, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
350 $ desca( csrc_ ), desca( ctxt_ ), 1 )
351 CALL descset( desce, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
352 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
361 CALL pzlarfg( m-k+1, alpha, i, j, a,
min( i+1, m+ia-1 ),
362 $ j, desca, 1, tauq )
363 CALL pdelset( d, 1, j, descd, dble( alpha ) )
364 CALL pzelset( a, i, j, desca, one )
368 CALL pzlarfc(
'Left', m-k+1, n-k, a, i, j, desca, 1, tauq,
369 $ a, i, j+1, desca, work )
370 CALL pzelset( a, i, j, desca, dcmplx( dble( alpha ) ) )
377 CALL pzlacgv( n-k, a, i, j+1, desca, desca( m_ ) )
378 CALL pzlarfg( n-k, alpha, i, j+1, a, i,
379 $
min( j+2, ja+n-1 ), desca, desca( m_ ),
381 CALL pdelset( e, i, 1, desce, dble( alpha ) )
382 CALL pzelset( a, i, j+1, desca, one )
386 CALL pzlarf(
'Right', m-k, n-k, a, i, j+1, desca,
387 $ desca( m_ ), taup, a, i+1, j+1, desca,
389 CALL pzelset( a, i, j+1, desca, dcmplx( dble( alpha ) ) )
390 CALL pzlacgv( n-k, a, i, j+1, desca, desca( m_ ) )
392 CALL pzelset( taup, i, 1, desce, zero )
400 CALL descset( descd, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
401 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
403 CALL descset( desce, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
404 $ desca( csrc_ ), desca( ctxt_ ), 1 )
412 CALL pzlacgv( n-k+1, a, i, j, desca, desca( m_ ) )
413 CALL pzlarfg( n-k+1, alpha, i, j, a, i,
414 $
min( j+1, ja+n-1 ), desca, desca( m_ ), taup )
415 CALL pdelset( d, i, 1, descd, dble( alpha ) )
416 CALL pzelset( a, i, j, desca, one )
420 CALL pzlarf(
'Right', m-k, n-k+1, a, i, j, desca,
421 $ desca( m_ ), taup, a,
min( i+1, ia+m-1 ), j,
423 CALL pzelset( a, i, j, desca, dcmplx( dble( alpha ) ) )
424 CALL pzlacgv( n-k+1, a, i, j, desca, desca( m_ ) )
431 CALL pzlarfg( m-k, alpha, i+1, j, a,
432 $
min( i+2, ia+m-1 ), j, desca, 1, tauq )
433 CALL pdelset( e, 1, j, desce, dble( alpha ) )
434 CALL pzelset( a, i+1, j, desca, one )
438 CALL pzlarfc(
'Left', m-k, n-k, a, i+1, j, desca, 1,
439 $ tauq, a, i+1, j+1, desca, work )
440 CALL pzelset( a, i+1, j, desca, dcmplx( dble( alpha ) ) )
442 CALL pzelset( tauq, 1, j, desce, zero )
447 work( 1 ) = dcmplx( dble( lwmin ) )