1 SUBROUTINE pchetd2( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, LWORK, N
16 COMPLEX 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 HALF, ONE, ZERO
222 parameter( half = ( 0.5e+0, 0.0e+0 ),
223 $ one = ( 1.0e+0, 0.0e+0 ),
224 $ zero = ( 0.0e+0, 0.0e+0 ) )
227 LOGICAL LQUERY, UPPER
228 INTEGER IACOL, IAROW, ICOFFA, ICTXT, II, IK, IROFFA, J,
229 $ jj, jk, jn, lda, lwmin, mycol, myrow, npcol,
234 EXTERNAL blacs_abort, blacs_gridinfo, caxpy, cgebr2d,
241 EXTERNAL lsame, cdotc
244 INTRINSIC cmplx, real
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 ) =
cmplx( real( 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,
'PCHETD2', -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 ) = real( a( ik ) )
317 alpha = a( ik+jk*lda )
318 CALL clarfg( j, alpha, a( ii+jk*lda ), 1, taui )
319 e( jk+1 ) = real( alpha )
321 IF( taui.NE.zero )
THEN
330 CALL chemv( uplo, j, taui, a( ii+(jj-1)*lda ),
331 $ lda, a( ii+jk*lda ), 1, zero,
336 alpha = -half*taui*cdotc( j, tau( jj ), 1,
337 $ a( ii+jk*lda ), 1 )
338 CALL caxpy( j, alpha, a( ii+jk*lda ), 1,
344 CALL cher2( uplo, j, -one, a( ii+jk*lda ), 1,
345 $ tau( jj ), 1, a( ii+(jj-1)*lda ),
351 a( ik+jk*lda ) =
cmplx( e( jk+1 ) )
352 d( jk+1 ) = real( a( ik+1+jk*lda ) )
353 work( j+1 ) =
cmplx( d( jk+1 ) )
354 work( n+j+1 ) =
cmplx( e( jk+1 ) )
356 work( 2*n+j+1 ) = tau( jk+1 )
359 d( jj ) = real( a( ii+(jj-1)*lda ) )
360 work( 1 ) =
cmplx( d( jj ) )
364 CALL cgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1 )
367 CALL cgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n, work, 1,
371 d( jn ) = real( work( j ) )
372 e( jn ) = real( work( n+j ) )
373 tau( jn ) = work( 2*n+j )
375 d( jj ) = real( work( 1 ) )
383 IF( mycol.EQ.iacol )
THEN
384 IF( myrow.EQ.iarow )
THEN
388 a( ii+(jj-1)*lda ) = real( a( ii+(jj-1)*lda ) )
396 alpha = a( ik+1+(jk-1)*lda )
397 CALL clarfg( n-j, alpha, a( ik+2+(jk-1)*lda ), 1,
399 e( jk ) = real( alpha )
401 IF( taui.NE.zero )
THEN
406 a( ik+1+(jk-1)*lda ) = one
410 CALL chemv( 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*cdotc( n-j, tau( jk ), 1,
417 $ a( ik+1+(jk-1)*lda ), 1 )
418 CALL caxpy( n-j, alpha, a( ik+1+(jk-1)*lda ),
424 CALL cher2( 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 ) =
cmplx( e( jk ) )
434 d( jk ) = real( a( ik+(jk-1)*lda ) )
435 work( j ) =
cmplx( d( jk ) )
436 work( n+j ) =
cmplx( e( jk ) )
438 work( 2*n+j ) = tau( jk )
441 d( jn ) = real( a( ii+n-1+(jn-1)*lda ) )
442 work( n ) =
cmplx( d( jn ) )
446 CALL cgebs2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
450 CALL cgebr2d( ictxt,
'Columnwise',
' ', 1, 3*n-1, work,
454 d( jn ) = real( work( j ) )
455 e( jn ) = real( work( n+j ) )
456 tau( jn ) = work( 2*n+j )
459 d( jn ) = real( work( n ) )
465 work( 1 ) =
cmplx( real( lwmin ) )