1 SUBROUTINE pzhetdrv( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, N
15 DOUBLE PRECISION D( * ), E( * )
16 COMPLEX*16 A( * ), TAU( * ), WORK( * )
157 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
158 $ lld_, mb_, m_, nb_, n_, rsrc_
159 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
160 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
161 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
162 DOUBLE PRECISION REIGHT, RONE, RZERO
163 parameter( reight = 8.0d+0, rone = 1.0d+0,
165 COMPLEX*16 HALF, ONE, ZERO
166 parameter( half = ( 0.5d+0, 0.0d+0 ),
167 $ one = ( 1.0d+0, 0.0d+0 ),
168 $ zero = ( 0.0d+0, 0.0d+0 ) )
172 INTEGER I, IACOL, IAROW, ICTXT, II, IPT, IPV, IPX,
173 $ ipy, j, jb, jj, jl, k, mycol, myrow, nb, np,
175 DOUBLE PRECISION ADDBND, D2, E2
179 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCV( DLEN_ ),
184 INTEGER INDXG2P, NUMROC
185 DOUBLE PRECISION PDLAMCH
186 EXTERNAL indxg2p, lsame, numroc, pdlamch
195 INTRINSIC abs, dcmplx,
max,
min, mod
199 ictxt = desca( ctxt_ )
200 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
204 upper = lsame( uplo,
'U' )
205 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
207 np = numroc( n, nb, myrow, iarow, nprow )
214 CALL descset( descd, 1, ja+n-1, 1, desca( nb_ ), myrow,
215 $ desca( csrc_ ), desca( ctxt_ ), 1 )
217 addbnd = reight * pdlamch( ictxt,
'eps' )
221 CALL descset( desce, 1, ja+n-1, 1, desca( nb_ ), myrow,
222 $ desca( csrc_ ), desca( ctxt_ ), 1 )
229 CALL pdelget(
' ',
' ', d2, d, 1, ja+j, descd )
230 CALL pzelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
231 IF( j.LT.(n-1) )
THEN
232 CALL pdelget(
' ',
' ', e2, e, 1, ja+j+1, desce )
233 CALL pzelget(
'Columnwise',
' ', e1, a, ia+j, ja+j+1,
237 IF( ( abs( d1-dcmplx( d2 ) ).GT.( abs( d2 )*addbnd ) ) .OR.
238 $ ( abs( e1-dcmplx( e2 ) ).GT.( abs( e2 )*addbnd ) ) )
244 CALL descset( descv, n, nb, nb, nb, iarow, iacol, ictxt,
246 CALL descset( desct, nb, nb, nb, nb, iarow, iacol, ictxt, nb )
255 CALL pzlarft(
'Backward',
'Columnwise', k+jb-1, jb, a, ia,
256 $ j, desca, tau, work( ipt ), work( ipv ) )
260 CALL pzlacpy(
'All', k+jb-1, jb, a, ia, j, desca,
261 $ work( ipv ), 1, 1, descv )
264 CALL pzlaset(
'Lower', jb+1, jb, zero, one, work( ipv ),
267 CALL pzlaset(
'Lower', jb, jb-1, zero, one, work( ipv ),
269 CALL pzlaset(
'Ge', jb, 1, zero, zero, work( ipv ), 1,
276 CALL pzlaset(
'Ge', k-1, jb, zero, zero, a, ia, j,
278 CALL pzlaset(
'Upper', jb-1, jb-1, zero, zero, a, i-1,
280 ELSE IF( jb.GT.1 )
THEN
281 CALL pzlaset(
'Upper', jb-2, jb-2, zero, zero, a, ia,
287 CALL pzhemm(
'Left',
'Upper', k+jb, jb, one, a, ia, ja,
288 $ desca, work( ipv ), 1, 1, descv, zero,
289 $ work( ipx ), 1, 1, descv )
290 CALL pztrmm(
'Right',
'Lower',
'Conjugate transpose',
291 $
'Non-Unit', k+jb, jb, one, work( ipt ), 1, 1,
292 $ desct, work( ipx ), 1, 1, descv )
296 CALL pzgemm(
'Conjugate transpose',
'No transpose', jb, jb,
297 $ k+jb, one, work( ipv ), 1, 1, descv,
298 $ work( ipx ), 1, 1, descv, zero, work( ipy ),
300 CALL pztrmm(
'Left',
'Lower',
'No transpose',
'Non-Unit',
301 $ jb, jb, one, work( ipt ), 1, 1, desct,
302 $ work( ipy ), 1, 1, desct )
303 CALL pzgemm(
'No tranpose',
'No transpose', k+jb, jb, jb,
304 $ -half, work( ipv ), 1, 1, descv, work( ipy ),
305 $ 1, 1, desct, one, work( ipx ), 1, 1, descv )
309 CALL pzher2k(
'Upper',
'No transpose', k+jb, jb, -one,
310 $ work( ipv ), 1, 1, descv, work( ipx ), 1, 1,
311 $ descv, rone, a, ia, ja, desca )
313 descv( csrc_ ) = mod( descv( csrc_ ) + 1, npcol )
314 desct( csrc_ ) = mod( desct( csrc_ ) + 1, npcol )
320 CALL descset( desce, 1, ja+n-2, 1, desca( nb_ ), myrow,
321 $ desca( csrc_ ), desca( ctxt_ ), 1 )
328 CALL pdelget(
' ',
' ', d2, d, 1, ja+j, descd )
329 CALL pzelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
330 IF( j.LT.(n-1) )
THEN
331 CALL pdelget(
' ',
' ', e2, e, 1, ja+j, desce )
332 CALL pzelget(
'Columnwise',
' ', e1, a, ia+j+1, ja+j,
336 IF( ( abs( d1-dcmplx( d2 ) ).GT.( abs( d2 )*addbnd ) ) .OR.
337 $ ( abs( e1-dcmplx( e2 ) ).GT.( abs( e2 )*addbnd ) ) )
343 jl =
max( ( ( ja+n-2 ) / nb ) * nb + 1, ja )
344 iacol = indxg2p( jl, nb, mycol, desca( csrc_ ), npcol )
345 CALL descset( descv, n, nb, nb, nb, iarow, iacol, ictxt,
347 CALL descset( desct, nb, nb, nb, nb, indxg2p( ia+jl-ja+1, nb,
348 $ myrow, desca( rsrc_ ), nprow ), iacol, ictxt,
351 DO 40 j = jl, ja, -nb
354 jb =
min( n-k+1, nb )
358 CALL pzlarft(
'Forward',
'Columnwise', n-k, jb, a, i+1, j,
359 $ desca, tau, work( ipt ), work( ipv ) )
363 CALL pzlacpy(
'Lower', n-k, jb, a, i+1, j, desca,
364 $ work( ipv ), k+1, 1, descv )
365 CALL pzlaset(
'Upper', n-k, jb, zero, one, work( ipv ),
367 CALL pzlaset(
'Ge', 1, jb, zero, zero, work( ipv ), k, 1,
372 CALL pzlaset(
'Lower', n-k-1, jb, zero, zero, a, i+2, j,
377 CALL pzhemm(
'Left',
'Lower', n-k+1, jb, one, a, i, j,
378 $ desca, work( ipv ), k, 1, descv, zero,
379 $ work( ipx ), k, 1, descv )
380 CALL pztrmm(
'Right',
'Upper',
'Conjugate transpose',
381 $
'Non-Unit', n-k+1, jb, one, work( ipt ), 1, 1,
382 $ desct, work( ipx ), k, 1, descv )
386 CALL pzgemm(
'Conjugate transpose',
'No transpose', jb, jb,
387 $ n-k+1, one, work( ipv ), k, 1, descv,
388 $ work( ipx ), k, 1, descv, zero, work( ipy ),
390 CALL pztrmm(
'Left',
'Upper',
'No transpose',
'Non-Unit',
391 $ jb, jb, one, work( ipt ), 1, 1, desct,
392 $ work( ipy ), 1, 1, desct )
393 CALL pzgemm(
'No transpose',
'No transpose', n-k+1, jb, jb,
394 $ -half, work( ipv ), k, 1, descv, work( ipy ),
395 $ 1, 1, desct, one, work( ipx ), k, 1, descv )
399 CALL pzher2k(
'Lower',
'No tranpose', n-k+1, jb, -one,
400 $ work( ipv ), k, 1, descv, work( ipx ), k, 1,
401 $ descv, rone, a, i, j, desca )
403 descv( csrc_ ) = mod( descv( csrc_ ) + npcol - 1, npcol )
404 desct( rsrc_ ) = mod( desct( rsrc_ ) + nprow - 1, nprow )
405 desct( csrc_ ) = mod( desct( csrc_ ) + npcol - 1, npcol )
411 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )