286 SUBROUTINE dorbdb( 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 DOUBLE PRECISION 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 )
316 LOGICAL colmajor, lquery
317 INTEGER i, lworkmin, lworkopt
318 DOUBLE PRECISION z1, z2, z3, z4
324 DOUBLE PRECISION dnrm2
329 INTRINSIC atan2, cos, max, sin
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
dscal( p-i+1, z1, x11(i,i), 1 )
403 CALL
dscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), 1 )
404 CALL
daxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i,i-1),
408 CALL
dscal( m-p-i+1, z2, x21(i,i), 1 )
410 CALL
dscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), 1 )
411 CALL
daxpy( m-p-i+1, -z2*z3*z4*sin(phi(i-1)), x22(i,i-1),
415 theta(i) = atan2(
dnrm2( m-p-i+1, x21(i,i), 1 ),
416 $
dnrm2( p-i+1, x11(i,i), 1 ) )
418 CALL
dlarfgp( p-i+1, x11(i,i), x11(i+1,i), 1, taup1(i) )
420 CALL
dlarfgp( m-p-i+1, x21(i,i), x21(i+1,i), 1, taup2(i) )
423 CALL
dlarf(
'L', p-i+1, q-i, x11(i,i), 1, taup1(i),
424 $ x11(i,i+1), ldx11, work )
425 CALL
dlarf(
'L', p-i+1, m-q-i+1, x11(i,i), 1, taup1(i),
426 $ x12(i,i), ldx12, work )
427 CALL
dlarf(
'L', m-p-i+1, q-i, x21(i,i), 1, taup2(i),
428 $ x21(i,i+1), ldx21, work )
429 CALL
dlarf(
'L', m-p-i+1, m-q-i+1, x21(i,i), 1, taup2(i),
430 $ x22(i,i), ldx22, work )
433 CALL
dscal( q-i, -z1*z3*sin(theta(i)), x11(i,i+1),
435 CALL
daxpy( q-i, z2*z3*cos(theta(i)), x21(i,i+1), ldx21,
436 $ x11(i,i+1), ldx11 )
438 CALL
dscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), ldx12 )
439 CALL
daxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), ldx22,
443 $ phi(i) = atan2(
dnrm2( q-i, x11(i,i+1), ldx11 ),
444 $
dnrm2( m-q-i+1, x12(i,i), ldx12 ) )
447 CALL
dlarfgp( q-i, x11(i,i+1), x11(i,i+2), ldx11,
451 CALL
dlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
456 CALL
dlarf(
'R', p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
457 $ x11(i+1,i+1), ldx11, work )
458 CALL
dlarf(
'R', m-p-i, q-i, x11(i,i+1), ldx11, tauq1(i),
459 $ x21(i+1,i+1), ldx21, work )
461 CALL
dlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
462 $ x12(i+1,i), ldx12, work )
463 CALL
dlarf(
'R', m-p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
464 $ x22(i+1,i), ldx22, work )
472 CALL
dscal( m-q-i+1, -z1*z4, x12(i,i), ldx12 )
473 CALL
dlarfgp( m-q-i+1, x12(i,i), x12(i,i+1), ldx12,
477 CALL
dlarf(
'R', p-i, m-q-i+1, x12(i,i), ldx12, tauq2(i),
478 $ x12(i+1,i), ldx12, work )
480 $ CALL
dlarf(
'R', m-p-q, m-q-i+1, x12(i,i), ldx12,
481 $ tauq2(i), x22(q+1,i), ldx22, work )
489 CALL
dscal( m-p-q-i+1, z2*z4, x22(q+i,p+i), ldx22 )
490 CALL
dlarfgp( m-p-q-i+1, x22(q+i,p+i), x22(q+i,p+i+1),
491 $ ldx22, tauq2(p+i) )
493 CALL
dlarf(
'R', m-p-q-i, m-p-q-i+1, x22(q+i,p+i), ldx22,
494 $ tauq2(p+i), x22(q+i+1,p+i), ldx22, work )
505 CALL
dscal( p-i+1, z1, x11(i,i), ldx11 )
507 CALL
dscal( p-i+1, z1*cos(phi(i-1)), x11(i,i), ldx11 )
508 CALL
daxpy( p-i+1, -z1*z3*z4*sin(phi(i-1)), x12(i-1,i),
509 $ ldx12, x11(i,i), ldx11 )
512 CALL
dscal( m-p-i+1, z2, x21(i,i), ldx21 )
514 CALL
dscal( m-p-i+1, z2*cos(phi(i-1)), x21(i,i), ldx21 )
515 CALL
daxpy( m-p-i+1, -z2*z3*z4*sin(phi(i-1)), x22(i-1,i),
516 $ ldx22, x21(i,i), ldx21 )
519 theta(i) = atan2(
dnrm2( m-p-i+1, x21(i,i), ldx21 ),
520 $
dnrm2( p-i+1, x11(i,i), ldx11 ) )
522 CALL
dlarfgp( p-i+1, x11(i,i), x11(i,i+1), ldx11, taup1(i) )
524 CALL
dlarfgp( m-p-i+1, x21(i,i), x21(i,i+1), ldx21,
528 CALL
dlarf(
'R', q-i, p-i+1, x11(i,i), ldx11, taup1(i),
529 $ x11(i+1,i), ldx11, work )
530 CALL
dlarf(
'R', m-q-i+1, p-i+1, x11(i,i), ldx11, taup1(i),
531 $ x12(i,i), ldx12, work )
532 CALL
dlarf(
'R', q-i, m-p-i+1, x21(i,i), ldx21, taup2(i),
533 $ x21(i+1,i), ldx21, work )
534 CALL
dlarf(
'R', m-q-i+1, m-p-i+1, x21(i,i), ldx21,
535 $ taup2(i), x22(i,i), ldx22, work )
538 CALL
dscal( q-i, -z1*z3*sin(theta(i)), x11(i+1,i), 1 )
539 CALL
daxpy( q-i, z2*z3*cos(theta(i)), x21(i+1,i), 1,
542 CALL
dscal( m-q-i+1, -z1*z4*sin(theta(i)), x12(i,i), 1 )
543 CALL
daxpy( m-q-i+1, z2*z4*cos(theta(i)), x22(i,i), 1,
547 $ phi(i) = atan2(
dnrm2( q-i, x11(i+1,i), 1 ),
548 $
dnrm2( m-q-i+1, x12(i,i), 1 ) )
551 CALL
dlarfgp( q-i, x11(i+1,i), x11(i+2,i), 1, tauq1(i) )
554 CALL
dlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
558 CALL
dlarf(
'L', q-i, p-i, x11(i+1,i), 1, tauq1(i),
559 $ x11(i+1,i+1), ldx11, work )
560 CALL
dlarf(
'L', q-i, m-p-i, x11(i+1,i), 1, tauq1(i),
561 $ x21(i+1,i+1), ldx21, work )
563 CALL
dlarf(
'L', m-q-i+1, p-i, x12(i,i), 1, tauq2(i),
564 $ x12(i,i+1), ldx12, work )
565 CALL
dlarf(
'L', m-q-i+1, m-p-i, x12(i,i), 1, tauq2(i),
566 $ x22(i,i+1), ldx22, work )
574 CALL
dscal( m-q-i+1, -z1*z4, x12(i,i), 1 )
575 CALL
dlarfgp( m-q-i+1, x12(i,i), x12(i+1,i), 1, tauq2(i) )
578 CALL
dlarf(
'L', m-q-i+1, p-i, x12(i,i), 1, tauq2(i),
579 $ x12(i,i+1), ldx12, work )
581 $ CALL
dlarf(
'L', m-q-i+1, m-p-q, x12(i,i), 1, tauq2(i),
582 $ x22(i,q+1), ldx22, work )
590 CALL
dscal( m-p-q-i+1, z2*z4, x22(p+i,q+i), 1 )
591 CALL
dlarfgp( m-p-q-i+1, x22(p+i,q+i), x22(p+i+1,q+i), 1,
595 CALL
dlarf(
'L', m-p-q-i+1, m-p-q-i, x22(p+i,q+i), 1,
596 $ tauq2(p+i), x22(p+i,q+i+1), ldx22, work )