1 SUBROUTINE pzhetd2( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, LWORK, N
15 DOUBLE PRECISION D( * ), E( * )
16 COMPLEX*16 A( * ), TAU( * ), WORK( * )
216 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
217 $ lld_, mb_, m_, nb_, n_, rsrc_
218 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
219 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
220 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
221 COMPLEX*16 HALF, ONE, ZERO
222 parameter( half = ( 0.5d+0, 0.0d+0 ),
223 $ one = ( 1.0d+0, 0.0d+0 ),
224 $ zero = ( 0.0d+0, 0.0d+0 ) )
227 LOGICAL LQUERY, UPPER
228 INTEGER IACOL, IAROW, ICOFFA, ICTXT, II, IK, IROFFA, J,
229 $ jj, jk, jn, lda, lwmin, mycol, myrow, npcol,
231 COMPLEX*16 ALPHA, TAUI
235 $
pxerbla, zaxpy, zgebr2d, zgebs2d,
236 $ zhemv, zher2, zlarfg
241 EXTERNAL lsame, zdotc
244 INTRINSIC dble, dcmplx
250 ictxt = desca( ctxt_ )
251 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
256 IF( nprow.EQ.-1 )
THEN
259 upper = lsame( uplo,
'U' )
260 CALL chk1mat( n, 2, n, 2, ia, ja, desca, 6, info )
263 work( 1 ) = dcmplx( dble( lwmin ) )
264 lquery = ( lwork.EQ.-1 )
266 iroffa = mod( ia-1, desca( mb_ ) )
267 icoffa = mod( ja-1, desca( nb_ ) )
268 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
270 ELSE IF( iroffa.NE.icoffa )
THEN
272 ELSE IF( desca( mb_ ).NE.desca( nb_ ) )
THEN
274 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery )
THEN
281 CALL pxerbla( ictxt,
'PZHETD2', -info )
282 CALL blacs_abort( ictxt, 1 )
284 ELSE IF( lquery )
THEN
296 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
303 IF( mycol.EQ.iacol )
THEN
304 IF( myrow.EQ.iarow )
THEN
308 ik = ii+n-1+(jj+n-2)*lda
309 a( ik ) = dble( a( ik ) )
317 alpha = a( ik+jk*lda )
318 CALL zlarfg( j, alpha, a( ii+jk*lda ), 1, taui )
319 e( jk+1 ) = dble( alpha )
321 IF( taui.NE.zero )
THEN
330 CALL zhemv( uplo, j, taui, a( ii+(jj-1)*lda ),
331 $ lda, a( ii+jk*lda ), 1, zero,
336 alpha = -half*taui*zdotc( j, tau( jj ), 1,
337 $ a( ii+jk*lda ), 1 )
338 CALL zaxpy( j, alpha, a( ii+jk*lda ), 1,
344 CALL zher2( uplo, j, -one, a( ii+jk*lda ), 1,
345 $ tau( jj ), 1, a( ii+(jj-1)*lda ),
351 a( ik+jk*lda ) = dcmplx( e( jk+1 ) )
352 d( jk+1 ) = dble( a( ik+1+jk*lda ) )
353 work( j+1 ) = dcmplx( d( jk+1 ) )
354 work( n+j+1 ) = dcmplx( e( jk+1 ) )
356 work( 2*n+j+1 ) = tau( jk+1 )
359 d( jj ) = dble( a( ii+(jj-1)*lda ) )
360 work( 1 ) = dcmplx( d( jj ) )
364 CALL zgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1 )
367 CALL zgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1,
371 d( jn ) = dble( work( j ) )
372 e( jn ) = dble( work( n+j ) )
373 tau( jn ) = work( 2*n+j )
375 d( jj ) = dble( work( 1 ) )
383 IF( mycol.EQ.iacol )
THEN
384 IF( myrow.EQ.iarow )
THEN
388 a( ii+(jj-1)*lda ) = dble( a( ii+(jj-1)*lda ) )
396 alpha = a( ik+1+(jk-1)*lda )
397 CALL zlarfg( n-j, alpha, a( ik+2+(jk-1)*lda ), 1,
399 e( jk ) = dble( alpha )
401 IF( taui.NE.zero )
THEN
406 a( ik+1+(jk-1)*lda ) = one
410 CALL zhemv( uplo, n-j, taui, a( ik+1+jk*lda ),
411 $ lda, a( ik+1+(jk-1)*lda ), 1,
412 $ zero, tau( jk ), 1 )
416 alpha = -half*taui*zdotc( n-j, tau( jk ), 1,
417 $ a( ik+1+(jk-1)*lda ), 1 )
418 CALL zaxpy( n-j, alpha, a( ik+1+(jk-1)*lda ),
424 CALL zher2( uplo, n-j, -one,
425 $ a( ik+1+(jk-1)*lda ), 1,
426 $ tau( jk ), 1, a( ik+1+jk*lda ),
433 a( ik+1+(jk-1)*lda ) = dcmplx( e( jk ) )
434 d( jk ) = dble( a( ik+(jk-1)*lda ) )
435 work( j ) = dcmplx( d( jk ) )
436 work( n+j ) = dcmplx( e( jk ) )
438 work( 2*n+j ) = tau( jk )
441 d( jn ) = dble( a( ii+n-1+(jn-1)*lda ) )
442 work( n ) = dcmplx( d( jn ) )
446 CALL zgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
450 CALL zgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
454 d( jn ) = dble( work( j ) )
455 e( jn ) = dble( work( n+j ) )
456 tau( jn ) = work( 2*n+j )
459 d( jn ) = dble( work( n ) )
465 work( 1 ) = dcmplx( dble( lwmin ) )