284 SUBROUTINE sorbdb( 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 REAL PHI( * ), THETA( * )
299 REAL TAUP1( * ), TAUP2( * ), TAUQ1( * ), TAUQ2( * ),
300 $ work( * ), x11( ldx11, * ), x12( ldx12, * ),
301 $ x21( ldx21, * ), x22( ldx22, * )
308 PARAMETER ( REALONE = 1.0e0 )
310 parameter( one = 1.0e0 )
313 LOGICAL COLMAJOR, LQUERY
314 INTEGER I, LWORKMIN, LWORKOPT
323 EXTERNAL snrm2, 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 sscal( p-i+1, z1, x11(i,i), 1 )
400 CALL sscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), 1 )
401 CALL saxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i,i-1),
405 CALL sscal( m-p-i+1, z2, x21(i,i), 1 )
407 CALL sscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), 1 )
408 CALL saxpy( m-p-i+1, -z2*z3*z4*sin(phi(i-1)), x22(i,i-1),
412 theta(i) = atan2( snrm2( m-p-i+1, x21(i,i), 1 ),
413 $ snrm2( p-i+1, x11(i,i), 1 ) )
416 CALL slarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
417 ELSE IF( p .EQ. i )
THEN
418 CALL slarfgp( p-i+1, x11(i,i), x11(i,i), 1, taup1(i) )
421 IF ( m-p .GT. i )
THEN
422 CALL slarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1,
424 ELSE IF ( m-p .EQ. i )
THEN
425 CALL slarfgp( m-p-i+1, x21(i,i), x21(i,i), 1, taup2(i) )
430 CALL slarf(
'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 slarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1, taup1(i),
435 $ x12(i,i), ldx12, work )
438 CALL slarf(
'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 slarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1, taup2(i),
443 $ x22(i,i), ldx22, work )
447 CALL sscal( q-i, -z1*z3*sin(theta(i)), x11(i,i+1),
449 CALL saxpy( q-i, z2*z3*cos(theta(i)), x21(i,i+1), ldx21,
450 $ x11(i,i+1), ldx11 )
452 CALL sscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), ldx12 )
453 CALL saxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), ldx22,
457 $ phi(i) = atan2( snrm2( q-i, x11(i,i+1), ldx11 ),
458 $ snrm2( m-q-i+1, x12(i,i), ldx12 ) )
461 IF ( q-i .EQ. 1 )
THEN
462 CALL slarfgp( q-i, x11(i,i+1), x11(i,i+1), ldx11,
465 CALL slarfgp( 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 slarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
475 CALL slarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
482 CALL slarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
483 $ x11(i+1,i+1), ldx11, work )
484 CALL slarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
485 $ x21(i+1,i+1), ldx21, work )
488 CALL slarf(
'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 slarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12,
493 $ tauq2(i), x22(i+1,i), ldx22, work )
502 CALL sscal( m-q-i+1, -z1*z4, x12(i,i), ldx12 )
503 IF ( i .GE. m-q )
THEN
504 CALL slarfgp( m-q-i+1, x12(i,i), x12(i,i), ldx12,
507 CALL slarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
513 CALL slarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
514 $ x12(i+1,i), ldx12, work )
517 $
CALL slarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
518 $ tauq2(i), x22(q+1,i), ldx22, work )
526 CALL sscal( m-p-q-i+1, z2*z4, x22(q+i,p+i), ldx22 )
527 IF ( i .EQ. m-p-q )
THEN
528 CALL slarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i),
529 $ ldx22, tauq2(p+i) )
531 CALL slarfgp( 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 slarf(
'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 sscal( p-i+1, z1, x11(i,i), ldx11 )
551 CALL sscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), ldx11 )
552 CALL saxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i-1,i),
553 $ ldx12, x11(i,i), ldx11 )
556 CALL sscal( m-p-i+1, z2, x21(i,i), ldx21 )
558 CALL sscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), ldx21 )
559 CALL saxpy( 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( snrm2( m-p-i+1, x21(i,i), ldx21 ),
564 $ snrm2( p-i+1, x11(i,i), ldx11 ) )
566 CALL slarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
568 IF ( i .EQ. m-p )
THEN
569 CALL slarfgp( m-p-i+1, x21(i,i), x21(i,i), ldx21,
572 CALL slarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
578 CALL slarf(
'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 slarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11,
583 $ taup1(i), x12(i,i), ldx12, work )
586 CALL slarf(
'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 slarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
591 $ taup2(i), x22(i,i), ldx22, work )
595 CALL sscal( q-i, -z1*z3*sin(theta(i)), x11(i+1,i), 1 )
596 CALL saxpy( q-i, z2*z3*cos(theta(i)), x21(i+1,i), 1,
599 CALL sscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), 1 )
600 CALL saxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), 1,
604 $ phi(i) = atan2( snrm2( q-i, x11(i+1,i), 1 ),
605 $ snrm2( m-q-i+1, x12(i,i), 1 ) )
608 IF ( q-i .EQ. 1)
THEN
609 CALL slarfgp( q-i, x11(i+1,i), x11(i+1,i), 1,
612 CALL slarfgp( q-i, x11(i+1,i), x11(i+2,i), 1,
617 IF ( m-q .GT. i )
THEN
618 CALL slarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1,
621 CALL slarfgp( m-q-i+1, x12(i,i), x12(i,i), 1,
627 CALL slarf(
'L', q-i, p-i, x11(i+1,i), 1, tauq1(i),
628 $ x11(i+1,i+1), ldx11, work )
629 CALL slarf(
'L', q-i, m-p-i, x11(i+1,i), 1, tauq1(i),
630 $ x21(i+1,i+1), ldx21, work )
632 CALL slarf(
'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 slarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1, tauq2(i),
636 $ x22(i,i+1), ldx22, work )
645 CALL sscal( m-q-i+1, -z1*z4, x12(i,i), 1 )
646 CALL slarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
650 CALL slarf(
'L', m-q-i+1, p-i, x12(i,i), 1, tauq2(i),
651 $ x12(i,i+1), ldx12, work )
654 $
CALL slarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1, tauq2(i),
655 $ x22(i,q+1), ldx22, work )
663 CALL sscal( m-p-q-i+1, z2*z4, x22(p+i,q+i), 1 )
664 IF ( m-p-q .EQ. i )
THEN
665 CALL slarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i,q+i), 1,
669 CALL slarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
672 CALL slarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
673 $ tauq2(p+i), x22(p+i,q+i+1), ldx22, work )
subroutine xerbla(srname, info)
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine slarf(side, m, n, v, incv, tau, c, ldc, work)
SLARF applies an elementary reflector to a general rectangular matrix.
subroutine slarfgp(n, alpha, x, incx, tau)
SLARFGP generates an elementary reflector (Householder matrix) with non-negative beta.
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sorbdb(trans, signs, m, p, q, x11, ldx11, x12, ldx12, x21, ldx21, x22, ldx22, theta, phi, taup1, taup2, tauq1, tauq2, work, lwork, info)
SORBDB