284 SUBROUTINE dorbdb( 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 DOUBLE PRECISION 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 )
313 LOGICAL COLMAJOR, LQUERY
314 INTEGER I, LWORKMIN, LWORKOPT
315 DOUBLE PRECISION Z1, Z2, Z3, Z4
321 DOUBLE PRECISION DNRM2
323 EXTERNAL dnrm2, lsame
326 INTRINSIC atan2, cos, max, sin
333 colmajor = .NOT. lsame( trans,
'T' )
334 IF( .NOT. lsame( signs,
'O' ) )
THEN
345 lquery = lwork .EQ. -1
349 ELSE IF( p .LT. 0 .OR. p .GT. m )
THEN
351 ELSE IF( q .LT. 0 .OR. q .GT. p .OR. q .GT. m-p .OR.
354 ELSE IF( colmajor .AND. ldx11 .LT. max( 1, p ) )
THEN
356 ELSE IF( .NOT.colmajor .AND. ldx11 .LT. max( 1, q ) )
THEN
358 ELSE IF( colmajor .AND. ldx12 .LT. max( 1, p ) )
THEN
360 ELSE IF( .NOT.colmajor .AND. ldx12 .LT. max( 1, m-q ) )
THEN
362 ELSE IF( colmajor .AND. ldx21 .LT. max( 1, m-p ) )
THEN
364 ELSE IF( .NOT.colmajor .AND. ldx21 .LT. max( 1, q ) )
THEN
366 ELSE IF( colmajor .AND. ldx22 .LT. max( 1, m-p ) )
THEN
368 ELSE IF( .NOT.colmajor .AND. ldx22 .LT. max( 1, m-q ) )
THEN
374 IF( info .EQ. 0 )
THEN
378 IF( lwork .LT. lworkmin .AND. .NOT. lquery )
THEN
382 IF( info .NE. 0 )
THEN
383 CALL xerbla(
'xORBDB', -info )
385 ELSE IF( lquery )
THEN
398 CALL dscal( p-i+1, z1, x11(i,i), 1 )
400 CALL dscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), 1 )
401 CALL daxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i,i-1),
405 CALL dscal( m-p-i+1, z2, x21(i,i), 1 )
407 CALL dscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), 1 )
408 CALL daxpy( m-p-i+1, -z2*z3*z4*sin(phi(i-1)), x22(i,i-1),
412 theta(i) = atan2( dnrm2( m-p-i+1, x21(i,i), 1 ),
413 $ dnrm2( p-i+1, x11(i,i), 1 ) )
416 CALL dlarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
417 ELSE IF( p .EQ. i )
THEN
418 CALL dlarfgp( p-i+1, x11(i,i), x11(i,i), 1, taup1(i) )
421 IF ( m-p .GT. i )
THEN
422 CALL dlarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1,
424 ELSE IF ( m-p .EQ. i )
THEN
425 CALL dlarfgp( m-p-i+1, x21(i,i), x21(i,i), 1, taup2(i) )
430 CALL dlarf(
'L', p-i+1, q-i, x11(i,i), 1, taup1(i),
431 $ x11(i,i+1), ldx11, work )
433 IF ( m-q+1 .GT. i )
THEN
434 CALL dlarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1, taup1(i),
435 $ x12(i,i), ldx12, work )
438 CALL dlarf(
'L', m-p-i+1, q-i, x21(i,i), 1, taup2(i),
439 $ x21(i,i+1), ldx21, work )
441 IF ( m-q+1 .GT. i )
THEN
442 CALL dlarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1, taup2(i),
443 $ x22(i,i), ldx22, work )
447 CALL dscal( q-i, -z1*z3*sin(theta(i)), x11(i,i+1),
449 CALL daxpy( q-i, z2*z3*cos(theta(i)), x21(i,i+1), ldx21,
450 $ x11(i,i+1), ldx11 )
452 CALL dscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), ldx12 )
453 CALL daxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), ldx22,
457 $ phi(i) = atan2( dnrm2( q-i, x11(i,i+1), ldx11 ),
458 $ dnrm2( m-q-i+1, x12(i,i), ldx12 ) )
461 IF ( q-i .EQ. 1 )
THEN
462 CALL dlarfgp( q-i, x11(i,i+1), x11(i,i+1), ldx11,
465 CALL dlarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
470 IF ( q+i-1 .LT. m )
THEN
471 IF ( m-q .EQ. i )
THEN
472 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
475 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
482 CALL dlarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
483 $ x11(i+1,i+1), ldx11, work )
484 CALL dlarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
485 $ x21(i+1,i+1), ldx21, work )
488 CALL dlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
489 $ x12(i+1,i), ldx12, work )
491 IF ( m-p .GT. i )
THEN
492 CALL dlarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12,
493 $ tauq2(i), x22(i+1,i), ldx22, work )
502 CALL dscal( m-q-i+1, -z1*z4, x12(i,i), ldx12 )
503 IF ( i .GE. m-q )
THEN
504 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
507 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
513 CALL dlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
514 $ x12(i+1,i), ldx12, work )
517 $
CALL dlarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
518 $ tauq2(i), x22(q+1,i), ldx22, work )
526 CALL dscal( m-p-q-i+1, z2*z4, x22(q+i,p+i), ldx22 )
527 IF ( i .EQ. m-p-q )
THEN
528 CALL dlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i),
529 $ ldx22, tauq2(p+i) )
531 CALL dlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
532 $ ldx22, tauq2(p+i) )
535 IF ( i .LT. m-p-q )
THEN
536 CALL dlarf(
'R', m-p-q-i, m-p-q-i+1, x22(q+i,p+i), ldx22,
537 $ tauq2(p+i), x22(q+i+1,p+i), ldx22, work )
549 CALL dscal( p-i+1, z1, x11(i,i), ldx11 )
551 CALL dscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), ldx11 )
552 CALL daxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i-1,i),
553 $ ldx12, x11(i,i), ldx11 )
556 CALL dscal( m-p-i+1, z2, x21(i,i), ldx21 )
558 CALL dscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), ldx21 )
559 CALL daxpy( m-p-i+1, -z2*z3*z4*sin(phi(i-1)), x22(i-1,i),
560 $ ldx22, x21(i,i), ldx21 )
563 theta(i) = atan2( dnrm2( m-p-i+1, x21(i,i), ldx21 ),
564 $ dnrm2( p-i+1, x11(i,i), ldx11 ) )
566 CALL dlarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
568 IF ( i .EQ. m-p )
THEN
569 CALL dlarfgp( m-p-i+1, x21(i,i), x21(i,i), ldx21,
572 CALL dlarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
578 CALL dlarf(
'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
579 $ x11(i+1,i), ldx11, work )
581 IF ( m-q+1 .GT. i )
THEN
582 CALL dlarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11,
583 $ taup1(i), x12(i,i), ldx12, work )
586 CALL dlarf(
'R', q-i, m-p-i+1, x21(i,i), ldx21, taup2(i),
587 $ x21(i+1,i), ldx21, work )
589 IF ( m-q+1 .GT. i )
THEN
590 CALL dlarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
591 $ taup2(i), x22(i,i), ldx22, work )
595 CALL dscal( q-i, -z1*z3*sin(theta(i)), x11(i+1,i), 1 )
596 CALL daxpy( q-i, z2*z3*cos(theta(i)), x21(i+1,i), 1,
599 CALL dscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), 1 )
600 CALL daxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), 1,
604 $ phi(i) = atan2( dnrm2( q-i, x11(i+1,i), 1 ),
605 $ dnrm2( m-q-i+1, x12(i,i), 1 ) )
608 IF ( q-i .EQ. 1)
THEN
609 CALL dlarfgp( q-i, x11(i+1,i), x11(i+1,i), 1,
612 CALL dlarfgp( q-i, x11(i+1,i), x11(i+2,i), 1,
617 IF ( m-q .GT. i )
THEN
618 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1,
621 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i,i), 1,
627 CALL dlarf(
'L', q-i, p-i, x11(i+1,i), 1, tauq1(i),
628 $ x11(i+1,i+1), ldx11, work )
629 CALL dlarf(
'L', q-i, m-p-i, x11(i+1,i), 1, tauq1(i),
630 $ x21(i+1,i+1), ldx21, work )
632 CALL dlarf(
'L', m-q-i+1, p-i, x12(i,i), 1, tauq2(i),
633 $ x12(i,i+1), ldx12, work )
634 IF ( m-p-i .GT. 0 )
THEN
635 CALL dlarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1, tauq2(i),
636 $ x22(i,i+1), ldx22, work )
645 CALL dscal( m-q-i+1, -z1*z4, x12(i,i), 1 )
646 CALL dlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
650 CALL dlarf(
'L', m-q-i+1, p-i, x12(i,i), 1, tauq2(i),
651 $ x12(i,i+1), ldx12, work )
654 $
CALL dlarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1, tauq2(i),
655 $ x22(i,q+1), ldx22, work )
663 CALL dscal( m-p-q-i+1, z2*z4, x22(p+i,q+i), 1 )
664 IF ( m-p-q .EQ. i )
THEN
665 CALL dlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i,q+i), 1,
668 CALL dlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
670 CALL dlarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
671 $ tauq2(p+i), x22(p+i,q+i+1), ldx22, work )
subroutine xerbla(srname, info)
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
subroutine dlarf(side, m, n, v, incv, tau, c, ldc, work)
DLARF applies an elementary reflector to a general rectangular matrix.
subroutine dlarfgp(n, alpha, x, incx, tau)
DLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dorbdb(trans, signs, m, p, q, x11, ldx11, x12, ldx12, x21, ldx21, x22, ldx22, theta, phi, taup1, taup2, tauq1, tauq2, work, lwork, info)
DORBDB