1 SUBROUTINE pclabrd( M, N, NB, A, IA, JA, DESCA, D, E, TAUQ, TAUP,
2 $ X, IX, JX, DESCX, Y, IY, JY, DESCY, WORK )
10 INTEGER IA, IX, IY, JA, JX, JY, M, N, NB
13 INTEGER DESCA( * ), DESCX( * ), DESCY( * )
15 COMPLEX A( * ), TAUP( * ), TAUQ( * ), X( * ), Y( * ),
250 INTEGER BLOCK_CYCLIC_2D, CSRC_, CTXT_, DLEN_, DTYPE_,
251 $ lld_, mb_, m_, nb_, n_, rsrc_
252 parameter( block_cyclic_2d = 1, dlen_ = 9, dtype_ = 1,
253 $ ctxt_ = 2, m_ = 3, n_ = 4, mb_ = 5, nb_ = 6,
254 $ rsrc_ = 7, csrc_ = 8, lld_ = 9 )
256 parameter( one = ( 1.0e+0, 0.0e+0 ),
257 $ zero = ( 0.0e+0, 0.0e+0 ) )
260 INTEGER I, IACOL, IAROW, ICTXT, II, IPY, IW, J, JJ,
261 $ jwy, k, mycol, myrow, npcol, nprow
263 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ),
264 $ desctp( dlen_ ), desctq( dlen_ ),
265 $ descw( dlen_ ), descwy( dlen_ )
279 IF( m.LE.0 .OR. n.LE.0 )
282 ictxt = desca( ctxt_ )
283 CALL blacs_gridinfo( ictxt, nprow, npcol, myrow, mycol )
284 CALL infog2l( ia, ja, desca, nprow, npcol, myrow, mycol, ii, jj,
286 ipy = desca( mb_ ) + 1
287 iw = mod( ia-1, desca( nb_ ) ) + 1
290 CALL descset( descwy, 1, n+mod( ia-1, descy( nb_ ) ), 1,
291 $ desca( nb_ ), iarow, iacol, ictxt, 1 )
292 CALL descset( descw, desca( mb_ ), 1, desca( mb_ ), 1, iarow,
293 $ iacol, ictxt, desca( mb_ ) )
294 CALL descset( desctq, 1, ja+
min(m,n)-1, 1, desca( nb_ ), iarow,
295 $ desca( csrc_ ), desca( ctxt_ ), 1 )
296 CALL descset( desctp, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
297 $ desca( rsrc_ ), iacol, desca( ctxt_ ),
304 CALL descset( descd, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
305 $ desca( csrc_ ), desca( ctxt_ ), 1 )
306 CALL descset( desce, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
307 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
317 CALL pcgemv(
'No transpose', m-k+1, k-1, -one, a, i, ja,
318 $ desca, y, iy, jy+k-1, descy, 1, one, a, i,
320 CALL pcgemv(
'No transpose', m-k+1, k-1, -one, x, ix+k-1,
321 $ jx, descx, a, ia, j, desca, 1, one, a, i, j,
323 CALL pcelset( a, i-1, j, desca, alpha )
328 CALL pclarfg( m-k+1, alpha, i, j, a, i+1, j, desca, 1,
330 CALL pselset( d, 1, j, descd, real( alpha ) )
331 CALL pcelset( a, i, j, desca, one )
335 CALL pcgemv(
'Conjugate transpose', m-k+1, n-k, one, a, i,
336 $ j+1, desca, a, i, j, desca, 1, zero,
337 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
338 CALL pcgemv(
'Conjugate transpose', m-k+1, k-1, one, a, i,
339 $ ja, desca, a, i, j, desca, 1, zero, work, iw,
341 CALL pcgemv(
'Conjugate transpose', k-1, n-k, -one, y, iy,
342 $ jy+k, descy, work, iw, 1, descw, 1, one,
343 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
344 CALL pcgemv(
'Conjugate transpose', m-k+1, k-1, one, x,
345 $ ix+k-1, jx, descx, a, i, j, desca, 1, zero,
346 $ work, iw, 1, descw, 1 )
347 CALL pcgemv(
'Conjugate transpose', k-1, n-k, -one, a, ia,
348 $ j+1, desca, work, iw, 1, descw, 1, one,
349 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
351 CALL pcelget(
'Rowwise',
' ', tau, tauq, 1, j, desctq )
352 CALL pcscal( n-k, tau, work( ipy ), 1, jwy, descwy,
354 CALL pclacgv( n-k, work( ipy ), 1, jwy, descwy,
356 CALL pccopy( n-k, work( ipy ), 1, jwy, descwy, descwy( m_ ),
357 $ y, iy+k-1, jy+k, descy, descy( m_ ) )
361 CALL pclacgv( n-k, a, i, j+1, desca, desca( m_ ) )
362 CALL pclacgv( k, a, i, ja, desca, desca( m_ ) )
363 CALL pcgemv(
'Conjugate transpose', k, n-k, -one, y, iy,
364 $ jy+k, descy, a, i, ja, desca, desca( m_ ), one,
365 $ a, i, j+1, desca, desca( m_ ) )
366 CALL pclacgv( k, a, i, ja, desca, desca( m_ ) )
367 CALL pclacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
368 CALL pcgemv(
'Conjugate transpose', k-1, n-k, -one, a, ia,
369 $ j+1, desca, x, ix+k-1, jx, descx, descx( m_ ),
370 $ one, a, i, j+1, desca, desca( m_ ) )
371 CALL pclacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
376 CALL pclarfg( n-k, alpha, i, j+1, a, i,
377 $
min( j+2, n+ja-1 ), desca, desca( m_ ), taup )
378 CALL pselset( e, i, 1, desce, real( alpha ) )
379 CALL pcelset( a, i, j+1, desca, one )
383 CALL pcgemv(
'No transpose', m-k, n-k, one, a, i+1, j+1,
384 $ desca, a, i, j+1, desca, desca( m_ ), zero, x,
385 $ ix+k, jx+k-1, descx, 1 )
386 CALL pcgemv(
'No transpose', k, n-k, one, y, iy, jy+k,
387 $ descy, a, i, j+1, desca, desca( m_ ), zero,
388 $ work, iw, 1, descw, 1 )
389 CALL pcgemv(
'No transpose', m-k, k, -one, a, i+1, ja,
390 $ desca, work, iw, 1, descw, 1, one, x, ix+k,
392 CALL pcgemv(
'No transpose', k-1, n-k, one, a, ia, j+1,
393 $ desca, a, i, j+1, desca, desca( m_ ), zero,
394 $ work, iw, 1, descw, 1 )
395 CALL pcgemv(
'No transpose', m-k, k-1, -one, x, ix+k, jx,
396 $ descx, work, iw, 1, descw, 1, one, x, ix+k,
399 CALL pcelget(
'Columnwise',
' ', tau, taup, i, 1, desctp )
400 CALL pcscal( m-k, tau, x, ix+k, jx+k-1, descx, 1 )
401 CALL pclacgv( n-k, a, i, j+1, desca, desca( m_ ) )
408 CALL descset( descd, ia+
min(m,n)-1, 1, desca( mb_ ), 1,
409 $ desca( rsrc_ ), mycol, desca( ctxt_ ),
411 CALL descset( desce, 1, ja+
min(m,n)-1, 1, desca( nb_ ), myrow,
412 $ desca( csrc_ ), desca( ctxt_ ), 1 )
420 CALL pclacgv( n-k+1, a, i, j, desca, desca( m_ ) )
422 CALL pclacgv( k-1, a, i, ja, desca, desca( m_ ) )
423 CALL pcgemv(
'Conjugate transpose', k-1, n-k+1, -one, y,
424 $ iy, jy+k-1, descy, a, i, ja, desca,
425 $ desca( m_ ), one, a, i, j, desca,
427 CALL pclacgv( k-1, a, i, ja, desca, desca( m_ ) )
428 CALL pclacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
429 CALL pcgemv(
'Conjugate transpose', k-1, n-k+1, -one, a,
430 $ ia, j, desca, x, ix+k-1, jx, descx,
431 $ descx( m_ ), one, a, i, j, desca,
433 CALL pclacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
434 CALL pcelset( a, i, j-1, desca,
cmplx( real( alpha ) ) )
439 CALL pclarfg( n-k+1, alpha, i, j, a, i, j+1, desca,
440 $ desca( m_ ), taup )
441 CALL pselset( d, i, 1, descd, real( alpha ) )
442 CALL pcelset( a, i, j, desca, one )
446 CALL pcgemv(
'No transpose', m-k, n-k+1, one, a, i+1, j,
447 $ desca, a, i, j, desca, desca( m_ ), zero, x,
448 $ ix+k, jx+k-1, descx, 1 )
449 CALL pcgemv(
'No transpose', k-1, n-k+1, one, y, iy, jy+k-1,
450 $ descy, a, i, j, desca, desca( m_ ), zero,
451 $ work, iw, 1, descw, 1 )
452 CALL pcgemv(
'No transpose', m-k, k-1, -one, a, i+1, ja,
453 $ desca, work, iw, 1, descw, 1, one, x, ix+k,
455 CALL pcgemv(
'No transpose', k-1, n-k+1, one, a, ia, j,
456 $ desca, a, i, j, desca, desca( m_ ), zero,
457 $ work, iw, 1, descw, 1 )
458 CALL pcgemv(
'No transpose', m-k, k-1, -one, x, ix+k, jx,
459 $ descx, work, iw, 1, descw, 1, one, x, ix+k,
462 CALL pcelget(
'Columnwise',
' ', tau, taup, i, 1, desctp )
463 CALL pcscal( m-k, tau, x, ix+k, jx+k-1, descx, 1 )
464 CALL pclacgv( n-k+1, a, i, j, desca, desca( m_ ) )
468 CALL pcgemv(
'No transpose', m-k, k-1, -one, a, i+1, ja,
469 $ desca, y, iy, jy+k-1, descy, 1, one, a, i+1, j,
471 CALL pcgemv(
'No transpose', m-k, k, -one, x, ix+k, jx,
472 $ descx, a, ia, j, desca, 1, one, a, i+1, j,
474 CALL pcelset( a, i, j, desca, alpha )
478 CALL pclarfg( m-k, alpha, i+1, j, a,
min( i+2, m+ia-1 ),
479 $ j, desca, 1, tauq )
480 CALL pselset( e, 1, j, desce, real( alpha ) )
481 CALL pcelset( a, i+1, j, desca, one )
485 CALL pcgemv(
'Conjugate transpose', m-k, n-k, one, a, i+1,
486 $ j+1, desca, a, i+1, j, desca, 1, zero,
487 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
488 CALL pcgemv(
'Conjugate transpose', m-k, k-1, one, a, i+1,
489 $ ja, desca, a, i+1, j, desca, 1, zero, work, iw,
491 CALL pcgemv(
'Conjugate transpose', k-1, n-k, -one, y, iy,
492 $ jy+k, descy, work, iw, 1, descw, 1, one,
493 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
494 CALL pcgemv(
'Conjugate transpose', m-k, k, one, x, ix+k,
495 $ jx, descx, a, i+1, j, desca, 1, zero, work, iw,
497 CALL pcgemv(
'Conjugate transpose', k, n-k, -one, a, ia,
498 $ j+1, desca, work, iw, 1, descw, 1, one,
499 $ work( ipy ), 1, jwy, descwy, descwy( m_ ) )
501 CALL pcelget(
'Rowwise',
' ', tau, tauq, 1, j, desctq )
502 CALL pcscal( n-k, tau, work( ipy ), 1, jwy, descwy,
504 CALL pclacgv( n-k, work( ipy ), 1, jwy, descwy,
506 CALL pccopy( n-k, work( ipy ), 1, jwy, descwy, descwy( m_ ),
507 $ y, iy+k-1, jy+k, descy, descy( m_ ) )