247 SUBROUTINE ztprfb( SIDE, TRANS, DIRECT, STOREV, M, N, K, L,
248 $ V, LDV, T, LDT, A, LDA, B, LDB, WORK, LDWORK )
255 CHARACTER DIRECT, SIDE, STOREV, TRANS
256 INTEGER K, L, LDA, LDB, LDT, LDV, LDWORK, M, N
259 COMPLEX*16 A( LDA, * ), B( LDB, * ), T( LDT, * ),
260 $ v( ldv, * ), work( ldwork, * )
267 parameter( one = (1.0,0.0), zero = (0.0,0.0) )
270 INTEGER I, J, MP, NP, KP
271 LOGICAL LEFT, FORWARD, COLUMN, RIGHT, BACKWARD, ROW
287 IF( m.LE.0 .OR. n.LE.0 .OR. k.LE.0 .OR. l.LT.0 )
RETURN
289 IF( lsame( storev,
'C' ) )
THEN
292 ELSE IF ( lsame( storev,
'R' ) )
THEN
300 IF( lsame( side,
'L' ) )
THEN
303 ELSE IF( lsame( side,
'R' ) )
THEN
311 IF( lsame( direct,
'F' ) )
THEN
314 ELSE IF( lsame( direct,
'B' ) )
THEN
324 IF( column .AND. forward .AND. left )
THEN
346 work( i, j ) = b( m-l+i, j )
349 CALL ztrmm(
'L',
'U',
'C',
'N', l, n, one, v( mp, 1 ), ldv,
351 CALL zgemm(
'C',
'N', l, n, m-l, one, v, ldv, b, ldb,
352 $ one, work, ldwork )
353 CALL zgemm(
'C',
'N', k-l, n, m, one, v( 1, kp ), ldv,
354 $ b, ldb, zero, work( kp, 1 ), ldwork )
358 work( i, j ) = work( i, j ) + a( i, j )
362 CALL ztrmm(
'L',
'U', trans,
'N', k, n, one, t, ldt,
367 a( i, j ) = a( i, j ) - work( i, j )
371 CALL zgemm(
'N',
'N', m-l, n, k, -one, v, ldv, work, ldwork,
373 CALL zgemm(
'N',
'N', l, n, k-l, -one, v( mp, kp ), ldv,
374 $ work( kp, 1 ), ldwork, one, b( mp, 1 ), ldb )
375 CALL ztrmm(
'L',
'U',
'N',
'N', l, n, one, v( mp, 1 ), ldv,
379 b( m-l+i, j ) = b( m-l+i, j ) - work( i, j )
385 ELSE IF( column .AND. forward .AND. right )
THEN
406 work( i, j ) = b( i, n-l+j )
409 CALL ztrmm(
'R',
'U',
'N',
'N', m, l, one, v( np, 1 ), ldv,
411 CALL zgemm(
'N',
'N', m, l, n-l, one, b, ldb,
412 $ v, ldv, one, work, ldwork )
413 CALL zgemm(
'N',
'N', m, k-l, n, one, b, ldb,
414 $ v( 1, kp ), ldv, zero, work( 1, kp ), ldwork )
418 work( i, j ) = work( i, j ) + a( i, j )
422 CALL ztrmm(
'R',
'U', trans,
'N', m, k, one, t, ldt,
427 a( i, j ) = a( i, j ) - work( i, j )
431 CALL zgemm(
'N',
'C', m, n-l, k, -one, work, ldwork,
432 $ v, ldv, one, b, ldb )
433 CALL zgemm(
'N',
'C', m, l, k-l, -one, work( 1, kp ),
435 $ v( np, kp ), ldv, one, b( 1, np ), ldb )
436 CALL ztrmm(
'R',
'U',
'C',
'N', m, l, one, v( np, 1 ), ldv,
440 b( i, n-l+j ) = b( i, n-l+j ) - work( i, j )
446 ELSE IF( column .AND. backward .AND. left )
THEN
468 work( k-l+i, j ) = b( i, j )
472 CALL ztrmm(
'L',
'L',
'C',
'N', l, n, one, v( 1, kp ), ldv,
473 $ work( kp, 1 ), ldwork )
474 CALL zgemm(
'C',
'N', l, n, m-l, one, v( mp, kp ), ldv,
475 $ b( mp, 1 ), ldb, one, work( kp, 1 ), ldwork )
476 CALL zgemm(
'C',
'N', k-l, n, m, one, v, ldv,
477 $ b, ldb, zero, work, ldwork )
481 work( i, j ) = work( i, j ) + a( i, j )
485 CALL ztrmm(
'L',
'L', trans,
'N', k, n, one, t, ldt,
490 a( i, j ) = a( i, j ) - work( i, j )
494 CALL zgemm(
'N',
'N', m-l, n, k, -one, v( mp, 1 ), ldv,
495 $ work, ldwork, one, b( mp, 1 ), ldb )
496 CALL zgemm(
'N',
'N', l, n, k-l, -one, v, ldv,
497 $ work, ldwork, one, b, ldb )
498 CALL ztrmm(
'L',
'L',
'N',
'N', l, n, one, v( 1, kp ), ldv,
499 $ work( kp, 1 ), ldwork )
502 b( i, j ) = b( i, j ) - work( k-l+i, j )
508 ELSE IF( column .AND. backward .AND. right )
THEN
529 work( i, k-l+j ) = b( i, j )
532 CALL ztrmm(
'R',
'L',
'N',
'N', m, l, one, v( 1, kp ), ldv,
533 $ work( 1, kp ), ldwork )
534 CALL zgemm(
'N',
'N', m, l, n-l, one, b( 1, np ), ldb,
535 $ v( np, kp ), ldv, one, work( 1, kp ), ldwork )
536 CALL zgemm(
'N',
'N', m, k-l, n, one, b, ldb,
537 $ v, ldv, zero, work, ldwork )
541 work( i, j ) = work( i, j ) + a( i, j )
545 CALL ztrmm(
'R',
'L', trans,
'N', m, k, one, t, ldt,
550 a( i, j ) = a( i, j ) - work( i, j )
554 CALL zgemm(
'N',
'C', m, n-l, k, -one, work, ldwork,
555 $ v( np, 1 ), ldv, one, b( 1, np ), ldb )
556 CALL zgemm(
'N',
'C', m, l, k-l, -one, work, ldwork,
557 $ v, ldv, one, b, ldb )
558 CALL ztrmm(
'R',
'L',
'C',
'N', m, l, one, v( 1, kp ), ldv,
559 $ work( 1, kp ), ldwork )
562 b( i, j ) = b( i, j ) - work( i, k-l+j )
568 ELSE IF( row .AND. forward .AND. left )
THEN
589 work( i, j ) = b( m-l+i, j )
592 CALL ztrmm(
'L',
'L',
'N',
'N', l, n, one, v( 1, mp ), ldv,
594 CALL zgemm(
'N',
'N', l, n, m-l, one, v, ldv,b, ldb,
595 $ one, work, ldwork )
596 CALL zgemm(
'N',
'N', k-l, n, m, one, v( kp, 1 ), ldv,
597 $ b, ldb, zero, work( kp, 1 ), ldwork )
601 work( i, j ) = work( i, j ) + a( i, j )
605 CALL ztrmm(
'L',
'U', trans,
'N', k, n, one, t, ldt,
610 a( i, j ) = a( i, j ) - work( i, j )
614 CALL zgemm(
'C',
'N', m-l, n, k, -one, v, ldv, work, ldwork,
616 CALL zgemm(
'C',
'N', l, n, k-l, -one, v( kp, mp ), ldv,
617 $ work( kp, 1 ), ldwork, one, b( mp, 1 ), ldb )
618 CALL ztrmm(
'L',
'L',
'C',
'N', l, n, one, v( 1, mp ), ldv,
622 b( m-l+i, j ) = b( m-l+i, j ) - work( i, j )
628 ELSE IF( row .AND. forward .AND. right )
THEN
648 work( i, j ) = b( i, n-l+j )
651 CALL ztrmm(
'R',
'L',
'C',
'N', m, l, one, v( 1, np ), ldv,
653 CALL zgemm(
'N',
'C', m, l, n-l, one, b, ldb, v, ldv,
654 $ one, work, ldwork )
655 CALL zgemm(
'N',
'C', m, k-l, n, one, b, ldb,
656 $ v( kp, 1 ), ldv, zero, work( 1, kp ), ldwork )
660 work( i, j ) = work( i, j ) + a( i, j )
664 CALL ztrmm(
'R',
'U', trans,
'N', m, k, one, t, ldt,
669 a( i, j ) = a( i, j ) - work( i, j )
673 CALL zgemm(
'N',
'N', m, n-l, k, -one, work, ldwork,
674 $ v, ldv, one, b, ldb )
675 CALL zgemm(
'N',
'N', m, l, k-l, -one, work( 1, kp ),
677 $ v( kp, np ), ldv, one, b( 1, np ), ldb )
678 CALL ztrmm(
'R',
'L',
'N',
'N', m, l, one, v( 1, np ), ldv,
682 b( i, n-l+j ) = b( i, n-l+j ) - work( i, j )
688 ELSE IF( row .AND. backward .AND. left )
THEN
709 work( k-l+i, j ) = b( i, j )
712 CALL ztrmm(
'L',
'U',
'N',
'N', l, n, one, v( kp, 1 ), ldv,
713 $ work( kp, 1 ), ldwork )
714 CALL zgemm(
'N',
'N', l, n, m-l, one, v( kp, mp ), ldv,
715 $ b( mp, 1 ), ldb, one, work( kp, 1 ), ldwork )
716 CALL zgemm(
'N',
'N', k-l, n, m, one, v, ldv, b, ldb,
717 $ zero, work, ldwork )
721 work( i, j ) = work( i, j ) + a( i, j )
725 CALL ztrmm(
'L',
'L ', trans,
'N', k, n, one, t, ldt,
730 a( i, j ) = a( i, j ) - work( i, j )
734 CALL zgemm(
'C',
'N', m-l, n, k, -one, v( 1, mp ), ldv,
735 $ work, ldwork, one, b( mp, 1 ), ldb )
736 CALL zgemm(
'C',
'N', l, n, k-l, -one, v, ldv,
737 $ work, ldwork, one, b, ldb )
738 CALL ztrmm(
'L',
'U',
'C',
'N', l, n, one, v( kp, 1 ), ldv,
739 $ work( kp, 1 ), ldwork )
742 b( i, j ) = b( i, j ) - work( k-l+i, j )
748 ELSE IF( row .AND. backward .AND. right )
THEN
768 work( i, k-l+j ) = b( i, j )
771 CALL ztrmm(
'R',
'U',
'C',
'N', m, l, one, v( kp, 1 ), ldv,
772 $ work( 1, kp ), ldwork )
773 CALL zgemm(
'N',
'C', m, l, n-l, one, b( 1, np ), ldb,
774 $ v( kp, np ), ldv, one, work( 1, kp ), ldwork )
775 CALL zgemm(
'N',
'C', m, k-l, n, one, b, ldb, v, ldv,
776 $ zero, work, ldwork )
780 work( i, j ) = work( i, j ) + a( i, j )
784 CALL ztrmm(
'R',
'L', trans,
'N', m, k, one, t, ldt,
789 a( i, j ) = a( i, j ) - work( i, j )
793 CALL zgemm(
'N',
'N', m, n-l, k, -one, work, ldwork,
794 $ v( 1, np ), ldv, one, b( 1, np ), ldb )
795 CALL zgemm(
'N',
'N', m, l, k-l , -one, work, ldwork,
796 $ v, ldv, one, b, ldb )
797 CALL ztrmm(
'R',
'U',
'N',
'N', m, l, one, v( kp, 1 ), ldv,
798 $ work( 1, kp ), ldwork )
801 b( i, j ) = b( i, j ) - work( i, k-l+j )