286 SUBROUTINE zunbdb( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12,
287 $ x21, ldx21, x22, ldx22, theta, phi, taup1,
288 $ taup2, tauq1, tauq2, work, lwork, info )
296 CHARACTER signs, trans
297 INTEGER info, ldx11, ldx12, ldx21, ldx22, lwork, m, p,
301 DOUBLE PRECISION phi( * ), theta( * )
302 COMPLEX*16 taup1( * ), taup2( * ), tauq1( * ), tauq2( * ),
303 $ work( * ), x11( ldx11, * ), x12( ldx12, * ),
304 $ x21( ldx21, * ), x22( ldx22, * )
310 DOUBLE PRECISION realone
311 parameter( realone = 1.0d0 )
313 parameter( one = (1.0d0,0.0d0) )
316 LOGICAL colmajor, lquery
317 INTEGER i, lworkmin, lworkopt
318 DOUBLE PRECISION z1, z2, z3, z4
331 INTRINSIC atan2, cos, max, min, sin
332 INTRINSIC dcmplx, dconjg
339 colmajor = .NOT.
lsame( trans,
'T' )
340 IF( .NOT.
lsame( signs,
'O' ) )
THEN
351 lquery = lwork .EQ. -1
355 ELSE IF( p .LT. 0 .OR. p .GT. m )
THEN
357 ELSE IF( q .LT. 0 .OR. q .GT. p .OR. q .GT. m-p .OR.
360 ELSE IF( colmajor .AND. ldx11 .LT. max( 1, p ) )
THEN
362 ELSE IF( .NOT.colmajor .AND. ldx11 .LT. max( 1, q ) )
THEN
364 ELSE IF( colmajor .AND. ldx12 .LT. max( 1, p ) )
THEN
366 ELSE IF( .NOT.colmajor .AND. ldx12 .LT. max( 1, m-q ) )
THEN
368 ELSE IF( colmajor .AND. ldx21 .LT. max( 1, m-p ) )
THEN
370 ELSE IF( .NOT.colmajor .AND. ldx21 .LT. max( 1, q ) )
THEN
372 ELSE IF( colmajor .AND. ldx22 .LT. max( 1, m-p ) )
THEN
374 ELSE IF( .NOT.colmajor .AND. ldx22 .LT. max( 1, m-q ) )
THEN
380 IF( info .EQ. 0 )
THEN
384 IF( lwork .LT. lworkmin .AND. .NOT. lquery )
THEN
388 IF( info .NE. 0 )
THEN
389 CALL
xerbla(
'xORBDB', -info )
391 ELSE IF( lquery )
THEN
404 CALL
zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i), 1 )
406 CALL
zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
408 CALL
zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
409 $ 0.0d0 ), x12(i,i-1), 1, x11(i,i), 1 )
412 CALL
zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i), 1 )
414 CALL
zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)), 0.0d0 ),
416 CALL
zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
417 $ 0.0d0 ), x22(i,i-1), 1, x21(i,i), 1 )
420 theta(i) = atan2(
dznrm2( m-p-i+1, x21(i,i), 1 ),
421 $
dznrm2( p-i+1, x11(i,i), 1 ) )
423 CALL
zlarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
425 CALL
zlarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
428 CALL
zlarf(
'L', p-i+1, q-i, x11(i,i), 1, dconjg(taup1(i)),
429 $ x11(i,i+1), ldx11, work )
430 CALL
zlarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1,
431 $ dconjg(taup1(i)), x12(i,i), ldx12, work )
432 CALL
zlarf(
'L', m-p-i+1, q-i, x21(i,i), 1,
433 $ dconjg(taup2(i)), x21(i,i+1), ldx21, work )
434 CALL
zlarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1,
435 $ dconjg(taup2(i)), x22(i,i), ldx22, work )
438 CALL
zscal( q-i, dcmplx( -z1*z3*sin(theta(i)), 0.0d0 ),
439 $ x11(i,i+1), ldx11 )
440 CALL
zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
441 $ x21(i,i+1), ldx21, x11(i,i+1), ldx11 )
443 CALL
zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)), 0.0d0 ),
445 CALL
zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)), 0.0d0 ),
446 $ x22(i,i), ldx22, x12(i,i), ldx12 )
449 $ phi(i) = atan2(
dznrm2( q-i, x11(i,i+1), ldx11 ),
450 $
dznrm2( m-q-i+1, x12(i,i), ldx12 ) )
453 CALL
zlacgv( q-i, x11(i,i+1), ldx11 )
454 CALL
zlarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
458 CALL
zlacgv( m-q-i+1, x12(i,i), ldx12 )
459 CALL
zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
464 CALL
zlarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
465 $ x11(i+1,i+1), ldx11, work )
466 CALL
zlarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
467 $ x21(i+1,i+1), ldx21, work )
469 CALL
zlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
470 $ x12(i+1,i), ldx12, work )
471 CALL
zlarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
472 $ x22(i+1,i), ldx22, work )
475 $ CALL
zlacgv( q-i, x11(i,i+1), ldx11 )
476 CALL
zlacgv( m-q-i+1, x12(i,i), ldx12 )
484 CALL
zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i),
486 CALL
zlacgv( m-q-i+1, x12(i,i), ldx12 )
487 CALL
zlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
491 CALL
zlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
492 $ x12(i+1,i), ldx12, work )
494 $ CALL
zlarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
495 $ tauq2(i), x22(q+1,i), ldx22, work )
497 CALL
zlacgv( m-q-i+1, x12(i,i), ldx12 )
505 CALL
zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
506 $ x22(q+i,p+i), ldx22 )
507 CALL
zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
508 CALL
zlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
509 $ ldx22, tauq2(p+i) )
511 CALL
zlarf(
'R', m-p-q-i, m-p-q-i+1, x22(q+i,p+i), ldx22,
512 $ tauq2(p+i), x22(q+i+1,p+i), ldx22, work )
514 CALL
zlacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
525 CALL
zscal( p-i+1, dcmplx( z1, 0.0d0 ), x11(i,i),
528 CALL
zscal( p-i+1, dcmplx( z1*cos(phi(i-1)), 0.0d0 ),
530 CALL
zaxpy( p-i+1, dcmplx( -z1*z3*z4*sin(phi(i-1)),
531 $ 0.0d0 ), x12(i-1,i), ldx12, x11(i,i), ldx11 )
534 CALL
zscal( m-p-i+1, dcmplx( z2, 0.0d0 ), x21(i,i),
537 CALL
zscal( m-p-i+1, dcmplx( z2*cos(phi(i-1)), 0.0d0 ),
539 CALL
zaxpy( m-p-i+1, dcmplx( -z2*z3*z4*sin(phi(i-1)),
540 $ 0.0d0 ), x22(i-1,i), ldx22, x21(i,i), ldx21 )
543 theta(i) = atan2(
dznrm2( m-p-i+1, x21(i,i), ldx21 ),
544 $
dznrm2( p-i+1, x11(i,i), ldx11 ) )
546 CALL
zlacgv( p-i+1, x11(i,i), ldx11 )
547 CALL
zlacgv( m-p-i+1, x21(i,i), ldx21 )
549 CALL
zlarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
551 CALL
zlarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
555 CALL
zlarf(
'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
556 $ x11(i+1,i), ldx11, work )
557 CALL
zlarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11, taup1(i),
558 $ x12(i,i), ldx12, work )
559 CALL
zlarf(
'R', q-i, m-p-i+1, x21(i,i), ldx21, taup2(i),
560 $ x21(i+1,i), ldx21, work )
561 CALL
zlarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
562 $ taup2(i), x22(i,i), ldx22, work )
564 CALL
zlacgv( p-i+1, x11(i,i), ldx11 )
565 CALL
zlacgv( m-p-i+1, x21(i,i), ldx21 )
568 CALL
zscal( q-i, dcmplx( -z1*z3*sin(theta(i)), 0.0d0 ),
570 CALL
zaxpy( q-i, dcmplx( z2*z3*cos(theta(i)), 0.0d0 ),
571 $ x21(i+1,i), 1, x11(i+1,i), 1 )
573 CALL
zscal( m-q-i+1, dcmplx( -z1*z4*sin(theta(i)), 0.0d0 ),
575 CALL
zaxpy( m-q-i+1, dcmplx( z2*z4*cos(theta(i)), 0.0d0 ),
576 $ x22(i,i), 1, x12(i,i), 1 )
579 $ phi(i) = atan2(
dznrm2( q-i, x11(i+1,i), 1 ),
580 $
dznrm2( m-q-i+1, x12(i,i), 1 ) )
583 CALL
zlarfgp( q-i, x11(i+1,i), x11(i+2,i), 1, tauq1(i) )
586 CALL
zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
590 CALL
zlarf(
'L', q-i, p-i, x11(i+1,i), 1,
591 $ dconjg(tauq1(i)), x11(i+1,i+1), ldx11, work )
592 CALL
zlarf(
'L', q-i, m-p-i, x11(i+1,i), 1,
593 $ dconjg(tauq1(i)), x21(i+1,i+1), ldx21, work )
595 CALL
zlarf(
'L', m-q-i+1, p-i, x12(i,i), 1,
596 $ dconjg(tauq2(i)), x12(i,i+1), ldx12, work )
597 CALL
zlarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1,
598 $ dconjg(tauq2(i)), x22(i,i+1), ldx22, work )
606 CALL
zscal( m-q-i+1, dcmplx( -z1*z4, 0.0d0 ), x12(i,i), 1 )
607 CALL
zlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
610 CALL
zlarf(
'L', m-q-i+1, p-i, x12(i,i), 1,
611 $ dconjg(tauq2(i)), x12(i,i+1), ldx12, work )
613 $ CALL
zlarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1,
614 $ dconjg(tauq2(i)), x22(i,q+1), ldx22, work )
622 CALL
zscal( m-p-q-i+1, dcmplx( z2*z4, 0.0d0 ),
624 CALL
zlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
628 CALL
zlarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
629 $ dconjg(tauq2(p+i)), x22(p+i,q+i+1), ldx22,