1 SUBROUTINE pzlatrd( UPLO, N, NB, A, IA, JA, DESCA, D, E, TAU, W,
2 $ IW, JW, DESCW, WORK )
11 INTEGER IA, IW, JA, JW, N, NB
14 INTEGER DESCA( * ), DESCW( * )
15 DOUBLE PRECISION D( * ), E( * )
16 COMPLEX*16 A( * ), TAU( * ), W( * ), WORK( * )
222 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
223 $ lld_, mb_, m_, nb_, n_, rsrc_
224 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
225 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
226 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
227 COMPLEX*16 HALF, ONE, ZERO
228 parameter( half = ( 0.5d+0, 0.0d+0 ),
229 $ one = ( 1.0d+0, 0.0d+0 ),
230 $ zero = ( 0.0d+0, 0.0d+0 ) )
233 INTEGER I, IACOL, IAROW, ICTXT, II, J, JJ, JP, JWK, K,
234 $ kw, mycol, myrow, npcol, nprow, nq
235 COMPLEX*16 AII, ALPHA, BETA
238 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCWK( DLEN_ )
241 EXTERNAL blacs_gridinfo,
descset, dgebr2d, dgebs2d,
249 EXTERNAL lsame, numroc
252 INTRINSIC dble, dcmplx,
min
261 ictxt = desca( ctxt_ )
262 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
263 nq =
max( 1, numroc( ja+n-1, desca( nb_ ), mycol, desca( csrc_ ),
265 CALL descset( descd, 1, ja+n-1, 1, desca( nb_ ), myrow,
266 $ desca( csrc_ ), desca( ctxt_ ), 1 )
270 IF( lsame( uplo,
'U' ) )
THEN
272 CALL infog2l( n+ia-nb, n+ja-nb, desca, nprow, npcol, myrow,
273 $ mycol, ii, jj, iarow, iacol )
274 CALL descset( descwk, 1, descw( nb_ ), 1, descw( nb_ ), iarow,
276 CALL descset( desce, 1, ja+n-1, 1, desca( nb_ ), myrow,
277 $ desca( csrc_ ), desca( ctxt_ ), 1 )
281 DO 10 j = ja+n-1, ja+n-nb, -1
284 kw = mod( k-1, desca( mb_ ) ) + 1
288 CALL pzelget(
'E',
' ', aii, a, i, j, desca )
289 CALL pzelset( a, i, j, desca, dcmplx( dble( aii ) ) )
290 CALL pzlacgv( n-k, w, iw+k-1, jw+kw, descw, descw( m_ ) )
291 CALL pzgemv(
'No transpose', k, n-k, -one, a, ia, j+1,
292 $ desca, w, iw+k-1, jw+kw, descw, descw( m_ ),
293 $ one, a, ia, j, desca, 1 )
294 CALL pzlacgv( n-k, w, iw+k-1, jw+kw, descw, descw( m_ ) )
295 CALL pzlacgv( n-k, a, i, j+1, desca, desca( m_ ) )
296 CALL pzgemv(
'No transpose', k, n-k, -one, w, iw, jw+kw,
297 $ descw, a, i, j+1, desca, desca( m_ ), one, a,
299 CALL pzlacgv( n-k, a, i, j+1, desca, desca( m_ ) )
300 CALL pzelget(
'E',
' ', aii, a, i, j, desca )
301 CALL pzelset( a, i, j, desca, dcmplx( dble( aii ) ) )
303 $
CALL pzelset( a, i, j+1, desca, dcmplx( e( jp ) ) )
308 jp =
min( jj+kw-1, nq )
309 CALL pzlarfg( k-1, beta, i-1, j, a, ia, j, desca, 1,
311 CALL pdelset( e, 1, j, desce, dble( beta ) )
312 CALL pzelset( a, i-1, j, desca, one )
316 CALL pzhemv(
'Upper', k-1, one, a, ia, ja, desca, a, ia, j,
317 $ desca, 1, zero, w, iw, jw+kw-1, descw, 1 )
319 jwk = mod( k-1, descwk( nb_ ) ) + 2
320 CALL pzgemv(
'Conjugate transpose', k-1, n-k, one, w, iw,
321 $ jw+kw, descw, a, ia, j, desca, 1, zero, work,
322 $ 1, jwk, descwk, descwk( m_ ) )
323 CALL pzgemv(
'No transpose', k-1, n-k, -one, a, ia, j+1,
324 $ desca, work, 1, jwk, descwk, descwk( m_ ), one,
325 $ w, iw, jw+kw-1, descw, 1 )
326 CALL pzgemv(
'Conjugate transpose', k-1, n-k, one, a, ia,
327 $ j+1, desca, a, ia, j, desca, 1, zero, work, 1,
328 $ jwk, descwk, descwk( m_ ) )
329 CALL pzgemv(
'No transpose', k-1, n-k, -one, w, iw, jw+kw,
330 $ descw, work, 1, jwk, descwk, descwk( m_ ), one,
331 $ w, iw, jw+kw-1, descw, 1 )
332 CALL pzscal( k-1, tau( jp ), w, iw, jw+kw-1, descw, 1 )
334 CALL pzdotc( k-1, alpha, w, iw, jw+kw-1, descw, 1, a, ia, j,
337 $ alpha = -half*tau( jp )*alpha
338 CALL pzaxpy( k-1, alpha, a, ia, j, desca, 1, w, iw, jw+kw-1,
340 CALL pzelget(
'E',
' ', beta, a, i, j, desca )
341 CALL pdelset( d, 1, j, descd, dble( beta ) )
347 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii,
349 CALL descset( descwk, 1, descw( nb_ ), 1, descw( nb_ ), iarow,
351 CALL descset( desce, 1, ja+n-2, 1, desca( nb_ ), myrow,
352 $ desca( csrc_ ), desca( ctxt_ ), 1 )
356 DO 20 j = ja, ja+nb-1
362 CALL pzelget(
'E',
' ', aii, a, i, j, desca )
363 CALL pzelset( a, i, j, desca, dcmplx( dble( aii ) ) )
364 CALL pzlacgv( k-1, w, iw+k-1, jw, descw, descw( m_ ) )
365 CALL pzgemv(
'No transpose', n-k+1, k-1, -one, a, i, ja,
366 $ desca, w, iw+k-1, jw, descw, descw( m_ ), one,
367 $ a, i, j, desca, 1 )
368 CALL pzlacgv( k-1, w, iw+k-1, jw, descw, descw( m_ ) )
369 CALL pzlacgv( k-1, a, i, ja, desca, desca( m_ ) )
370 CALL pzgemv(
'No transpose', n-k+1, k-1, -one, w, iw+k-1,
371 $ jw, descw, a, i, ja, desca, desca( m_ ), one,
372 $ a, i, j, desca, 1 )
373 CALL pzlacgv( k-1, a, i, ja, desca, desca( m_ ) )
374 CALL pzelget(
'E',
' ', aii, a, i, j, desca )
375 CALL pzelset( a, i, j, desca, dcmplx( dble( aii ) ) )
377 $
CALL pzelset( a, i, j-1, desca, dcmplx( e( jp ) ) )
383 jp =
min( jj+k-1, nq )
384 CALL pzlarfg( n-k, beta, i+1, j, a, i+2, j, desca, 1,
386 CALL pdelset( e, 1, j, desce, dble( beta ) )
387 CALL pzelset( a, i+1, j, desca, one )
391 CALL pzhemv(
'Lower', n-k, one, a, i+1, j+1, desca, a, i+1,
392 $ j, desca, 1, zero, w, iw+k, jw+k-1, descw, 1 )
394 CALL pzgemv(
'Conjugate Transpose', n-k, k-1, one, w, iw+k,
395 $ jw, descw, a, i+1, j, desca, 1, zero, work, 1,
396 $ 1, descwk, descwk( m_ ) )
397 CALL pzgemv(
'No transpose', n-k, k-1, -one, a, i+1, ja,
398 $ desca, work, 1, 1, descwk, descwk( m_ ), one, w,
399 $ iw+k, jw+k-1, descw, 1 )
400 CALL pzgemv(
'Conjugate transpose', n-k, k-1, one, a, i+1,
401 $ ja, desca, a, i+1, j, desca, 1, zero, work, 1,
402 $ 1, descwk, descwk( m_ ) )
403 CALL pzgemv(
'No transpose', n-k, k-1, -one, w, iw+k, jw,
404 $ descw, work, 1, 1, descwk, descwk( m_ ), one, w,
405 $ iw+k, jw+k-1, descw, 1 )
406 CALL pzscal( n-k, tau( jp ), w, iw+k, jw+k-1, descw, 1 )
407 CALL pzdotc( n-k, alpha, w, iw+k, jw+k-1, descw, 1, a, i+1,
410 $ alpha = -half*tau( jp )*alpha
411 CALL pzaxpy( n-k, alpha, a, i+1, j, desca, 1, w, iw+k,
413 CALL pzelget(
'E',
' ', beta, a, i, j, desca )
414 CALL pdelset( d, 1, j, descd, dble( beta ) )
422 IF( mycol.EQ.iacol )
THEN
423 IF( myrow.EQ.iarow )
THEN
424 CALL dgebs2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1 )
426 CALL dgebr2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1,