1 SUBROUTINE pclatrd( 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( * )
16 COMPLEX 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 HALF, ONE, ZERO
228 parameter( half = ( 0.5e+0, 0.0e+0 ),
229 $ one = ( 1.0e+0, 0.0e+0 ),
230 $ zero = ( 0.0e+0, 0.0e+0 ) )
233 INTEGER I, IACOL, IAROW, ICTXT, II, J, JJ, JP, JWK, K,
234 $ kw, mycol, myrow, npcol, nprow, nq
235 COMPLEX AII, ALPHA, BETA
238 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCWK( DLEN_ )
249 EXTERNAL lsame, numroc
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 pcelget(
'E',
' ', aii, a, i, j, desca )
290 CALL pclacgv( n-k, w, iw+k-1, jw+kw, descw, descw( m_ ) )
291 CALL pcgemv(
'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 pclacgv( n-k, w, iw+k-1, jw+kw, descw, descw( m_ ) )
295 CALL pclacgv( n-k, a, i, j+1, desca, desca( m_ ) )
296 CALL pcgemv(
'No transpose', k, n-k, -one, w, iw, jw+kw,
297 $ descw, a, i, j+1, desca, desca( m_ ), one, a,
299 CALL pclacgv( n-k, a, i, j+1, desca, desca( m_ ) )
300 CALL pcelget(
'E',
' ', aii, a, i, j, desca )
308 jp =
min( jj+kw-1, nq )
309 CALL pclarfg( k-1, beta, i-1, j, a, ia, j, desca, 1,
311 CALL pselset( e, 1, j, desce, real( beta ) )
312 CALL pcelset( a, i-1, j, desca, one )
316 CALL pchemv(
'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 pcgemv(
'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 pcgemv(
'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 pcgemv(
'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 pcgemv(
'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 pcscal( k-1, tau( jp ), w, iw, jw+kw-1, descw, 1 )
334 CALL pcdotc( k-1, alpha, w, iw, jw+kw-1, descw, 1, a, ia, j,
337 $ alpha = -half*tau( jp )*alpha
338 CALL pcaxpy( k-1, alpha, a, ia, j, desca, 1, w, iw, jw+kw-1,
340 CALL pcelget(
'E',
' ', beta, a, i, j, desca )
341 CALL pselset( d, 1, j, descd, real( 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 pcelget(
'E',
' ', aii, a, i, j, desca )
364 CALL pclacgv( k-1, w, iw+k-1, jw, descw, descw( m_ ) )
365 CALL pcgemv(
'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 pclacgv( k-1, w, iw+k-1, jw, descw, descw( m_ ) )
369 CALL pclacgv( k-1, a, i, ja, desca, desca( m_ ) )
370 CALL pcgemv(
'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 pclacgv( k-1, a, i, ja, desca, desca( m_ ) )
374 CALL pcelget(
'E',
' ', aii, a, i, j, desca )
383 jp =
min( jj+k-1, nq )
384 CALL pclarfg( n-k, beta, i+1, j, a, i+2, j, desca, 1,
386 CALL pselset( e, 1, j, desce, real( beta ) )
387 CALL pcelset( a, i+1, j, desca, one )
391 CALL pchemv(
'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 pcgemv(
'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 pcgemv(
'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 pcgemv(
'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 pcgemv(
'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 pcscal( n-k, tau( jp ), w, iw+k, jw+k-1, descw, 1 )
407 CALL pcdotc( n-k, alpha, w, iw+k, jw+k-1, descw, 1, a, i+1,
410 $ alpha = -half*tau( jp )*alpha
411 CALL pcaxpy( n-k, alpha, a, i+1, j, desca, 1, w, iw+k,
413 CALL pcelget(
'E',
' ', beta, a, i, j, desca )
414 CALL pselset( d, 1, j, descd, real( beta ) )
422 IF( mycol.EQ.iacol )
THEN
423 IF( myrow.EQ.iarow )
THEN
424 CALL sgebs2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1 )
426 CALL sgebr2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1,