284 SUBROUTINE zunbdb( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12,
285 $ X21, LDX21, X22, LDX22, THETA, PHI, TAUP1,
286 $ TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO )
293 CHARACTER SIGNS, TRANS
294 INTEGER INFO, LDX11, LDX12, LDX21, LDX22, LWORK, M, P,
298 DOUBLE PRECISION PHI( * ), THETA( * )
299 COMPLEX*16 TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ),
300 $ work( * ), x11( ldx11, * ), x12( ldx12, * ),
301 $ x21( ldx21, * ), x22( ldx22, * )
307 DOUBLE PRECISION REALONE
308 PARAMETER ( REALONE = 1.0d0 )
310 parameter( one = (1.0d0,0.0d0) )
313 LOGICAL COLMAJOR, LQUERY
314 INTEGER I, LWORKMIN, LWORKOPT
315 DOUBLE PRECISION Z1, Z2, Z3, Z4
323 DOUBLE PRECISION DZNRM2
325 EXTERNAL dznrm2, lsame
328 INTRINSIC atan2, cos, max, min, sin
329 INTRINSIC dcmplx, dconjg
336 colmajor = .NOT. lsame( trans,
'T' )
337 IF( .NOT. lsame( signs,
'O' ) )
THEN
348 lquery = lwork .EQ. -1
352 ELSE IF( p .LT. 0 .OR. p .GT. m )
THEN
354 ELSE IF( q .LT. 0 .OR. q .GT. p .OR. q .GT. m-p .OR.
357 ELSE IF( colmajor .AND. ldx11 .LT. max( 1, p ) )
THEN
359 ELSE IF( .NOT.colmajor .AND. ldx11 .LT. max( 1, q ) )
THEN
361 ELSE IF( colmajor .AND. ldx12 .LT. max( 1, p ) )
THEN
363 ELSE IF( .NOT.colmajor .AND. ldx12 .LT. max( 1, m-q ) )
THEN
365 ELSE IF( colmajor .AND. ldx21 .LT. max( 1, m-p ) )
THEN
367 ELSE IF( .NOT.colmajor .AND. ldx21 .LT. max( 1, q ) )
THEN
369 ELSE IF( colmajor .AND. ldx22 .LT. max( 1, m-p ) )
THEN
371 ELSE IF( .NOT.colmajor .AND. ldx22 .LT. max( 1, m-q ) )
THEN
377 IF( info .EQ. 0 )
THEN
381 IF( lwork .LT. lworkmin .AND. .NOT. lquery )
THEN
385 IF( info .NE. 0 )
THEN
386 CALL xerbla(
'xORBDB', -info )
388 ELSE IF( lquery )
THEN
401 CALL zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i), 1 )
403 CALL zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
405 CALL zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
406 $ 0.0d0 ), x12(i,i-1), 1, x11(i,i), 1 )
409 CALL zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i), 1 )
411 CALL zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)), 0.0d0 ),
413 CALL zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
414 $ 0.0d0 ), x22(i,i-1), 1, x21(i,i), 1 )
417 theta(i) = atan2( dznrm2( m-p-i+1, x21(i,i), 1 ),
418 $ dznrm2( p-i+1, x11(i,i), 1 ) )
421 CALL zlarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
422 ELSE IF ( p .EQ. i )
THEN
423 CALL zlarfgp( p-i+1, x11(i,i), x11(i,i), 1, taup1(i) )
426 IF ( m-p .GT. i )
THEN
427 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1,
429 ELSE IF ( m-p .EQ. i )
THEN
430 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i), 1,
436 CALL zlarf(
'L', p-i+1, q-i, x11(i,i), 1,
437 $ dconjg(taup1(i)), x11(i,i+1), ldx11, work )
438 CALL zlarf(
'L', m-p-i+1, q-i, x21(i,i), 1,
439 $ dconjg(taup2(i)), x21(i,i+1), ldx21, work )
441 IF ( m-q+1 .GT. i )
THEN
442 CALL zlarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1,
443 $ dconjg(taup1(i)), x12(i,i), ldx12, work )
444 CALL zlarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1,
445 $ dconjg(taup2(i)), x22(i,i), ldx22, work )
449 CALL zscal( q-i, dcmplx( -z1*z3*sin(theta(i)), 0.0d0 ),
450 $ x11(i,i+1), ldx11 )
451 CALL zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
452 $ x21(i,i+1), ldx21, x11(i,i+1), ldx11 )
454 CALL zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)), 0.0d0 ),
456 CALL zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)), 0.0d0 ),
457 $ x22(i,i), ldx22, x12(i,i), ldx12 )
460 $ phi(i) = atan2( dznrm2( q-i, x11(i,i+1), ldx11 ),
461 $ dznrm2( m-q-i+1, x12(i,i), ldx12 ) )
464 CALL zlacgv( q-i, x11(i,i+1), ldx11 )
465 IF ( i .EQ. q-1 )
THEN
466 CALL zlarfgp( q-i, x11(i,i+1), x11(i,i+1), ldx11,
469 CALL zlarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
474 IF ( m-q+1 .GT. i )
THEN
475 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
476 IF ( m-q .EQ. i )
THEN
477 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
480 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
487 CALL zlarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
488 $ x11(i+1,i+1), ldx11, work )
489 CALL zlarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
490 $ x21(i+1,i+1), ldx21, work )
493 CALL zlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
494 $ x12(i+1,i), ldx12, work )
496 IF ( m-p .GT. i )
THEN
497 CALL zlarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12,
498 $ tauq2(i), x22(i+1,i), ldx22, work )
502 $
CALL zlacgv( q-i, x11(i,i+1), ldx11 )
503 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
511 CALL zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i),
513 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
514 IF ( i .GE. m-q )
THEN
515 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
518 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
524 CALL zlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
525 $ x12(i+1,i), ldx12, work )
528 $
CALL zlarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
529 $ tauq2(i), x22(q+1,i), ldx22, work )
531 CALL zlacgv( m-q-i+1, x12(i,i), ldx12 )
539 CALL zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
540 $ x22(q+i,p+i), ldx22 )
541 CALL zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
542 CALL zlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
543 $ ldx22, tauq2(p+i) )
545 CALL zlarf(
'R', m-p-q-i, m-p-q-i+1, x22(q+i,p+i), ldx22,
546 $ tauq2(p+i), x22(q+i+1,p+i), ldx22, work )
548 CALL zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
559 CALL zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i),
562 CALL zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
564 CALL zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
565 $ 0.0d0 ), x12(i-1,i), ldx12, x11(i,i), ldx11 )
568 CALL zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i),
571 CALL zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)), 0.0d0 ),
573 CALL zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
574 $ 0.0d0 ), x22(i-1,i), ldx22, x21(i,i), ldx21 )
577 theta(i) = atan2( dznrm2( m-p-i+1, x21(i,i), ldx21 ),
578 $ dznrm2( p-i+1, x11(i,i), ldx11 ) )
580 CALL zlacgv( p-i+1, x11(i,i), ldx11 )
581 CALL zlacgv( m-p-i+1, x21(i,i), ldx21 )
583 CALL zlarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
585 IF ( i .EQ. m-p )
THEN
586 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i), ldx21,
589 CALL zlarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
594 CALL zlarf(
'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
595 $ x11(i+1,i), ldx11, work )
596 CALL zlarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11, taup1(i),
597 $ x12(i,i), ldx12, work )
598 CALL zlarf(
'R', q-i, m-p-i+1, x21(i,i), ldx21, taup2(i),
599 $ x21(i+1,i), ldx21, work )
600 CALL zlarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
601 $ taup2(i), x22(i,i), ldx22, work )
603 CALL zlacgv( p-i+1, x11(i,i), ldx11 )
604 CALL zlacgv( m-p-i+1, x21(i,i), ldx21 )
607 CALL zscal( q-i, dcmplx( -z1*z3*sin(theta(i)), 0.0d0 ),
609 CALL zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
610 $ x21(i+1,i), 1, x11(i+1,i), 1 )
612 CALL zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)), 0.0d0 ),
614 CALL zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)), 0.0d0 ),
615 $ x22(i,i), 1, x12(i,i), 1 )
618 $ phi(i) = atan2( dznrm2( q-i, x11(i+1,i), 1 ),
619 $ dznrm2( m-q-i+1, x12(i,i), 1 ) )
622 CALL zlarfgp( q-i, x11(i+1,i), x11(i+2,i), 1, tauq1(i) )
625 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
629 CALL zlarf(
'L', q-i, p-i, x11(i+1,i), 1,
630 $ dconjg(tauq1(i)), x11(i+1,i+1), ldx11, work )
631 CALL zlarf(
'L', q-i, m-p-i, x11(i+1,i), 1,
632 $ dconjg(tauq1(i)), x21(i+1,i+1), ldx21, work )
634 CALL zlarf(
'L', m-q-i+1, p-i, x12(i,i), 1,
635 $ dconjg(tauq2(i)), x12(i,i+1), ldx12, work )
636 IF ( m-p .GT. i )
THEN
637 CALL zlarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1,
638 $ dconjg(tauq2(i)), x22(i,i+1), ldx22, work )
647 CALL zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i), 1 )
648 CALL zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
652 CALL zlarf(
'L', m-q-i+1, p-i, x12(i,i), 1,
653 $ dconjg(tauq2(i)), x12(i,i+1), ldx12, work )
656 $
CALL zlarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1,
657 $ dconjg(tauq2(i)), x22(i,q+1), ldx22, work )
665 CALL zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
667 CALL zlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
671 IF ( m-p-q .NE. i )
THEN
672 CALL zlarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
673 $ dconjg(tauq2(p+i)), x22(p+i,q+i+1), ldx22,
subroutine xerbla(srname, info)
subroutine zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
subroutine zlarf(side, m, n, v, incv, tau, c, ldc, work)
ZLARF applies an elementary reflector to a general rectangular matrix.
subroutine zlarfgp(n, alpha, x, incx, tau)
ZLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine zscal(n, za, zx, incx)
ZSCAL
subroutine zunbdb(trans, signs, m, p, q, x11, ldx11, x12, ldx12, x21, ldx21, x22, ldx22, theta, phi, taup1, taup2, tauq1, tauq2, work, lwork, info)
ZUNBDB