195 SUBROUTINE zlarfb( SIDE, TRANS, DIRECT, STOREV, M, N, K, V, LDV,
196 $ t, ldt, c, ldc, work, ldwork )
204 CHARACTER direct, side, storev, trans
205 INTEGER k, ldc, ldt, ldv, ldwork, m, n
208 COMPLEX*16 c( ldc, * ), t( ldt, * ), v( ldv, * ),
216 parameter( one = ( 1.0d+0, 0.0d+0 ) )
220 INTEGER i, j, lastv, lastc
237 IF( m.LE.0 .OR. n.LE.0 )
240 IF(
lsame( trans,
'N' ) )
THEN
246 IF(
lsame( storev,
'C' ) )
THEN
248 IF(
lsame( direct,
'F' ) )
THEN
254 IF(
lsame( side,
'L' ) )
THEN
259 lastv = max( k,
ilazlr( m, k, v, ldv ) )
260 lastc =
ilazlc( lastv, n, c, ldc )
267 CALL
zcopy( lastc, c( j, 1 ), ldc, work( 1, j ), 1 )
268 CALL
zlacgv( lastc, work( 1, j ), 1 )
273 CALL
ztrmm(
'Right',
'Lower',
'No transpose',
'Unit',
274 $ lastc, k, one, v, ldv, work, ldwork )
275 IF( lastv.GT.k )
THEN
279 CALL
zgemm(
'Conjugate transpose',
'No transpose',
280 $ lastc, k, lastv-k, one, c( k+1, 1 ), ldc,
281 $ v( k+1, 1 ), ldv, one, work, ldwork )
286 CALL
ztrmm(
'Right',
'Upper', transt,
'Non-unit',
287 $ lastc, k, one, t, ldt, work, ldwork )
295 CALL
zgemm(
'No transpose',
'Conjugate transpose',
297 $ -one, v( k+1, 1 ), ldv, work, ldwork,
298 $ one, c( k+1, 1 ), ldc )
303 CALL
ztrmm(
'Right',
'Lower',
'Conjugate transpose',
304 $
'Unit', lastc, k, one, v, ldv, work, ldwork )
310 c( j, i ) = c( j, i ) - dconjg( work( i, j ) )
314 ELSE IF(
lsame( side,
'R' ) )
THEN
318 lastv = max( k,
ilazlr( n, k, v, ldv ) )
319 lastc =
ilazlr( m, lastv, c, ldc )
326 CALL
zcopy( lastc, c( 1, j ), 1, work( 1, j ), 1 )
331 CALL
ztrmm(
'Right',
'Lower',
'No transpose',
'Unit',
332 $ lastc, k, one, v, ldv, work, ldwork )
333 IF( lastv.GT.k )
THEN
337 CALL
zgemm(
'No transpose',
'No transpose',
339 $ one, c( 1, k+1 ), ldc, v( k+1, 1 ), ldv,
340 $ one, work, ldwork )
345 CALL
ztrmm(
'Right',
'Upper', trans,
'Non-unit',
346 $ lastc, k, one, t, ldt, work, ldwork )
350 IF( lastv.GT.k )
THEN
354 CALL
zgemm(
'No transpose',
'Conjugate transpose',
356 $ -one, work, ldwork, v( k+1, 1 ), ldv,
357 $ one, c( 1, k+1 ), ldc )
362 CALL
ztrmm(
'Right',
'Lower',
'Conjugate transpose',
363 $
'Unit', lastc, k, one, v, ldv, work, ldwork )
369 c( i, j ) = c( i, j ) - work( i, j )
380 IF(
lsame( side,
'L' ) )
THEN
385 lastc =
ilazlc( m, n, c, ldc )
392 CALL
zcopy( lastc, c( m-k+j, 1 ), ldc,
394 CALL
zlacgv( lastc, work( 1, j ), 1 )
399 CALL
ztrmm(
'Right',
'Upper',
'No transpose',
'Unit',
400 $ lastc, k, one, v( m-k+1, 1 ), ldv,
406 CALL
zgemm(
'Conjugate transpose',
'No transpose',
408 $ one, c, ldc, v, ldv,
409 $ one, work, ldwork )
414 CALL
ztrmm(
'Right',
'Lower', transt,
'Non-unit',
415 $ lastc, k, one, t, ldt, work, ldwork )
423 CALL
zgemm(
'No transpose',
'Conjugate transpose',
425 $ -one, v, ldv, work, ldwork,
431 CALL
ztrmm(
'Right',
'Upper',
'Conjugate transpose',
432 $
'Unit', lastc, k, one, v( m-k+1, 1 ), ldv,
439 c( m-k+j, i ) = c( m-k+j, i ) -
440 $ dconjg( work( i, j ) )
444 ELSE IF(
lsame( side,
'R' ) )
THEN
448 lastc =
ilazlr( m, n, c, ldc )
455 CALL
zcopy( lastc, c( 1, n-k+j ), 1,
461 CALL
ztrmm(
'Right',
'Upper',
'No transpose',
'Unit',
462 $ lastc, k, one, v( n-k+1, 1 ), ldv,
468 CALL
zgemm(
'No transpose',
'No transpose',
470 $ one, c, ldc, v, ldv, one, work, ldwork )
475 CALL
ztrmm(
'Right',
'Lower', trans,
'Non-unit',
476 $ lastc, k, one, t, ldt, work, ldwork )
484 CALL
zgemm(
'No transpose',
'Conjugate transpose',
485 $ lastc, n-k, k, -one, work, ldwork, v, ldv,
491 CALL
ztrmm(
'Right',
'Upper',
'Conjugate transpose',
492 $
'Unit', lastc, k, one, v( n-k+1, 1 ), ldv,
499 c( i, n-k+j ) = c( i, n-k+j )
506 ELSE IF(
lsame( storev,
'R' ) )
THEN
508 IF(
lsame( direct,
'F' ) )
THEN
513 IF(
lsame( side,
'L' ) )
THEN
518 lastv = max( k,
ilazlc( k, m, v, ldv ) )
519 lastc =
ilazlc( lastv, n, c, ldc )
526 CALL
zcopy( lastc, c( j, 1 ), ldc, work( 1, j ), 1 )
527 CALL
zlacgv( lastc, work( 1, j ), 1 )
532 CALL
ztrmm(
'Right',
'Upper',
'Conjugate transpose',
533 $
'Unit', lastc, k, one, v, ldv, work, ldwork )
534 IF( lastv.GT.k )
THEN
538 CALL
zgemm(
'Conjugate transpose',
539 $
'Conjugate transpose', lastc, k, lastv-k,
540 $ one, c( k+1, 1 ), ldc, v( 1, k+1 ), ldv,
541 $ one, work, ldwork )
546 CALL
ztrmm(
'Right',
'Upper', transt,
'Non-unit',
547 $ lastc, k, one, t, ldt, work, ldwork )
551 IF( lastv.GT.k )
THEN
555 CALL
zgemm(
'Conjugate transpose',
556 $
'Conjugate transpose', lastv-k, lastc, k,
557 $ -one, v( 1, k+1 ), ldv, work, ldwork,
558 $ one, c( k+1, 1 ), ldc )
563 CALL
ztrmm(
'Right',
'Upper',
'No transpose',
'Unit',
564 $ lastc, k, one, v, ldv, work, ldwork )
570 c( j, i ) = c( j, i ) - dconjg( work( i, j ) )
574 ELSE IF(
lsame( side,
'R' ) )
THEN
578 lastv = max( k,
ilazlc( k, n, v, ldv ) )
579 lastc =
ilazlr( m, lastv, c, ldc )
586 CALL
zcopy( lastc, c( 1, j ), 1, work( 1, j ), 1 )
591 CALL
ztrmm(
'Right',
'Upper',
'Conjugate transpose',
592 $
'Unit', lastc, k, one, v, ldv, work, ldwork )
593 IF( lastv.GT.k )
THEN
597 CALL
zgemm(
'No transpose',
'Conjugate transpose',
598 $ lastc, k, lastv-k, one, c( 1, k+1 ), ldc,
599 $ v( 1, k+1 ), ldv, one, work, ldwork )
604 CALL
ztrmm(
'Right',
'Upper', trans,
'Non-unit',
605 $ lastc, k, one, t, ldt, work, ldwork )
609 IF( lastv.GT.k )
THEN
613 CALL
zgemm(
'No transpose',
'No transpose',
615 $ -one, work, ldwork, v( 1, k+1 ), ldv,
616 $ one, c( 1, k+1 ), ldc )
621 CALL
ztrmm(
'Right',
'Upper',
'No transpose',
'Unit',
622 $ lastc, k, one, v, ldv, work, ldwork )
628 c( i, j ) = c( i, j ) - work( i, j )
639 IF(
lsame( side,
'L' ) )
THEN
644 lastc =
ilazlc( m, n, c, ldc )
651 CALL
zcopy( lastc, c( m-k+j, 1 ), ldc,
653 CALL
zlacgv( lastc, work( 1, j ), 1 )
658 CALL
ztrmm(
'Right',
'Lower',
'Conjugate transpose',
659 $
'Unit', lastc, k, one, v( 1, m-k+1 ), ldv,
665 CALL
zgemm(
'Conjugate transpose',
666 $
'Conjugate transpose', lastc, k, m-k,
667 $ one, c, ldc, v, ldv, one, work, ldwork )
672 CALL
ztrmm(
'Right',
'Lower', transt,
'Non-unit',
673 $ lastc, k, one, t, ldt, work, ldwork )
681 CALL
zgemm(
'Conjugate transpose',
682 $
'Conjugate transpose', m-k, lastc, k,
683 $ -one, v, ldv, work, ldwork, one, c, ldc )
688 CALL
ztrmm(
'Right',
'Lower',
'No transpose',
'Unit',
689 $ lastc, k, one, v( 1, m-k+1 ), ldv,
696 c( m-k+j, i ) = c( m-k+j, i ) -
697 $ dconjg( work( i, j ) )
701 ELSE IF(
lsame( side,
'R' ) )
THEN
705 lastc =
ilazlr( m, n, c, ldc )
712 CALL
zcopy( lastc, c( 1, n-k+j ), 1,
718 CALL
ztrmm(
'Right',
'Lower',
'Conjugate transpose',
719 $
'Unit', lastc, k, one, v( 1, n-k+1 ), ldv,
725 CALL
zgemm(
'No transpose',
'Conjugate transpose',
726 $ lastc, k, n-k, one, c, ldc, v, ldv, one,
732 CALL
ztrmm(
'Right',
'Lower', trans,
'Non-unit',
733 $ lastc, k, one, t, ldt, work, ldwork )
741 CALL
zgemm(
'No transpose',
'No transpose',
742 $ lastc, n-k, k, -one, work, ldwork, v, ldv,
748 CALL
ztrmm(
'Right',
'Lower',
'No transpose',
'Unit',
749 $ lastc, k, one, v( 1, n-k+1 ), ldv,
756 c( i, n-k+j ) = c( i, n-k+j ) - work( i, j )