1 SUBROUTINE pchetdrv( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, N
16 COMPLEX 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 REAL REIGHT, RONE, RZERO
163 parameter( reight = 8.0e+0, rone = 1.0e+0,
165 COMPLEX HALF, ONE, ZERO
166 parameter( half = ( 0.5e+0, 0.0e+0 ),
167 $ one = ( 1.0e+0, 0.0e+0 ),
168 $ zero = ( 0.0e+0, 0.0e+0 ) )
172 INTEGER I, IACOL, IAROW, ICTXT, II, IPT, IPV, IPX,
173 $ ipy, j, jb, jj, jl, k, mycol, myrow, nb, np,
179 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCV( DLEN_ ),
184 INTEGER INDXG2P, NUMROC
186 EXTERNAL indxg2p, lsame, numroc, pslamch
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 * pslamch( ictxt,
'eps' )
221 CALL descset( desce, 1, ja+n-1, 1, desca( nb_ ), myrow,
222 $ desca( csrc_ ), desca( ctxt_ ), 1 )
229 CALL pselget(
' ',
' ', d2, d, 1, ja+j, descd )
230 CALL pcelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
231 IF( j.LT.(n-1) )
THEN
232 CALL pselget(
' ',
' ', e2, e, 1, ja+j+1, desce )
233 CALL pcelget(
'Columnwise',
' ', e1, a, ia+j, ja+j+1,
237 IF( ( abs( d1 -
cmplx( d2 ) ).GT.( abs( d2 )*addbnd ) ) .OR.
238 $ ( abs( e1 -
cmplx( 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 pclarft(
'Backward',
'Columnwise', k+jb-1, jb, a, ia,
256 $ j, desca, tau, work( ipt ), work( ipv ) )
260 CALL pclacpy(
'All', k+jb-1, jb, a, ia, j, desca,
261 $ work( ipv ), 1, 1, descv )
264 CALL pclaset(
'Lower', jb+1, jb, zero, one, work( ipv ),
267 CALL pclaset(
'Lower', jb, jb-1, zero, one, work( ipv ),
269 CALL pclaset(
'Ge', jb, 1, zero, zero, work( ipv ), 1,
276 CALL pclaset(
'Ge', k-1, jb, zero, zero, a, ia, j,
278 CALL pclaset(
'Upper', jb-1, jb-1, zero, zero, a, i-1,
280 ELSE IF( jb.GT.1 )
THEN
281 CALL pclaset(
'Upper', jb-2, jb-2, zero, zero, a, ia,
287 CALL pchemm(
'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 pctrmm(
'Right',
'Lower',
'Conjugate transpose',
291 $
'Non-Unit', k+jb, jb, one, work( ipt ), 1, 1,
292 $ desct, work( ipx ), 1, 1, descv )
296 CALL pcgemm(
'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 pctrmm(
'Left',
'Lower',
'No transpose',
'Non-Unit',
301 $ jb, jb, one, work( ipt ), 1, 1, desct,
302 $ work( ipy ), 1, 1, desct )
303 CALL pcgemm(
'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 pcher2k(
'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 pselget(
' ',
' ', d2, d, 1, ja+j, descd )
329 CALL pcelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
330 IF( j.LT.(n-1) )
THEN
331 CALL pselget(
' ',
' ', e2, e, 1, ja+j, desce )
332 CALL pcelget(
'Columnwise',
' ', e1, a, ia+j+1, ja+j,
336 IF( ( abs( d1 -
cmplx( d2 ) ).GT.( abs( d2 )*addbnd ) ) .OR.
337 $ ( abs( e1 -
cmplx( 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 pclarft(
'Forward',
'Columnwise', n-k, jb, a, i+1, j,
359 $ desca, tau, work( ipt ), work( ipv ) )
363 CALL pclacpy(
'Lower', n-k, jb, a, i+1, j, desca,
364 $ work( ipv ), k+1, 1, descv )
365 CALL pclaset(
'Upper', n-k, jb, zero, one, work( ipv ),
367 CALL pclaset(
'Ge', 1, jb, zero, zero, work( ipv ), k, 1,
372 CALL pclaset(
'Lower', n-k-1, jb, zero, zero, a, i+2, j,
377 CALL pchemm(
'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 pctrmm(
'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 pcgemm(
'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 pctrmm(
'Left',
'Upper',
'No transpose',
'Non-Unit',
391 $ jb, jb, one, work( ipt ), 1, 1, desct,
392 $ work( ipy ), 1, 1, desct )
393 CALL pcgemm(
'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 pcher2k(
'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 )