1 SUBROUTINE pdsytdrv( UPLO, N, A, IA, JA, DESCA, D, E, TAU, WORK,
11 INTEGER IA, INFO, JA, N
15 DOUBLE PRECISION A( * ), D( * ), E( * ), TAU( * ), WORK( * )
156 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
157 $ lld_, mb_, m_, nb_, n_, rsrc_
158 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
159 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
160 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
161 DOUBLE PRECISION EIGHT, HALF, ONE, ZERO
162 parameter( eight = 8.0d+0, half = 0.5d+0, one = 1.0d+0,
167 INTEGER I, IACOL, IAROW, ICTXT, II, IPT, IPV, IPX,
168 $ ipy, j, jb, jj, jl, k, mycol, myrow, nb, np,
170 DOUBLE PRECISION ADDBND, D1, D2, E1, E2
173 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCV( DLEN_ ),
178 INTEGER INDXG2P, NUMROC
179 DOUBLE PRECISION PDLAMCH
180 EXTERNAL indxg2p, lsame, numroc, pdlamch
189 INTRINSIC abs,
max,
min, mod
193 ictxt = desca( ctxt_ )
194 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
198 upper = lsame( uplo,
'U' )
199 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
201 np = numroc( n, nb, myrow, iarow, nprow )
208 CALL descset( descd, 1, ja+n-1, 1, desca( nb_ ), myrow,
209 $ desca( csrc_ ), desca( ctxt_ ), 1 )
211 addbnd = eight * pdlamch( ictxt,
'eps' )
215 CALL descset( desce, 1, ja+n-1, 1, desca( nb_ ), myrow,
216 $ desca( csrc_ ), desca( ctxt_ ), 1 )
223 CALL pdelget(
' ',
' ', d2, d, 1, ja+j, descd )
224 CALL pdelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
225 IF( j.LT.(n-1) )
THEN
226 CALL pdelget(
' ',
' ', e2, e, 1, ja+j+1, desce )
227 CALL pdelget(
'Columnwise',
' ', e1, a, ia+j, ja+j+1,
231 IF( ( abs( d1 - d2 ).GT.( abs( d2 ) * addbnd ) ) .OR.
232 $ ( abs( e1 - e2 ).GT.( abs( e2 ) * addbnd ) ) )
238 CALL descset( descv, n, nb, nb, nb, iarow, iacol, ictxt,
240 CALL descset( desct, nb, nb, nb, nb, iarow, iacol, ictxt, nb )
249 CALL pdlarft(
'Backward',
'Columnwise', k+jb-1, jb, a, ia,
250 $ j, desca, tau, work( ipt ), work( ipv ) )
254 CALL pdlacpy(
'All', k+jb-1, jb, a, ia, j, desca,
255 $ work( ipv ), 1, 1, descv )
258 CALL pdlaset(
'Lower', jb+1, jb, zero, one, work( ipv ),
261 CALL pdlaset(
'Lower', jb, jb-1, zero, one, work( ipv ),
263 CALL pdlaset(
'Ge', jb, 1, zero, zero, work( ipv ), 1,
270 CALL pdlaset(
'Ge', k-1, jb, zero, zero, a, ia, j,
272 CALL pdlaset(
'Upper', jb-1, jb-1, zero, zero, a, i-1,
274 ELSE IF( jb.GT.1 )
THEN
275 CALL pdlaset(
'Upper', jb-2, jb-2, zero, zero, a, ia,
281 CALL pdsymm(
'Left',
'Upper', k+jb, jb, one, a, ia, ja,
282 $ desca, work( ipv ), 1, 1, descv, zero,
283 $ work( ipx ), 1, 1, descv )
284 CALL pdtrmm(
'Right',
'Lower',
'Transpose',
'Non-Unit',
285 $ k+jb, jb, one, work( ipt ), 1, 1, desct,
286 $ work( ipx ), 1, 1, descv )
290 CALL pdgemm(
'Transpose',
'No transpose', jb, jb, k+jb, one,
291 $ work( ipv ), 1, 1, descv, work( ipx ), 1, 1,
292 $ descv, zero, work( ipy ), 1, 1, desct )
293 CALL pdtrmm(
'Left',
'Lower',
'No transpose',
'Non-Unit',
294 $ jb, jb, one, work( ipt ), 1, 1, desct,
295 $ work( ipy ), 1, 1, desct )
296 CALL pdgemm(
'No tranpose',
'No transpose', k+jb, jb, jb,
297 $ -half, work( ipv ), 1, 1, descv, work( ipy ),
298 $ 1, 1, desct, one, work( ipx ), 1, 1, descv )
302 CALL pdsyr2k(
'Upper',
'No transpose', k+jb, jb, -one,
303 $ work( ipv ), 1, 1, descv, work( ipx ), 1, 1,
304 $ descv, one, a, ia, ja, desca )
306 descv( csrc_ ) = mod( descv( csrc_ ) + 1, npcol )
307 desct( csrc_ ) = mod( desct( csrc_ ) + 1, npcol )
313 CALL descset( desce, 1, ja+n-2, 1, desca( nb_ ), myrow,
314 $ desca( csrc_ ), desca( ctxt_ ), 1 )
321 CALL pdelget(
' ',
' ', d2, d, 1, ja+j, descd )
322 CALL pdelget(
'Columnwise',
' ', d1, a, ia+j, ja+j, desca )
323 IF( j.LT.(n-1) )
THEN
324 CALL pdelget(
' ',
' ', e2, e, 1, ja+j, desce )
325 CALL pdelget(
'Columnwise',
' ', e1, a, ia+j+1, ja+j,
329 IF( ( abs( d1 - d2 ).GT.( abs( d2 ) * addbnd ) ) .OR.
330 $ ( abs( e1 - e2 ).GT.( abs( e2 ) * addbnd ) ) )
336 jl =
max( ( ( ja+n-2 ) / nb ) * nb + 1, ja )
337 iacol = indxg2p( jl, nb, mycol, desca( csrc_ ), npcol )
338 CALL descset( descv, n, nb, nb, nb, iarow, iacol, ictxt,
340 CALL descset( desct, nb, nb, nb, nb, indxg2p( ia+jl-ja+1, nb,
341 $ myrow, desca( rsrc_ ), nprow ), iacol, ictxt,
344 DO 40 j = jl, ja, -nb
347 jb =
min( n-k+1, nb )
351 CALL pdlarft(
'Forward',
'Columnwise', n-k, jb, a, i+1, j,
352 $ desca, tau, work( ipt ), work( ipv ) )
356 CALL pdlacpy(
'Lower', n-k, jb, a, i+1, j, desca,
357 $ work( ipv ), k+1, 1, descv )
358 CALL pdlaset(
'Upper', n-k, jb, zero, one, work( ipv ),
360 CALL pdlaset(
'Ge', 1, jb, zero, zero, work( ipv ), k, 1,
365 CALL pdlaset(
'Lower', n-k-1, jb, zero, zero, a, i+2, j,
370 CALL pdsymm(
'Left',
'Lower', n-k+1, jb, one, a, i, j,
371 $ desca, work( ipv ), k, 1, descv, zero,
372 $ work( ipx ), k, 1, descv )
373 CALL pdtrmm(
'Right',
'Upper',
'Transpose',
'Non-Unit',
374 $ n-k+1, jb, one, work( ipt ), 1, 1, desct,
375 $ work( ipx ), k, 1, descv )
379 CALL pdgemm(
'Transpose',
'No transpose', jb, jb, n-k+1,
380 $ one, work( ipv ), k, 1, descv, work( ipx ),
381 $ k, 1, descv, zero, work( ipy ), 1, 1, desct )
382 CALL pdtrmm(
'Left',
'Upper',
'No transpose',
'Non-Unit',
383 $ jb, jb, one, work( ipt ), 1, 1, desct,
384 $ work( ipy ), 1, 1, desct )
385 CALL pdgemm(
'No transpose',
'No transpose', n-k+1, jb, jb,
386 $ -half, work( ipv ), k, 1, descv, work( ipy ),
387 $ 1, 1, desct, one, work( ipx ), k, 1, descv )
391 CALL pdsyr2k(
'Lower',
'No tranpose', n-k+1, jb, -one,
392 $ work( ipv ), k, 1, descv, work( ipx ), k, 1,
393 $ descv, one, a, i, j, desca )
395 descv( csrc_ ) = mod( descv( csrc_ ) + npcol - 1, npcol )
396 desct( rsrc_ ) = mod( desct( rsrc_ ) + nprow - 1, nprow )
397 desct( csrc_ ) = mod( desct( csrc_ ) + npcol - 1, npcol )
403 CALL igsum2d( ictxt,
'All',
' ', 1, 1, info, 1, -1, 0 )