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