330 SUBROUTINE zbbcsd( JOBU1, JOBU2, JOBV1T, JOBV2T, TRANS, M, P, Q,
331 $ theta, phi, u1, ldu1, u2, ldu2, v1t, ldv1t,
332 $ v2t, ldv2t, b11d, b11e, b12d, b12e, b21d, b21e,
333 $ b22d, b22e, rwork, lrwork, info )
341 CHARACTER jobu1, jobu2, jobv1t, jobv2t, trans
342 INTEGER info, ldu1, ldu2, ldv1t, ldv2t, lrwork, m, p, q
345 DOUBLE PRECISION b11d( * ), b11e( * ), b12d( * ), b12e( * ),
346 $ b21d( * ), b21e( * ), b22d( * ), b22e( * ),
347 $ phi( * ), theta( * ), rwork( * )
348 COMPLEX*16 u1( ldu1, * ), u2( ldu2, * ), v1t( ldv1t, * ),
356 parameter( maxitr = 6 )
357 DOUBLE PRECISION hundred, meighth, one, piover2, ten, zero
358 parameter( hundred = 100.0d0, meighth = -0.125d0,
359 $ one = 1.0d0, piover2 = 1.57079632679489662d0,
360 $ ten = 10.0d0, zero = 0.0d0 )
361 COMPLEX*16 negonecomplex
362 parameter( negonecomplex = (-1.0d0,0.0d0) )
365 LOGICAL colmajor, lquery, restart11, restart12,
366 $ restart21, restart22, wantu1, wantu2, wantv1t,
368 INTEGER i, imin, imax, iter, iu1cs, iu1sn, iu2cs,
369 $ iu2sn, iv1tcs, iv1tsn, iv2tcs, iv2tsn, j,
370 $ lrworkmin, lrworkopt, maxit, mini
371 DOUBLE PRECISION b11bulge, b12bulge, b21bulge, b22bulge, dummy,
372 $ eps, mu, nu, r, sigma11, sigma21,
373 $ temp, thetamax, thetamin, thresh, tol, tolmul,
374 $ unfl, x1, x2, y1, y2
385 INTRINSIC abs, atan2, cos, max, min, sin, sqrt
392 lquery = lrwork .EQ. -1
393 wantu1 =
lsame( jobu1,
'Y' )
394 wantu2 =
lsame( jobu2,
'Y' )
395 wantv1t =
lsame( jobv1t,
'Y' )
396 wantv2t =
lsame( jobv2t,
'Y' )
397 colmajor = .NOT.
lsame( trans,
'T' )
401 ELSE IF( p .LT. 0 .OR. p .GT. m )
THEN
403 ELSE IF( q .LT. 0 .OR. q .GT. m )
THEN
405 ELSE IF( q .GT. p .OR. q .GT. m-p .OR. q .GT. m-q )
THEN
407 ELSE IF( wantu1 .AND. ldu1 .LT. p )
THEN
409 ELSE IF( wantu2 .AND. ldu2 .LT. m-p )
THEN
411 ELSE IF( wantv1t .AND. ldv1t .LT. q )
THEN
413 ELSE IF( wantv2t .AND. ldv2t .LT. m-q )
THEN
419 IF( info .EQ. 0 .AND. q .EQ. 0 )
THEN
427 IF( info .EQ. 0 )
THEN
436 lrworkopt = iv2tsn + q - 1
437 lrworkmin = lrworkopt
439 IF( lrwork .LT. lrworkmin .AND. .NOT. lquery )
THEN
444 IF( info .NE. 0 )
THEN
445 CALL
xerbla(
'ZBBCSD', -info )
447 ELSE IF( lquery )
THEN
454 unfl =
dlamch(
'Safe minimum' )
455 tolmul = max( ten, min( hundred, eps**meighth ) )
457 thresh = max( tol, maxitr*q*q*unfl )
462 IF( theta(i) .LT. thresh )
THEN
464 ELSE IF( theta(i) .GT. piover2-thresh )
THEN
469 IF( phi(i) .LT. thresh )
THEN
471 ELSE IF( phi(i) .GT. piover2-thresh )
THEN
479 DO WHILE( ( imax .GT. 1 ) .AND. ( phi(imax-1) .EQ. zero ) )
483 IF ( imin .GT. 1 )
THEN
484 DO WHILE( phi(imin-1) .NE. zero )
486 IF ( imin .LE. 1 ) exit
497 DO WHILE( imax .GT. 1 )
501 b11d(imin) = cos( theta(imin) )
502 b21d(imin) = -sin( theta(imin) )
503 DO i = imin, imax - 1
504 b11e(i) = -sin( theta(i) ) * sin( phi(i) )
505 b11d(i+1) = cos( theta(i+1) ) * cos( phi(i) )
506 b12d(i) = sin( theta(i) ) * cos( phi(i) )
507 b12e(i) = cos( theta(i+1) ) * sin( phi(i) )
508 b21e(i) = -cos( theta(i) ) * sin( phi(i) )
509 b21d(i+1) = -sin( theta(i+1) ) * cos( phi(i) )
510 b22d(i) = cos( theta(i) ) * cos( phi(i) )
511 b22e(i) = -sin( theta(i+1) ) * sin( phi(i) )
513 b12d(imax) = sin( theta(imax) )
514 b22d(imax) = cos( theta(imax) )
518 IF( iter .GT. maxit )
THEN
521 IF( phi(i) .NE. zero )
527 iter = iter + imax - imin
531 thetamax = theta(imin)
532 thetamin = theta(imin)
534 IF( theta(i) > thetamax )
535 $ thetamax = theta(i)
536 IF( theta(i) < thetamin )
537 $ thetamin = theta(i)
540 IF( thetamax .GT. piover2 - thresh )
THEN
548 ELSE IF( thetamin .LT. thresh )
THEN
560 CALL
dlas2( b11d(imax-1), b11e(imax-1), b11d(imax), sigma11,
562 CALL
dlas2( b21d(imax-1), b21e(imax-1), b21d(imax), sigma21,
565 IF( sigma11 .LE. sigma21 )
THEN
567 nu = sqrt( one - mu**2 )
568 IF( mu .LT. thresh )
THEN
574 mu = sqrt( 1.0 - nu**2 )
575 IF( nu .LT. thresh )
THEN
584 IF( mu .LE. nu )
THEN
585 CALL
dlartgs( b11d(imin), b11e(imin), mu,
586 $ rwork(iv1tcs+imin-1), rwork(iv1tsn+imin-1) )
588 CALL
dlartgs( b21d(imin), b21e(imin), nu,
589 $ rwork(iv1tcs+imin-1), rwork(iv1tsn+imin-1) )
592 temp = rwork(iv1tcs+imin-1)*b11d(imin) +
593 $ rwork(iv1tsn+imin-1)*b11e(imin)
594 b11e(imin) = rwork(iv1tcs+imin-1)*b11e(imin) -
595 $ rwork(iv1tsn+imin-1)*b11d(imin)
597 b11bulge = rwork(iv1tsn+imin-1)*b11d(imin+1)
598 b11d(imin+1) = rwork(iv1tcs+imin-1)*b11d(imin+1)
599 temp = rwork(iv1tcs+imin-1)*b21d(imin) +
600 $ rwork(iv1tsn+imin-1)*b21e(imin)
601 b21e(imin) = rwork(iv1tcs+imin-1)*b21e(imin) -
602 $ rwork(iv1tsn+imin-1)*b21d(imin)
604 b21bulge = rwork(iv1tsn+imin-1)*b21d(imin+1)
605 b21d(imin+1) = rwork(iv1tcs+imin-1)*b21d(imin+1)
609 theta( imin ) = atan2( sqrt( b21d(imin)**2+b21bulge**2 ),
610 $ sqrt( b11d(imin)**2+b11bulge**2 ) )
614 IF( b11d(imin)**2+b11bulge**2 .GT. thresh**2 )
THEN
615 CALL
dlartgp( b11bulge, b11d(imin), rwork(iu1sn+imin-1),
616 $ rwork(iu1cs+imin-1), r )
617 ELSE IF( mu .LE. nu )
THEN
618 CALL
dlartgs( b11e( imin ), b11d( imin + 1 ), mu,
619 $ rwork(iu1cs+imin-1), rwork(iu1sn+imin-1) )
621 CALL
dlartgs( b12d( imin ), b12e( imin ), nu,
622 $ rwork(iu1cs+imin-1), rwork(iu1sn+imin-1) )
624 IF( b21d(imin)**2+b21bulge**2 .GT. thresh**2 )
THEN
625 CALL
dlartgp( b21bulge, b21d(imin), rwork(iu2sn+imin-1),
626 $ rwork(iu2cs+imin-1), r )
627 ELSE IF( nu .LT. mu )
THEN
628 CALL
dlartgs( b21e( imin ), b21d( imin + 1 ), nu,
629 $ rwork(iu2cs+imin-1), rwork(iu2sn+imin-1) )
631 CALL
dlartgs( b22d(imin), b22e(imin), mu,
632 $ rwork(iu2cs+imin-1), rwork(iu2sn+imin-1) )
634 rwork(iu2cs+imin-1) = -rwork(iu2cs+imin-1)
635 rwork(iu2sn+imin-1) = -rwork(iu2sn+imin-1)
637 temp = rwork(iu1cs+imin-1)*b11e(imin) +
638 $ rwork(iu1sn+imin-1)*b11d(imin+1)
639 b11d(imin+1) = rwork(iu1cs+imin-1)*b11d(imin+1) -
640 $ rwork(iu1sn+imin-1)*b11e(imin)
642 IF( imax .GT. imin+1 )
THEN
643 b11bulge = rwork(iu1sn+imin-1)*b11e(imin+1)
644 b11e(imin+1) = rwork(iu1cs+imin-1)*b11e(imin+1)
646 temp = rwork(iu1cs+imin-1)*b12d(imin) +
647 $ rwork(iu1sn+imin-1)*b12e(imin)
648 b12e(imin) = rwork(iu1cs+imin-1)*b12e(imin) -
649 $ rwork(iu1sn+imin-1)*b12d(imin)
651 b12bulge = rwork(iu1sn+imin-1)*b12d(imin+1)
652 b12d(imin+1) = rwork(iu1cs+imin-1)*b12d(imin+1)
653 temp = rwork(iu2cs+imin-1)*b21e(imin) +
654 $ rwork(iu2sn+imin-1)*b21d(imin+1)
655 b21d(imin+1) = rwork(iu2cs+imin-1)*b21d(imin+1) -
656 $ rwork(iu2sn+imin-1)*b21e(imin)
658 IF( imax .GT. imin+1 )
THEN
659 b21bulge = rwork(iu2sn+imin-1)*b21e(imin+1)
660 b21e(imin+1) = rwork(iu2cs+imin-1)*b21e(imin+1)
662 temp = rwork(iu2cs+imin-1)*b22d(imin) +
663 $ rwork(iu2sn+imin-1)*b22e(imin)
664 b22e(imin) = rwork(iu2cs+imin-1)*b22e(imin) -
665 $ rwork(iu2sn+imin-1)*b22d(imin)
667 b22bulge = rwork(iu2sn+imin-1)*b22d(imin+1)
668 b22d(imin+1) = rwork(iu2cs+imin-1)*b22d(imin+1)
674 DO i = imin+1, imax-1
678 x1 = sin(theta(i-1))*b11e(i-1) + cos(theta(i-1))*b21e(i-1)
679 x2 = sin(theta(i-1))*b11bulge + cos(theta(i-1))*b21bulge
680 y1 = sin(theta(i-1))*b12d(i-1) + cos(theta(i-1))*b22d(i-1)
681 y2 = sin(theta(i-1))*b12bulge + cos(theta(i-1))*b22bulge
683 phi(i-1) = atan2( sqrt(x1**2+x2**2), sqrt(y1**2+y2**2) )
688 restart11 = b11e(i-1)**2 + b11bulge**2 .LE. thresh**2
689 restart21 = b21e(i-1)**2 + b21bulge**2 .LE. thresh**2
690 restart12 = b12d(i-1)**2 + b12bulge**2 .LE. thresh**2
691 restart22 = b22d(i-1)**2 + b22bulge**2 .LE. thresh**2
697 IF( .NOT. restart11 .AND. .NOT. restart21 )
THEN
698 CALL
dlartgp( x2, x1, rwork(iv1tsn+i-1),
699 $ rwork(iv1tcs+i-1), r )
700 ELSE IF( .NOT. restart11 .AND. restart21 )
THEN
701 CALL
dlartgp( b11bulge, b11e(i-1), rwork(iv1tsn+i-1),
702 $ rwork(iv1tcs+i-1), r )
703 ELSE IF( restart11 .AND. .NOT. restart21 )
THEN
704 CALL
dlartgp( b21bulge, b21e(i-1), rwork(iv1tsn+i-1),
705 $ rwork(iv1tcs+i-1), r )
706 ELSE IF( mu .LE. nu )
THEN
707 CALL
dlartgs( b11d(i), b11e(i), mu, rwork(iv1tcs+i-1),
708 $ rwork(iv1tsn+i-1) )
710 CALL
dlartgs( b21d(i), b21e(i), nu, rwork(iv1tcs+i-1),
711 $ rwork(iv1tsn+i-1) )
713 rwork(iv1tcs+i-1) = -rwork(iv1tcs+i-1)
714 rwork(iv1tsn+i-1) = -rwork(iv1tsn+i-1)
715 IF( .NOT. restart12 .AND. .NOT. restart22 )
THEN
716 CALL
dlartgp( y2, y1, rwork(iv2tsn+i-1-1),
717 $ rwork(iv2tcs+i-1-1), r )
718 ELSE IF( .NOT. restart12 .AND. restart22 )
THEN
719 CALL
dlartgp( b12bulge, b12d(i-1), rwork(iv2tsn+i-1-1),
720 $ rwork(iv2tcs+i-1-1), r )
721 ELSE IF( restart12 .AND. .NOT. restart22 )
THEN
722 CALL
dlartgp( b22bulge, b22d(i-1), rwork(iv2tsn+i-1-1),
723 $ rwork(iv2tcs+i-1-1), r )
724 ELSE IF( nu .LT. mu )
THEN
725 CALL
dlartgs( b12e(i-1), b12d(i), nu,
726 $ rwork(iv2tcs+i-1-1), rwork(iv2tsn+i-1-1) )
728 CALL
dlartgs( b22e(i-1), b22d(i), mu,
729 $ rwork(iv2tcs+i-1-1), rwork(iv2tsn+i-1-1) )
732 temp = rwork(iv1tcs+i-1)*b11d(i) + rwork(iv1tsn+i-1)*b11e(i)
733 b11e(i) = rwork(iv1tcs+i-1)*b11e(i) -
734 $ rwork(iv1tsn+i-1)*b11d(i)
736 b11bulge = rwork(iv1tsn+i-1)*b11d(i+1)
737 b11d(i+1) = rwork(iv1tcs+i-1)*b11d(i+1)
738 temp = rwork(iv1tcs+i-1)*b21d(i) + rwork(iv1tsn+i-1)*b21e(i)
739 b21e(i) = rwork(iv1tcs+i-1)*b21e(i) -
740 $ rwork(iv1tsn+i-1)*b21d(i)
742 b21bulge = rwork(iv1tsn+i-1)*b21d(i+1)
743 b21d(i+1) = rwork(iv1tcs+i-1)*b21d(i+1)
744 temp = rwork(iv2tcs+i-1-1)*b12e(i-1) +
745 $ rwork(iv2tsn+i-1-1)*b12d(i)
746 b12d(i) = rwork(iv2tcs+i-1-1)*b12d(i) -
747 $ rwork(iv2tsn+i-1-1)*b12e(i-1)
749 b12bulge = rwork(iv2tsn+i-1-1)*b12e(i)
750 b12e(i) = rwork(iv2tcs+i-1-1)*b12e(i)
751 temp = rwork(iv2tcs+i-1-1)*b22e(i-1) +
752 $ rwork(iv2tsn+i-1-1)*b22d(i)
753 b22d(i) = rwork(iv2tcs+i-1-1)*b22d(i) -
754 $ rwork(iv2tsn+i-1-1)*b22e(i-1)
756 b22bulge = rwork(iv2tsn+i-1-1)*b22e(i)
757 b22e(i) = rwork(iv2tcs+i-1-1)*b22e(i)
761 x1 = cos(phi(i-1))*b11d(i) + sin(phi(i-1))*b12e(i-1)
762 x2 = cos(phi(i-1))*b11bulge + sin(phi(i-1))*b12bulge
763 y1 = cos(phi(i-1))*b21d(i) + sin(phi(i-1))*b22e(i-1)
764 y2 = cos(phi(i-1))*b21bulge + sin(phi(i-1))*b22bulge
766 theta(i) = atan2( sqrt(y1**2+y2**2), sqrt(x1**2+x2**2) )
771 restart11 = b11d(i)**2 + b11bulge**2 .LE. thresh**2
772 restart12 = b12e(i-1)**2 + b12bulge**2 .LE. thresh**2
773 restart21 = b21d(i)**2 + b21bulge**2 .LE. thresh**2
774 restart22 = b22e(i-1)**2 + b22bulge**2 .LE. thresh**2
780 IF( .NOT. restart11 .AND. .NOT. restart12 )
THEN
781 CALL
dlartgp( x2, x1, rwork(iu1sn+i-1), rwork(iu1cs+i-1),
783 ELSE IF( .NOT. restart11 .AND. restart12 )
THEN
784 CALL
dlartgp( b11bulge, b11d(i), rwork(iu1sn+i-1),
785 $ rwork(iu1cs+i-1), r )
786 ELSE IF( restart11 .AND. .NOT. restart12 )
THEN
787 CALL
dlartgp( b12bulge, b12e(i-1), rwork(iu1sn+i-1),
788 $ rwork(iu1cs+i-1), r )
789 ELSE IF( mu .LE. nu )
THEN
790 CALL
dlartgs( b11e(i), b11d(i+1), mu, rwork(iu1cs+i-1),
793 CALL
dlartgs( b12d(i), b12e(i), nu, rwork(iu1cs+i-1),
796 IF( .NOT. restart21 .AND. .NOT. restart22 )
THEN
797 CALL
dlartgp( y2, y1, rwork(iu2sn+i-1), rwork(iu2cs+i-1),
799 ELSE IF( .NOT. restart21 .AND. restart22 )
THEN
800 CALL
dlartgp( b21bulge, b21d(i), rwork(iu2sn+i-1),
801 $ rwork(iu2cs+i-1), r )
802 ELSE IF( restart21 .AND. .NOT. restart22 )
THEN
803 CALL
dlartgp( b22bulge, b22e(i-1), rwork(iu2sn+i-1),
804 $ rwork(iu2cs+i-1), r )
805 ELSE IF( nu .LT. mu )
THEN
806 CALL
dlartgs( b21e(i), b21e(i+1), nu, rwork(iu2cs+i-1),
809 CALL
dlartgs( b22d(i), b22e(i), mu, rwork(iu2cs+i-1),
812 rwork(iu2cs+i-1) = -rwork(iu2cs+i-1)
813 rwork(iu2sn+i-1) = -rwork(iu2sn+i-1)
815 temp = rwork(iu1cs+i-1)*b11e(i) + rwork(iu1sn+i-1)*b11d(i+1)
816 b11d(i+1) = rwork(iu1cs+i-1)*b11d(i+1) -
817 $ rwork(iu1sn+i-1)*b11e(i)
819 IF( i .LT. imax - 1 )
THEN
820 b11bulge = rwork(iu1sn+i-1)*b11e(i+1)
821 b11e(i+1) = rwork(iu1cs+i-1)*b11e(i+1)
823 temp = rwork(iu2cs+i-1)*b21e(i) + rwork(iu2sn+i-1)*b21d(i+1)
824 b21d(i+1) = rwork(iu2cs+i-1)*b21d(i+1) -
825 $ rwork(iu2sn+i-1)*b21e(i)
827 IF( i .LT. imax - 1 )
THEN
828 b21bulge = rwork(iu2sn+i-1)*b21e(i+1)
829 b21e(i+1) = rwork(iu2cs+i-1)*b21e(i+1)
831 temp = rwork(iu1cs+i-1)*b12d(i) + rwork(iu1sn+i-1)*b12e(i)
832 b12e(i) = rwork(iu1cs+i-1)*b12e(i) -
833 $ rwork(iu1sn+i-1)*b12d(i)
835 b12bulge = rwork(iu1sn+i-1)*b12d(i+1)
836 b12d(i+1) = rwork(iu1cs+i-1)*b12d(i+1)
837 temp = rwork(iu2cs+i-1)*b22d(i) + rwork(iu2sn+i-1)*b22e(i)
838 b22e(i) = rwork(iu2cs+i-1)*b22e(i) -
839 $ rwork(iu2sn+i-1)*b22d(i)
841 b22bulge = rwork(iu2sn+i-1)*b22d(i+1)
842 b22d(i+1) = rwork(iu2cs+i-1)*b22d(i+1)
848 x1 = sin(theta(imax-1))*b11e(imax-1) +
849 $ cos(theta(imax-1))*b21e(imax-1)
850 y1 = sin(theta(imax-1))*b12d(imax-1) +
851 $ cos(theta(imax-1))*b22d(imax-1)
852 y2 = sin(theta(imax-1))*b12bulge + cos(theta(imax-1))*b22bulge
854 phi(imax-1) = atan2( abs(x1), sqrt(y1**2+y2**2) )
858 restart12 = b12d(imax-1)**2 + b12bulge**2 .LE. thresh**2
859 restart22 = b22d(imax-1)**2 + b22bulge**2 .LE. thresh**2
861 IF( .NOT. restart12 .AND. .NOT. restart22 )
THEN
862 CALL
dlartgp( y2, y1, rwork(iv2tsn+imax-1-1),
863 $ rwork(iv2tcs+imax-1-1), r )
864 ELSE IF( .NOT. restart12 .AND. restart22 )
THEN
865 CALL
dlartgp( b12bulge, b12d(imax-1),
866 $ rwork(iv2tsn+imax-1-1),
867 $ rwork(iv2tcs+imax-1-1), r )
868 ELSE IF( restart12 .AND. .NOT. restart22 )
THEN
869 CALL
dlartgp( b22bulge, b22d(imax-1),
870 $ rwork(iv2tsn+imax-1-1),
871 $ rwork(iv2tcs+imax-1-1), r )
872 ELSE IF( nu .LT. mu )
THEN
873 CALL
dlartgs( b12e(imax-1), b12d(imax), nu,
874 $ rwork(iv2tcs+imax-1-1),
875 $ rwork(iv2tsn+imax-1-1) )
877 CALL
dlartgs( b22e(imax-1), b22d(imax), mu,
878 $ rwork(iv2tcs+imax-1-1),
879 $ rwork(iv2tsn+imax-1-1) )
882 temp = rwork(iv2tcs+imax-1-1)*b12e(imax-1) +
883 $ rwork(iv2tsn+imax-1-1)*b12d(imax)
884 b12d(imax) = rwork(iv2tcs+imax-1-1)*b12d(imax) -
885 $ rwork(iv2tsn+imax-1-1)*b12e(imax-1)
887 temp = rwork(iv2tcs+imax-1-1)*b22e(imax-1) +
888 $ rwork(iv2tsn+imax-1-1)*b22d(imax)
889 b22d(imax) = rwork(iv2tcs+imax-1-1)*b22d(imax) -
890 $ rwork(iv2tsn+imax-1-1)*b22e(imax-1)
897 CALL
zlasr(
'R',
'V',
'F', p, imax-imin+1,
898 $ rwork(iu1cs+imin-1), rwork(iu1sn+imin-1),
901 CALL
zlasr(
'L',
'V',
'F', imax-imin+1, p,
902 $ rwork(iu1cs+imin-1), rwork(iu1sn+imin-1),
908 CALL
zlasr(
'R',
'V',
'F', m-p, imax-imin+1,
909 $ rwork(iu2cs+imin-1), rwork(iu2sn+imin-1),
912 CALL
zlasr(
'L',
'V',
'F', imax-imin+1, m-p,
913 $ rwork(iu2cs+imin-1), rwork(iu2sn+imin-1),
919 CALL
zlasr(
'L',
'V',
'F', imax-imin+1, q,
920 $ rwork(iv1tcs+imin-1), rwork(iv1tsn+imin-1),
921 $ v1t(imin,1), ldv1t )
923 CALL
zlasr(
'R',
'V',
'F', q, imax-imin+1,
924 $ rwork(iv1tcs+imin-1), rwork(iv1tsn+imin-1),
925 $ v1t(1,imin), ldv1t )
930 CALL
zlasr(
'L',
'V',
'F', imax-imin+1, m-q,
931 $ rwork(iv2tcs+imin-1), rwork(iv2tsn+imin-1),
932 $ v2t(imin,1), ldv2t )
934 CALL
zlasr(
'R',
'V',
'F', m-q, imax-imin+1,
935 $ rwork(iv2tcs+imin-1), rwork(iv2tsn+imin-1),
936 $ v2t(1,imin), ldv2t )
942 IF( b11e(imax-1)+b21e(imax-1) .GT. 0 )
THEN
943 b11d(imax) = -b11d(imax)
944 b21d(imax) = -b21d(imax)
947 CALL
zscal( q, negonecomplex, v1t(imax,1), ldv1t )
949 CALL
zscal( q, negonecomplex, v1t(1,imax), 1 )
956 x1 = cos(phi(imax-1))*b11d(imax) +
957 $ sin(phi(imax-1))*b12e(imax-1)
958 y1 = cos(phi(imax-1))*b21d(imax) +
959 $ sin(phi(imax-1))*b22e(imax-1)
961 theta(imax) = atan2( abs(y1), abs(x1) )
966 IF( b11d(imax)+b12e(imax-1) .LT. 0 )
THEN
967 b12d(imax) = -b12d(imax)
970 CALL
zscal( p, negonecomplex, u1(1,imax), 1 )
972 CALL
zscal( p, negonecomplex, u1(imax,1), ldu1 )
976 IF( b21d(imax)+b22e(imax-1) .GT. 0 )
THEN
977 b22d(imax) = -b22d(imax)
980 CALL
zscal( m-p, negonecomplex, u2(1,imax), 1 )
982 CALL
zscal( m-p, negonecomplex, u2(imax,1), ldu2 )
989 IF( b12d(imax)+b22d(imax) .LT. 0 )
THEN
992 CALL
zscal( m-q, negonecomplex, v2t(imax,1), ldv2t )
994 CALL
zscal( m-q, negonecomplex, v2t(1,imax), 1 )
1002 IF( theta(i) .LT. thresh )
THEN
1004 ELSE IF( theta(i) .GT. piover2-thresh )
THEN
1009 IF( phi(i) .LT. thresh )
THEN
1011 ELSE IF( phi(i) .GT. piover2-thresh )
THEN
1018 IF (imax .GT. 1)
THEN
1019 DO WHILE( phi(imax-1) .EQ. zero )
1021 IF (imax .LE. 1) exit
1024 IF( imin .GT. imax - 1 )
1026 IF (imin .GT. 1)
THEN
1027 DO WHILE (phi(imin-1) .NE. zero)
1029 IF (imin .LE. 1) exit
1044 IF( theta(j) .LT. thetamin )
THEN
1050 IF( mini .NE. i )
THEN
1051 theta(mini) = theta(i)
1055 $ CALL
zswap( p, u1(1,i), 1, u1(1,mini), 1 )
1057 $ CALL
zswap( m-p, u2(1,i), 1, u2(1,mini), 1 )
1059 $ CALL
zswap( q, v1t(i,1), ldv1t, v1t(mini,1), ldv1t )
1061 $ CALL
zswap( m-q, v2t(i,1), ldv2t, v2t(mini,1),
1065 $ CALL
zswap( p, u1(i,1), ldu1, u1(mini,1), ldu1 )
1067 $ CALL
zswap( m-p, u2(i,1), ldu2, u2(mini,1), ldu2 )
1069 $ CALL
zswap( q, v1t(1,i), 1, v1t(1,mini), 1 )
1071 $ CALL
zswap( m-q, v2t(1,i), 1, v2t(1,mini), 1 )