286 SUBROUTINE cunbdb( 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 REAL phi( * ), theta( * )
302 COMPLEX taup1( * ), taup2( * ), tauq1( * ), tauq2( * ),
303 $ work( * ), x11( ldx11, * ), x12( ldx12, * ),
304 $ x21( ldx21, * ), x22( ldx22, * )
311 parameter( realone = 1.0e0 )
313 parameter( one = (1.0e0,0.0e0) )
316 LOGICAL colmajor, lquery
317 INTEGER i, lworkmin, lworkopt
331 INTRINSIC atan2, cos, max, min, sin
332 INTRINSIC cmplx, conjg
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
cscal( p-i+1, cmplx( z1, 0.0e0 ), x11(i,i), 1 )
406 CALL
cscal( p-i+1, cmplx( z1*cos(phi(i-1)), 0.0e0 ),
408 CALL
caxpy( p-i+1, cmplx( -z1*z3*z4*sin(phi(i-1)),
409 $ 0.0e0 ), x12(i,i-1), 1, x11(i,i), 1 )
412 CALL
cscal( m-p-i+1, cmplx( z2, 0.0e0 ), x21(i,i), 1 )
414 CALL
cscal( m-p-i+1, cmplx( z2*cos(phi(i-1)), 0.0e0 ),
416 CALL
caxpy( m-p-i+1, cmplx( -z2*z3*z4*sin(phi(i-1)),
417 $ 0.0e0 ), x22(i,i-1), 1, x21(i,i), 1 )
420 theta(i) = atan2(
scnrm2( m-p-i+1, x21(i,i), 1 ),
421 $
scnrm2( p-i+1, x11(i,i), 1 ) )
423 CALL
clarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
425 CALL
clarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
428 CALL
clarf(
'L', p-i+1, q-i, x11(i,i), 1, conjg(taup1(i)),
429 $ x11(i,i+1), ldx11, work )
430 CALL
clarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1,
431 $ conjg(taup1(i)), x12(i,i), ldx12, work )
432 CALL
clarf(
'L', m-p-i+1, q-i, x21(i,i), 1, conjg(taup2(i)),
433 $ x21(i,i+1), ldx21, work )
434 CALL
clarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1,
435 $ conjg(taup2(i)), x22(i,i), ldx22, work )
438 CALL
cscal( q-i, cmplx( -z1*z3*sin(theta(i)), 0.0e0 ),
439 $ x11(i,i+1), ldx11 )
440 CALL
caxpy( q-i, cmplx( z2*z3*cos(theta(i)), 0.0e0 ),
441 $ x21(i,i+1), ldx21, x11(i,i+1), ldx11 )
443 CALL
cscal( m-q-i+1, cmplx( -z1*z4*sin(theta(i)), 0.0e0 ),
445 CALL
caxpy( m-q-i+1, cmplx( z2*z4*cos(theta(i)), 0.0e0 ),
446 $ x22(i,i), ldx22, x12(i,i), ldx12 )
449 $ phi(i) = atan2(
scnrm2( q-i, x11(i,i+1), ldx11 ),
450 $
scnrm2( m-q-i+1, x12(i,i), ldx12 ) )
453 CALL
clacgv( q-i, x11(i,i+1), ldx11 )
454 CALL
clarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
458 CALL
clacgv( m-q-i+1, x12(i,i), ldx12 )
459 CALL
clarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
464 CALL
clarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
465 $ x11(i+1,i+1), ldx11, work )
466 CALL
clarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
467 $ x21(i+1,i+1), ldx21, work )
469 CALL
clarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
470 $ x12(i+1,i), ldx12, work )
471 CALL
clarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
472 $ x22(i+1,i), ldx22, work )
475 $ CALL
clacgv( q-i, x11(i,i+1), ldx11 )
476 CALL
clacgv( m-q-i+1, x12(i,i), ldx12 )
484 CALL
cscal( m-q-i+1, cmplx( -z1*z4, 0.0e0 ), x12(i,i),
486 CALL
clacgv( m-q-i+1, x12(i,i), ldx12 )
487 CALL
clarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
491 CALL
clarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
492 $ x12(i+1,i), ldx12, work )
494 $ CALL
clarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
495 $ tauq2(i), x22(q+1,i), ldx22, work )
497 CALL
clacgv( m-q-i+1, x12(i,i), ldx12 )
505 CALL
cscal( m-p-q-i+1, cmplx( z2*z4, 0.0e0 ),
506 $ x22(q+i,p+i), ldx22 )
507 CALL
clacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
508 CALL
clarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
509 $ ldx22, tauq2(p+i) )
511 CALL
clarf(
'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
clacgv( m-p-q-i+1, x22(q+i,p+i), ldx22 )
525 CALL
cscal( p-i+1, cmplx( z1, 0.0e0 ), x11(i,i),
528 CALL
cscal( p-i+1, cmplx( z1*cos(phi(i-1)), 0.0e0 ),
530 CALL
caxpy( p-i+1, cmplx( -z1*z3*z4*sin(phi(i-1)),
531 $ 0.0e0 ), x12(i-1,i), ldx12, x11(i,i), ldx11 )
534 CALL
cscal( m-p-i+1, cmplx( z2, 0.0e0 ), x21(i,i),
537 CALL
cscal( m-p-i+1, cmplx( z2*cos(phi(i-1)), 0.0e0 ),
539 CALL
caxpy( m-p-i+1, cmplx( -z2*z3*z4*sin(phi(i-1)),
540 $ 0.0e0 ), x22(i-1,i), ldx22, x21(i,i), ldx21 )
543 theta(i) = atan2(
scnrm2( m-p-i+1, x21(i,i), ldx21 ),
544 $
scnrm2( p-i+1, x11(i,i), ldx11 ) )
546 CALL
clacgv( p-i+1, x11(i,i), ldx11 )
547 CALL
clacgv( m-p-i+1, x21(i,i), ldx21 )
549 CALL
clarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
551 CALL
clarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
555 CALL
clarf(
'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
556 $ x11(i+1,i), ldx11, work )
557 CALL
clarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11, taup1(i),
558 $ x12(i,i), ldx12, work )
559 CALL
clarf(
'R', q-i, m-p-i+1, x21(i,i), ldx21, taup2(i),
560 $ x21(i+1,i), ldx21, work )
561 CALL
clarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
562 $ taup2(i), x22(i,i), ldx22, work )
564 CALL
clacgv( p-i+1, x11(i,i), ldx11 )
565 CALL
clacgv( m-p-i+1, x21(i,i), ldx21 )
568 CALL
cscal( q-i, cmplx( -z1*z3*sin(theta(i)), 0.0e0 ),
570 CALL
caxpy( q-i, cmplx( z2*z3*cos(theta(i)), 0.0e0 ),
571 $ x21(i+1,i), 1, x11(i+1,i), 1 )
573 CALL
cscal( m-q-i+1, cmplx( -z1*z4*sin(theta(i)), 0.0e0 ),
575 CALL
caxpy( m-q-i+1, cmplx( z2*z4*cos(theta(i)), 0.0e0 ),
576 $ x22(i,i), 1, x12(i,i), 1 )
579 $ phi(i) = atan2(
scnrm2( q-i, x11(i+1,i), 1 ),
580 $
scnrm2( m-q-i+1, x12(i,i), 1 ) )
583 CALL
clarfgp( q-i, x11(i+1,i), x11(i+2,i), 1, tauq1(i) )
586 CALL
clarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
590 CALL
clarf(
'L', q-i, p-i, x11(i+1,i), 1,
591 $ conjg(tauq1(i)), x11(i+1,i+1), ldx11, work )
592 CALL
clarf(
'L', q-i, m-p-i, x11(i+1,i), 1,
593 $ conjg(tauq1(i)), x21(i+1,i+1), ldx21, work )
595 CALL
clarf(
'L', m-q-i+1, p-i, x12(i,i), 1, conjg(tauq2(i)),
596 $ x12(i,i+1), ldx12, work )
597 CALL
clarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1,
598 $ conjg(tauq2(i)), x22(i,i+1), ldx22, work )
606 CALL
cscal( m-q-i+1, cmplx( -z1*z4, 0.0e0 ), x12(i,i), 1 )
607 CALL
clarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
610 CALL
clarf(
'L', m-q-i+1, p-i, x12(i,i), 1, conjg(tauq2(i)),
611 $ x12(i,i+1), ldx12, work )
613 $ CALL
clarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1,
614 $ conjg(tauq2(i)), x22(i,q+1), ldx22, work )
622 CALL
cscal( m-p-q-i+1, cmplx( z2*z4, 0.0e0 ),
624 CALL
clarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
628 CALL
clarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
629 $ conjg(tauq2(p+i)), x22(p+i,q+i+1), ldx22, work )