195 SUBROUTINE dlarfb( 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 DOUBLE PRECISION c( ldc, * ), t( ldt, * ), v( ldv, * ),
216 parameter( one = 1.0d+0 )
220 INTEGER i, j, lastv, lastc, lastv2
234 IF( m.LE.0 .OR. n.LE.0 )
237 IF(
lsame( trans,
'N' ) )
THEN
243 IF(
lsame( storev,
'C' ) )
THEN
245 IF(
lsame( direct,
'F' ) )
THEN
251 IF(
lsame( side,
'L' ) )
THEN
256 lastv = max( k,
iladlr( m, k, v, ldv ) )
257 lastc =
iladlc( lastv, n, c, ldc )
264 CALL
dcopy( lastc, c( j, 1 ), ldc, work( 1, j ), 1 )
269 CALL
dtrmm(
'Right',
'Lower',
'No transpose',
'Unit',
270 $ lastc, k, one, v, ldv, work, ldwork )
271 IF( lastv.GT.k )
THEN
275 CALL
dgemm(
'Transpose',
'No transpose',
277 $ one, c( k+1, 1 ), ldc, v( k+1, 1 ), ldv,
278 $ one, work, ldwork )
283 CALL
dtrmm(
'Right',
'Upper', transt,
'Non-unit',
284 $ lastc, k, one, t, ldt, work, ldwork )
288 IF( lastv.GT.k )
THEN
292 CALL
dgemm(
'No transpose',
'Transpose',
294 $ -one, v( k+1, 1 ), ldv, work, ldwork, one,
300 CALL
dtrmm(
'Right',
'Lower',
'Transpose',
'Unit',
301 $ lastc, k, one, v, ldv, work, ldwork )
307 c( j, i ) = c( j, i ) - work( i, j )
311 ELSE IF(
lsame( side,
'R' ) )
THEN
315 lastv = max( k,
iladlr( n, k, v, ldv ) )
316 lastc =
iladlr( m, lastv, c, ldc )
323 CALL
dcopy( lastc, c( 1, j ), 1, work( 1, j ), 1 )
328 CALL
dtrmm(
'Right',
'Lower',
'No transpose',
'Unit',
329 $ lastc, k, one, v, ldv, work, ldwork )
330 IF( lastv.GT.k )
THEN
334 CALL
dgemm(
'No transpose',
'No transpose',
336 $ one, c( 1, k+1 ), ldc, v( k+1, 1 ), ldv,
337 $ one, work, ldwork )
342 CALL
dtrmm(
'Right',
'Upper', trans,
'Non-unit',
343 $ lastc, k, one, t, ldt, work, ldwork )
347 IF( lastv.GT.k )
THEN
351 CALL
dgemm(
'No transpose',
'Transpose',
353 $ -one, work, ldwork, v( k+1, 1 ), ldv, one,
359 CALL
dtrmm(
'Right',
'Lower',
'Transpose',
'Unit',
360 $ lastc, k, one, v, ldv, work, ldwork )
366 c( i, j ) = c( i, j ) - work( i, j )
377 IF(
lsame( side,
'L' ) )
THEN
382 lastc =
iladlc( m, n, c, ldc )
389 CALL
dcopy( lastc, c( m-k+j, 1 ), ldc,
395 CALL
dtrmm(
'Right',
'Upper',
'No transpose',
'Unit',
396 $ lastc, k, one, v( m-k+1, 1 ), ldv,
402 CALL
dgemm(
'Transpose',
'No transpose',
403 $ lastc, k, m-k, one, c, ldc, v, ldv,
404 $ one, work, ldwork )
409 CALL
dtrmm(
'Right',
'Lower', transt,
'Non-unit',
410 $ lastc, k, one, t, ldt, work, ldwork )
418 CALL
dgemm(
'No transpose',
'Transpose',
419 $ m-k, lastc, k, -one, v, ldv, work, ldwork,
425 CALL
dtrmm(
'Right',
'Upper',
'Transpose',
'Unit',
426 $ lastc, k, one, v( m-k+1, 1 ), ldv,
433 c( m-k+j, i ) = c( m-k+j, i ) - work(i, j)
437 ELSE IF(
lsame( side,
'R' ) )
THEN
441 lastc =
iladlr( m, n, c, ldc )
448 CALL
dcopy( lastc, c( 1, n-k+j ), 1, work( 1, j ), 1 )
453 CALL
dtrmm(
'Right',
'Upper',
'No transpose',
'Unit',
454 $ lastc, k, one, v( n-k+1, 1 ), ldv,
460 CALL
dgemm(
'No transpose',
'No transpose',
461 $ lastc, k, n-k, one, c, ldc, v, ldv,
462 $ one, work, ldwork )
467 CALL
dtrmm(
'Right',
'Lower', trans,
'Non-unit',
468 $ lastc, k, one, t, ldt, work, ldwork )
476 CALL
dgemm(
'No transpose',
'Transpose',
477 $ lastc, n-k, k, -one, work, ldwork, v, ldv,
483 CALL
dtrmm(
'Right',
'Upper',
'Transpose',
'Unit',
484 $ lastc, k, one, v( n-k+1, 1 ), ldv,
491 c( i, n-k+j ) = c( i, n-k+j ) - work(i, j)
497 ELSE IF(
lsame( storev,
'R' ) )
THEN
499 IF(
lsame( direct,
'F' ) )
THEN
504 IF(
lsame( side,
'L' ) )
THEN
509 lastv = max( k,
iladlc( k, m, v, ldv ) )
510 lastc =
iladlc( lastv, n, c, ldc )
517 CALL
dcopy( lastc, c( j, 1 ), ldc, work( 1, j ), 1 )
522 CALL
dtrmm(
'Right',
'Upper',
'Transpose',
'Unit',
523 $ lastc, k, one, v, ldv, work, ldwork )
524 IF( lastv.GT.k )
THEN
528 CALL
dgemm(
'Transpose',
'Transpose',
530 $ one, c( k+1, 1 ), ldc, v( 1, k+1 ), ldv,
531 $ one, work, ldwork )
536 CALL
dtrmm(
'Right',
'Upper', transt,
'Non-unit',
537 $ lastc, k, one, t, ldt, work, ldwork )
541 IF( lastv.GT.k )
THEN
545 CALL
dgemm(
'Transpose',
'Transpose',
547 $ -one, v( 1, k+1 ), ldv, work, ldwork,
548 $ one, c( k+1, 1 ), ldc )
553 CALL
dtrmm(
'Right',
'Upper',
'No transpose',
'Unit',
554 $ lastc, k, one, v, ldv, work, ldwork )
560 c( j, i ) = c( j, i ) - work( i, j )
564 ELSE IF(
lsame( side,
'R' ) )
THEN
568 lastv = max( k,
iladlc( k, n, v, ldv ) )
569 lastc =
iladlr( m, lastv, c, ldc )
576 CALL
dcopy( lastc, c( 1, j ), 1, work( 1, j ), 1 )
581 CALL
dtrmm(
'Right',
'Upper',
'Transpose',
'Unit',
582 $ lastc, k, one, v, ldv, work, ldwork )
583 IF( lastv.GT.k )
THEN
587 CALL
dgemm(
'No transpose',
'Transpose',
589 $ one, c( 1, k+1 ), ldc, v( 1, k+1 ), ldv,
590 $ one, work, ldwork )
595 CALL
dtrmm(
'Right',
'Upper', trans,
'Non-unit',
596 $ lastc, k, one, t, ldt, work, ldwork )
600 IF( lastv.GT.k )
THEN
604 CALL
dgemm(
'No transpose',
'No transpose',
606 $ -one, work, ldwork, v( 1, k+1 ), ldv,
607 $ one, c( 1, k+1 ), ldc )
612 CALL
dtrmm(
'Right',
'Upper',
'No transpose',
'Unit',
613 $ lastc, k, one, v, ldv, work, ldwork )
619 c( i, j ) = c( i, j ) - work( i, j )
630 IF(
lsame( side,
'L' ) )
THEN
635 lastc =
iladlc( m, n, c, ldc )
642 CALL
dcopy( lastc, c( m-k+j, 1 ), ldc,
648 CALL
dtrmm(
'Right',
'Lower',
'Transpose',
'Unit',
649 $ lastc, k, one, v( 1, m-k+1 ), ldv,
655 CALL
dgemm(
'Transpose',
'Transpose',
656 $ lastc, k, m-k, one, c, ldc, v, ldv,
657 $ one, work, ldwork )
662 CALL
dtrmm(
'Right',
'Lower', transt,
'Non-unit',
663 $ lastc, k, one, t, ldt, work, ldwork )
671 CALL
dgemm(
'Transpose',
'Transpose',
672 $ m-k, lastc, k, -one, v, ldv, work, ldwork,
678 CALL
dtrmm(
'Right',
'Lower',
'No transpose',
'Unit',
679 $ lastc, k, one, v( 1, m-k+1 ), ldv,
686 c( m-k+j, i ) = c( m-k+j, i ) - work(i, j)
690 ELSE IF(
lsame( side,
'R' ) )
THEN
694 lastc =
iladlr( m, n, c, ldc )
701 CALL
dcopy( lastc, c( 1, n-k+j ), 1,
707 CALL
dtrmm(
'Right',
'Lower',
'Transpose',
'Unit',
708 $ lastc, k, one, v( 1, n-k+1 ), ldv,
714 CALL
dgemm(
'No transpose',
'Transpose',
715 $ lastc, k, n-k, one, c, ldc, v, ldv,
716 $ one, work, ldwork )
721 CALL
dtrmm(
'Right',
'Lower', trans,
'Non-unit',
722 $ lastc, k, one, t, ldt, work, ldwork )
730 CALL
dgemm(
'No transpose',
'No transpose',
731 $ lastc, n-k, k, -one, work, ldwork, v, ldv,
737 CALL
dtrmm(
'Right',
'Lower',
'No transpose',
'Unit',
738 $ lastc, k, one, v( 1, n-k+1 ), ldv,
745 c( i, n-k+j ) = c( i, n-k+j ) - work(i, j)