1 SUBROUTINE pdsytd2( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, LWORK, N
15 DOUBLE PRECISION A( * ), D( * ), E( * ), TAU( * ), WORK( * )
215 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
216 $ lld_, mb_, m_, nb_, n_, rsrc_
217 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
218 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
219 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
220 DOUBLE PRECISION HALF, ONE, ZERO
221 parameter( half = 0.5d+0, one = 1.0d+0, zero = 0.0d+0 )
224 LOGICAL LQUERY, UPPER
225 INTEGER IACOL, IAROW, ICOFFA, ICTXT, II, IK, IROFFA, J,
226 $ jj, jk, jn, lda, lwmin, mycol, myrow, npcol,
228 DOUBLE PRECISION ALPHA, TAUI
231 EXTERNAL blacs_abort, blacs_gridinfo,
chk1mat, daxpy,
232 $ dgebr2d, dgebs2d, dlarfg,
237 DOUBLE PRECISION DDOT
247 ictxt = desca( ctxt_ )
248 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
253 IF( nprow.EQ.-1 )
THEN
256 upper = lsame( uplo,
'U' )
257 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 6, info )
260 work( 1 ) = dble( lwmin )
261 lquery = ( lwork.EQ.-1 )
263 iroffa = mod( ia-1, desca( mb_ ) )
264 icoffa = mod( ja-1, desca( nb_ ) )
265 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
267 ELSE IF( iroffa.NE.icoffa )
THEN
269 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
271 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
278 CALL pxerbla( ictxt,
'PDSYTD2', -info )
279 CALL blacs_abort( ictxt, 1 )
281 ELSE IF( lquery )
THEN
293 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
300 IF( mycol.EQ.iacol )
THEN
301 IF( myrow.EQ.iarow )
THEN
312 CALL dlarfg( j, a( ik+jk*lda ), a( ii+jk*lda ), 1,
314 e( jk+1 ) = a( ik+jk*lda )
316 IF( taui.NE.zero )
THEN
325 CALL dsymv( uplo, j, taui, a( ii+(jj-1)*lda ),
326 $ lda, a( ii+jk*lda ), 1, zero,
331 alpha = -half*taui*ddot( j, tau( jj ), 1,
332 $ a( ii+jk*lda ), 1 )
333 CALL daxpy( j, alpha, a( ii+jk*lda ), 1,
339 CALL dsyr2( uplo, j, -one, a( ii+jk*lda ), 1,
340 $ tau( jj ), 1, a( ii+(jj-1)*lda ),
342 a( ik+jk*lda ) = e( jk+1 )
347 d( jk+1 ) = a( ik+1+jk*lda )
348 work( j+1 ) = d( jk+1 )
349 work( n+j+1 ) = e( jk+1 )
351 work( 2*n+j+1 ) = tau( jk+1 )
354 d( jj ) = a( ii+(jj-1)*lda )
359 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1 )
362 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1,
367 e( jn ) = work( n+j )
368 tau( jn ) = work( 2*n+j )
378 IF( mycol.EQ.iacol )
THEN
379 IF( myrow.EQ.iarow )
THEN
390 CALL dlarfg( n-j, a( ik+1+(jk-1)*lda ),
391 $ a( ik+2+(jk-1)*lda ), 1, taui )
392 e( jk ) = a( ik+1+(jk-1)*lda )
394 IF( taui.NE.zero )
THEN
399 a( ik+1+(jk-1)*lda ) = one
403 CALL dsymv( uplo, n-j, taui, a( ik+1+jk*lda ),
404 $ lda, a( ik+1+(jk-1)*lda ), 1,
405 $ zero, tau( jk ), 1 )
409 alpha = -half*taui*ddot( n-j, tau( jk ), 1,
410 $ a( ik+1+(jk-1)*lda ), 1 )
411 CALL daxpy( n-j, alpha, a( ik+1+(jk-1)*lda ),
417 CALL dsyr2( uplo, n-j, -one,
418 $ a( ik+1+(jk-1)*lda ), 1,
419 $ tau( jk ), 1, a( ik+1+jk*lda ),
421 a( ik+1+(jk-1)*lda ) = e( jk )
427 d( jk ) = a( ik+(jk-1)*lda )
429 work( n+j ) = e( jk )
431 work( 2*n+j ) = tau( jk )
434 d( jn ) = a( ii+n-1+(jn-1)*lda )
439 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
443 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
448 e( jn ) = work( n+j )
449 tau( jn ) = work( 2*n+j )
458 work( 1 ) = dble( lwmin )