1 SUBROUTINE pzlabrd( 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( * )
14 DOUBLE PRECISION D( * ), E( * )
15 COMPLEX*16 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.0d+0, 0.0d+0 ),
257 $ zero = ( 0.0d+0, 0.0d+0 ) )
260 INTEGER I, IACOL, IAROW, ICTXT, II, IPY, IW, J, JJ,
261 $ jwy, k, mycol, myrow, npcol, nprow
262 COMPLEX*16 ALPHA, TAU
263 INTEGER DESCD( DLEN_ ), DESCE( DLEN_ ),
264 $ desctp( dlen_ ), desctq( dlen_ ),
265 $ descw( dlen_ ), descwy( dlen_ )
273 INTRINSIC dcmplx,
min, mod
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 pzgemv(
'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 pzgemv(
'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 pzelset( a, i-1, j, desca, alpha )
328 CALL pzlarfg( m-k+1, alpha, i, j, a, i+1, j, desca, 1,
330 CALL pdelset( d, 1, j, descd, dble( alpha ) )
331 CALL pzelset( a, i, j, desca, one )
335 CALL pzgemv(
'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 pzgemv(
'Conjugate transpose', m-k+1, k-1, one, a, i,
339 $ ja, desca, a, i, j, desca, 1, zero, work, iw,
341 CALL pzgemv(
'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 pzgemv(
'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 pzgemv(
'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 pzelget(
'Rowwise',
' ', tau, tauq, 1, j, desctq )
352 CALL pzscal( n-k, tau, work( ipy ), 1, jwy, descwy,
354 CALL pzlacgv( n-k, work( ipy ), 1, jwy, descwy,
356 CALL pzcopy( n-k, work( ipy ), 1, jwy, descwy, descwy( m_ ),
357 $ y, iy+k-1, jy+k, descy, descy( m_ ) )
361 CALL pzlacgv( n-k, a, i, j+1, desca, desca( m_ ) )
362 CALL pzlacgv( k, a, i, ja, desca, desca( m_ ) )
363 CALL pzgemv(
'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 pzlacgv( k, a, i, ja, desca, desca( m_ ) )
367 CALL pzlacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
368 CALL pzgemv(
'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 pzlacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
372 CALL pzelset( a, i, j, desca, dcmplx( dble( alpha ) ) )
376 CALL pzlarfg( n-k, alpha, i, j+1, a, i,
377 $
min( j+2, n+ja-1 ), desca, desca( m_ ), taup )
378 CALL pdelset( e, i, 1, desce, dble( alpha ) )
379 CALL pzelset( a, i, j+1, desca, one )
383 CALL pzgemv(
'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 pzgemv(
'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 pzgemv(
'No transpose', m-k, k, -one, a, i+1, ja,
390 $ desca, work, iw, 1, descw, 1, one, x, ix+k,
392 CALL pzgemv(
'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 pzgemv(
'No transpose', m-k, k-1, -one, x, ix+k, jx,
396 $ descx, work, iw, 1, descw, 1, one, x, ix+k,
399 CALL pzelget(
'Columnwise',
' ', tau, taup, i, 1, desctp )
400 CALL pzscal( m-k, tau, x, ix+k, jx+k-1, descx, 1 )
401 CALL pzlacgv( 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 pzlacgv( n-k+1, a, i, j, desca, desca( m_ ) )
422 CALL pzlacgv( k-1, a, i, ja, desca, desca( m_ ) )
423 CALL pzgemv(
'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 pzlacgv( k-1, a, i, ja, desca, desca( m_ ) )
428 CALL pzlacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
429 CALL pzgemv(
'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 pzlacgv( k-1, x, ix+k-1, jx, descx, descx( m_ ) )
434 CALL pzelset( a, i, j-1, desca, dcmplx( dble( alpha ) ) )
439 CALL pzlarfg( n-k+1, alpha, i, j, a, i, j+1, desca,
440 $ desca( m_ ), taup )
441 CALL pdelset( d, i, 1, descd, dble( alpha ) )
442 CALL pzelset( a, i, j, desca, one )
446 CALL pzgemv(
'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 pzgemv(
'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 pzgemv(
'No transpose', m-k, k-1, -one, a, i+1, ja,
453 $ desca, work, iw, 1, descw, 1, one, x, ix+k,
455 CALL pzgemv(
'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 pzgemv(
'No transpose', m-k, k-1, -one, x, ix+k, jx,
459 $ descx, work, iw, 1, descw, 1, one, x, ix+k,
462 CALL pzelget(
'Columnwise',
' ', tau, taup, i, 1, desctp )
463 CALL pzscal( m-k, tau, x, ix+k, jx+k-1, descx, 1 )
464 CALL pzlacgv( n-k+1, a, i, j, desca, desca( m_ ) )
468 CALL pzgemv(
'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 pzgemv(
'No transpose', m-k, k, -one, x, ix+k, jx,
472 $ descx, a, ia, j, desca, 1, one, a, i+1, j,
474 CALL pzelset( a, i, j, desca, alpha )
478 CALL pzlarfg( m-k, alpha, i+1, j, a,
min( i+2, m+ia-1 ),
479 $ j, desca, 1, tauq )
480 CALL pdelset( e, 1, j, desce, dble( alpha ) )
481 CALL pzelset( a, i+1, j, desca, one )
485 CALL pzgemv(
'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 pzgemv(
'Conjugate transpose', m-k, k-1, one, a, i+1,
489 $ ja, desca, a, i+1, j, desca, 1, zero, work, iw,
491 CALL pzgemv(
'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 pzgemv(
'Conjugate transpose', m-k, k, one, x, ix+k,
495 $ jx, descx, a, i+1, j, desca, 1, zero, work, iw,
497 CALL pzgemv(
'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 pzelget(
'Rowwise',
' ', tau, tauq, 1, j, desctq )
502 CALL pzscal( n-k, tau, work( ipy ), 1, jwy, descwy,
504 CALL pzlacgv( n-k, work( ipy ), 1, jwy, descwy,
506 CALL pzcopy( n-k, work( ipy ), 1, jwy, descwy, descwy( m_ ),
507 $ y, iy+k-1, jy+k, descy, descy( m_ ) )