1 SUBROUTINE pslatrd( 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 REAL A( * ), D( * ), E( * ), TAU( * ), W( * ),
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 )
228 parameter( half = 0.5e+0, one = 1.0e+0, zero = 0.0e+0 )
231 INTEGER I, IACOL, IAROW, ICTXT, II, J, JJ, JP, JWK, K,
232 $ kw, mycol, myrow, npcol, nprow, nq
236 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ), DESCWK( DLEN_ )
241 $
pslarfg, psscal, pssymv, sgebr2d,
247 EXTERNAL lsame, numroc
259 ictxt = desca( ctxt_ )
260 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
261 nq =
max( 1, numroc( ja+n-1, desca( nb_ ), mycol, desca( csrc_ ),
263 CALL descset( descd, 1, ja+n-1, 1, desca( nb_ ), myrow,
264 $ desca( csrc_ ), desca( ctxt_ ), 1 )
266 IF( lsame( uplo,
'U' ) )
THEN
268 CALL infog2l( n+ia-nb, n+ja-nb, desca, nprow, npcol, myrow,
269 $ mycol, ii, jj, iarow, iacol )
270 CALL descset( descwk, 1, descw( nb_ ), 1, descw( nb_ ), iarow,
272 CALL descset( desce, 1, ja+n-1, 1, desca( nb_ ), myrow,
273 $ desca( csrc_ ), desca( ctxt_ ), 1 )
277 DO 10 j = ja+n-1, ja+n-nb, -1
280 kw = mod( k-1, desca( mb_ ) ) + 1
284 CALL psgemv(
'No transpose', k, n-k, -one, a, ia, j+1,
285 $ desca, w, iw+k-1, jw+kw, descw, descw( m_ ),
286 $ one, a, ia, j, desca, 1 )
287 CALL psgemv(
'No transpose', k, n-k, -one, w, iw, jw+kw,
288 $ descw, a, i, j+1, desca, desca( m_ ), one, a,
291 $
CALL pselset( a, i, j+1, desca, e( jp ) )
296 jp =
min( jj+kw-1, nq )
297 CALL pslarfg( k-1, e( jp ), i-1, j, a, ia, j, desca, 1,
299 CALL pselset( a, i-1, j, desca, one )
303 CALL pssymv(
'Upper', k-1, one, a, ia, ja, desca, a, ia, j,
304 $ desca, 1, zero, w, iw, jw+kw-1, descw, 1 )
306 jwk = mod( k-1, descwk( nb_ ) ) + 2
307 CALL psgemv(
'Transpose', k-1, n-k, one, w, iw, jw+kw,
308 $ descw, a, ia, j, desca, 1, zero, work, 1, jwk,
309 $ descwk, descwk( m_ ) )
310 CALL psgemv(
'No transpose', k-1, n-k, -one, a, ia, j+1,
311 $ desca, work, 1, jwk, descwk, descwk( m_ ), one,
312 $ w, iw, jw+kw-1, descw, 1 )
313 CALL psgemv(
'Transpose', k-1, n-k, one, a, ia, j+1, desca,
314 $ a, ia, j, desca, 1, zero, work, 1, jwk, descwk,
316 CALL psgemv(
'No transpose', k-1, n-k, -one, w, iw, jw+kw,
317 $ descw, work, 1, jwk, descwk, descwk( m_ ), one,
318 $ w, iw, jw+kw-1, descw, 1 )
319 CALL psscal( k-1, tau( jp ), w, iw, jw+kw-1, descw, 1 )
321 CALL psdot( k-1, alpha, w, iw, jw+kw-1, descw, 1, a, ia, j,
324 $ alpha = -half*tau( jp )*alpha
325 CALL psaxpy( k-1, alpha, a, ia, j, desca, 1, w, iw, jw+kw-1,
327 IF( mycol.EQ.iacol )
THEN
328 CALL pselget(
'E',
' ', d( jp ), a, i, j, desca )
335 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii,
337 CALL descset( descwk, 1, descw( nb_ ), 1, descw( nb_ ), iarow,
339 CALL descset( desce, 1, ja+n-2, 1, desca( nb_ ), myrow,
340 $ desca( csrc_ ), desca( ctxt_ ), 1 )
344 DO 20 j = ja, ja+nb-1
350 CALL psgemv(
'No transpose', n-k+1, k-1, -one, a, i, ja,
351 $ desca, w, iw+k-1, jw, descw, descw( m_ ), one,
352 $ a, i, j, desca, 1 )
353 CALL psgemv(
'No transpose', n-k+1, k-1, -one, w, iw+k-1,
354 $ jw, descw, a, i, ja, desca, desca( m_ ), one,
355 $ a, i, j, desca, 1 )
357 $
CALL pselset( a, i, j-1, desca, e( jp ) )
363 jp =
min( jj+k-1, nq )
364 CALL pslarfg( n-k, e( jp ), i+1, j, a, i+2, j, desca, 1,
366 CALL pselset( a, i+1, j, desca, one )
370 CALL pssymv(
'Lower', n-k, one, a, i+1, j+1, desca, a, i+1,
371 $ j, desca, 1, zero, w, iw+k, jw+k-1, descw, 1 )
373 CALL psgemv(
'Transpose', n-k, k-1, one, w, iw+k, jw, descw,
374 $ a, i+1, j, desca, 1, zero, work, 1, 1, descwk,
376 CALL psgemv(
'No transpose', n-k, k-1, -one, a, i+1, ja,
377 $ desca, work, 1, 1, descwk, descwk( m_ ), one, w,
378 $ iw+k, jw+k-1, descw, 1 )
379 CALL psgemv(
'Transpose', n-k, k-1, one, a, i+1, ja, desca,
380 $ a, i+1, j, desca, 1, zero, work, 1, 1, descwk,
382 CALL psgemv(
'No transpose', n-k, k-1, -one, w, iw+k, jw,
383 $ descw, work, 1, 1, descwk, descwk( m_ ), one, w,
384 $ iw+k, jw+k-1, descw, 1 )
385 CALL psscal( n-k, tau( jp ), w, iw+k, jw+k-1, descw, 1 )
386 CALL psdot( n-k, alpha, w, iw+k, jw+k-1, descw, 1, a, i+1,
389 $ alpha = -half*tau( jp )*alpha
390 CALL psaxpy( n-k, alpha, a, i+1, j, desca, 1, w, iw+k,
392 IF( mycol.EQ.iacol )
THEN
393 CALL pselget(
'E',
' ', d( jp ), a, i, j, desca )
402 IF( mycol.EQ.iacol )
THEN
403 IF( myrow.EQ.iarow )
THEN
404 CALL sgebs2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1 )
406 CALL sgebr2d( ictxt,
'Columnwise',
' ', 1, nb, d( jj ), 1,