301 SUBROUTINE shgeqz( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
302 $ ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK,
310 CHARACTER COMPQ, COMPZ, JOB
311 INTEGER IHI, ILO, INFO, LDH, LDQ, LDT, LDZ, LWORK, N
314 REAL ALPHAI( * ), ALPHAR( * ), BETA( * ),
315 $ h( ldh, * ), q( ldq, * ), t( ldt, * ),
316 $ work( * ), z( ldz, * )
323 REAL HALF, ZERO, ONE, SAFETY
324 parameter( half = 0.5e+0, zero = 0.0e+0, one = 1.0e+0,
328 LOGICAL ILAZR2, ILAZRO, ILPIVT, ILQ, ILSCHR, ILZ,
330 INTEGER ICOMPQ, ICOMPZ, IFIRST, IFRSTM, IITER, ILAST,
331 $ ilastm, in, ischur, istart, j, jc, jch, jiter,
333 REAL A11, A12, A1I, A1R, A21, A22, A2I, A2R, AD11,
334 $ ad11l, ad12, ad12l, ad21, ad21l, ad22, ad22l,
335 $ ad32l, an, anorm, ascale, atol, b11, b1a, b1i,
336 $ b1r, b22, b2a, b2i, b2r, bn, bnorm, bscale,
337 $ btol, c, c11i, c11r, c12, c21, c22i, c22r, cl,
338 $ cq, cr, cz, eshift, s, s1, s1inv, s2, safmax,
339 $ safmin, scale, sl, sqi, sqr, sr, szi, szr, t1,
340 $ tau, temp, temp2, tempi, tempr, u1, u12, u12l,
341 $ u2, ulp, vs, w11, w12, w21, w22, wabs, wi, wr,
349 REAL SLAMCH, SLANHS, SLAPY2, SLAPY3
350 EXTERNAL lsame, slamch, slanhs, slapy2, slapy3
357 INTRINSIC abs, max, min,
REAL, SQRT
363 IF( lsame( job,
'E' ) )
THEN 366 ELSE IF( lsame( job,
'S' ) )
THEN 373 IF( lsame( compq,
'N' ) )
THEN 376 ELSE IF( lsame( compq,
'V' ) )
THEN 379 ELSE IF( lsame( compq,
'I' ) )
THEN 386 IF( lsame( compz,
'N' ) )
THEN 389 ELSE IF( lsame( compz,
'V' ) )
THEN 392 ELSE IF( lsame( compz,
'I' ) )
THEN 402 work( 1 ) = max( 1, n )
403 lquery = ( lwork.EQ.-1 )
404 IF( ischur.EQ.0 )
THEN 406 ELSE IF( icompq.EQ.0 )
THEN 408 ELSE IF( icompz.EQ.0 )
THEN 410 ELSE IF( n.LT.0 )
THEN 412 ELSE IF( ilo.LT.1 )
THEN 414 ELSE IF( ihi.GT.n .OR. ihi.LT.ilo-1 )
THEN 416 ELSE IF( ldh.LT.n )
THEN 418 ELSE IF( ldt.LT.n )
THEN 420 ELSE IF( ldq.LT.1 .OR. ( ilq .AND. ldq.LT.n ) )
THEN 422 ELSE IF( ldz.LT.1 .OR. ( ilz .AND. ldz.LT.n ) )
THEN 424 ELSE IF( lwork.LT.max( 1, n ) .AND. .NOT.lquery )
THEN 428 CALL xerbla(
'SHGEQZ', -info )
430 ELSE IF( lquery )
THEN 437 work( 1 ) =
REAL( 1 )
444 $
CALL slaset(
'Full', n, n, zero, one, q, ldq )
446 $
CALL slaset(
'Full', n, n, zero, one, z, ldz )
451 safmin = slamch(
'S' )
452 safmax = one / safmin
453 ulp = slamch(
'E' )*slamch(
'B' )
454 anorm = slanhs(
'F', in, h( ilo, ilo ), ldh, work )
455 bnorm = slanhs(
'F', in, t( ilo, ilo ), ldt, work )
456 atol = max( safmin, ulp*anorm )
457 btol = max( safmin, ulp*bnorm )
458 ascale = one / max( safmin, anorm )
459 bscale = one / max( safmin, bnorm )
464 IF( t( j, j ).LT.zero )
THEN 467 h( jr, j ) = -h( jr, j )
468 t( jr, j ) = -t( jr, j )
471 h( j, j ) = -h( j, j )
472 t( j, j ) = -t( j, j )
476 z( jr, j ) = -z( jr, j )
480 alphar( j ) = h( j, j )
482 beta( j ) = t( j, j )
515 maxit = 30*( ihi-ilo+1 )
517 DO 360 jiter = 1, maxit
525 IF( ilast.EQ.ilo )
THEN 531 IF( abs( h( ilast, ilast-1 ) ).LE.max( safmin, ulp*(
532 $ abs( h( ilast, ilast ) ) + abs( h( ilast-1, ilast-1 ) )
534 h( ilast, ilast-1 ) = zero
539 IF( abs( t( ilast, ilast ) ).LE.btol )
THEN 540 t( ilast, ilast ) = zero
546 DO 60 j = ilast - 1, ilo, -1
553 IF( abs( h( j, j-1 ) ).LE.max( safmin, ulp*(
554 $ abs( h( j, j ) ) + abs( h( j-1, j-1 ) )
565 IF( abs( t( j, j ) ).LT.btol )
THEN 571 IF( .NOT.ilazro )
THEN 572 temp = abs( h( j, j-1 ) )
573 temp2 = abs( h( j, j ) )
574 tempr = max( temp, temp2 )
575 IF( tempr.LT.one .AND. tempr.NE.zero )
THEN 577 temp2 = temp2 / tempr
579 IF( temp*( ascale*abs( h( j+1, j ) ) ).LE.temp2*
580 $ ( ascale*atol ) )ilazr2 = .true.
589 IF( ilazro .OR. ilazr2 )
THEN 590 DO 40 jch = j, ilast - 1
592 CALL slartg( temp, h( jch+1, jch ), c, s,
594 h( jch+1, jch ) = zero
595 CALL srot( ilastm-jch, h( jch, jch+1 ), ldh,
596 $ h( jch+1, jch+1 ), ldh, c, s )
597 CALL srot( ilastm-jch, t( jch, jch+1 ), ldt,
598 $ t( jch+1, jch+1 ), ldt, c, s )
600 $
CALL srot( n, q( 1, jch ), 1, q( 1, jch+1 ), 1,
603 $ h( jch, jch-1 ) = h( jch, jch-1 )*c
605 IF( abs( t( jch+1, jch+1 ) ).GE.btol )
THEN 606 IF( jch+1.GE.ilast )
THEN 613 t( jch+1, jch+1 ) = zero
621 DO 50 jch = j, ilast - 1
622 temp = t( jch, jch+1 )
623 CALL slartg( temp, t( jch+1, jch+1 ), c, s,
625 t( jch+1, jch+1 ) = zero
626 IF( jch.LT.ilastm-1 )
627 $
CALL srot( ilastm-jch-1, t( jch, jch+2 ), ldt,
628 $ t( jch+1, jch+2 ), ldt, c, s )
629 CALL srot( ilastm-jch+2, h( jch, jch-1 ), ldh,
630 $ h( jch+1, jch-1 ), ldh, c, s )
632 $
CALL srot( n, q( 1, jch ), 1, q( 1, jch+1 ), 1,
634 temp = h( jch+1, jch )
635 CALL slartg( temp, h( jch+1, jch-1 ), c, s,
637 h( jch+1, jch-1 ) = zero
638 CALL srot( jch+1-ifrstm, h( ifrstm, jch ), 1,
639 $ h( ifrstm, jch-1 ), 1, c, s )
640 CALL srot( jch-ifrstm, t( ifrstm, jch ), 1,
641 $ t( ifrstm, jch-1 ), 1, c, s )
643 $
CALL srot( n, z( 1, jch ), 1, z( 1, jch-1 ), 1,
648 ELSE IF( ilazro )
THEN 669 temp = h( ilast, ilast )
670 CALL slartg( temp, h( ilast, ilast-1 ), c, s,
671 $ h( ilast, ilast ) )
672 h( ilast, ilast-1 ) = zero
673 CALL srot( ilast-ifrstm, h( ifrstm, ilast ), 1,
674 $ h( ifrstm, ilast-1 ), 1, c, s )
675 CALL srot( ilast-ifrstm, t( ifrstm, ilast ), 1,
676 $ t( ifrstm, ilast-1 ), 1, c, s )
678 $
CALL srot( n, z( 1, ilast ), 1, z( 1, ilast-1 ), 1, c, s )
684 IF( t( ilast, ilast ).LT.zero )
THEN 686 DO 90 j = ifrstm, ilast
687 h( j, ilast ) = -h( j, ilast )
688 t( j, ilast ) = -t( j, ilast )
691 h( ilast, ilast ) = -h( ilast, ilast )
692 t( ilast, ilast ) = -t( ilast, ilast )
696 z( j, ilast ) = -z( j, ilast )
700 alphar( ilast ) = h( ilast, ilast )
701 alphai( ilast ) = zero
702 beta( ilast ) = t( ilast, ilast )
714 IF( .NOT.ilschr )
THEN 716 IF( ifrstm.GT.ilast )
728 IF( .NOT.ilschr )
THEN 738 IF( ( iiter / 10 )*10.EQ.iiter )
THEN 743 IF( (
REAL( maxit )*SAFMIN )*abs( H( ilast, ilast-1 ) ).LT.
744 $ abs( t( ilast-1, ilast-1 ) ) )
THEN 745 eshift = h( ilast, ilast-1 ) /
746 $ t( ilast-1, ilast-1 )
748 eshift = eshift + one / ( safmin*
REAL( MAXIT ) )
759 CALL slag2( h( ilast-1, ilast-1 ), ldh,
760 $ t( ilast-1, ilast-1 ), ldt, safmin*safety, s1,
763 IF ( abs( (wr/s1)*t( ilast, ilast ) - h( ilast, ilast ) )
764 $ .GT. abs( (wr2/s2)*t( ilast, ilast )
765 $ - h( ilast, ilast ) ) )
THEN 773 temp = max( s1, safmin*max( one, abs( wr ), abs( wi ) ) )
780 temp = min( ascale, one )*( half*safmax )
781 IF( s1.GT.temp )
THEN 787 temp = min( bscale, one )*( half*safmax )
788 IF( abs( wr ).GT.temp )
789 $ scale = min( scale, temp / abs( wr ) )
795 DO 120 j = ilast - 1, ifirst + 1, -1
797 temp = abs( s1*h( j, j-1 ) )
798 temp2 = abs( s1*h( j, j )-wr*t( j, j ) )
799 tempr = max( temp, temp2 )
800 IF( tempr.LT.one .AND. tempr.NE.zero )
THEN 802 temp2 = temp2 / tempr
804 IF( abs( ( ascale*h( j+1, j ) )*temp ).LE.( ascale*atol )*
815 temp = s1*h( istart, istart ) - wr*t( istart, istart )
816 temp2 = s1*h( istart+1, istart )
817 CALL slartg( temp, temp2, c, s, tempr )
821 DO 190 j = istart, ilast - 1
822 IF( j.GT.istart )
THEN 824 CALL slartg( temp, h( j+1, j-1 ), c, s, h( j, j-1 ) )
828 DO 140 jc = j, ilastm
829 temp = c*h( j, jc ) + s*h( j+1, jc )
830 h( j+1, jc ) = -s*h( j, jc ) + c*h( j+1, jc )
832 temp2 = c*t( j, jc ) + s*t( j+1, jc )
833 t( j+1, jc ) = -s*t( j, jc ) + c*t( j+1, jc )
838 temp = c*q( jr, j ) + s*q( jr, j+1 )
839 q( jr, j+1 ) = -s*q( jr, j ) + c*q( jr, j+1 )
845 CALL slartg( temp, t( j+1, j ), c, s, t( j+1, j+1 ) )
848 DO 160 jr = ifrstm, min( j+2, ilast )
849 temp = c*h( jr, j+1 ) + s*h( jr, j )
850 h( jr, j ) = -s*h( jr, j+1 ) + c*h( jr, j )
853 DO 170 jr = ifrstm, j
854 temp = c*t( jr, j+1 ) + s*t( jr, j )
855 t( jr, j ) = -s*t( jr, j+1 ) + c*t( jr, j )
860 temp = c*z( jr, j+1 ) + s*z( jr, j )
861 z( jr, j ) = -s*z( jr, j+1 ) + c*z( jr, j )
877 IF( ifirst+1.EQ.ilast )
THEN 887 CALL slasv2( t( ilast-1, ilast-1 ), t( ilast-1, ilast ),
888 $ t( ilast, ilast ), b22, b11, sr, cr, sl, cl )
890 IF( b11.LT.zero )
THEN 897 CALL srot( ilastm+1-ifirst, h( ilast-1, ilast-1 ), ldh,
898 $ h( ilast, ilast-1 ), ldh, cl, sl )
899 CALL srot( ilast+1-ifrstm, h( ifrstm, ilast-1 ), 1,
900 $ h( ifrstm, ilast ), 1, cr, sr )
902 IF( ilast.LT.ilastm )
903 $
CALL srot( ilastm-ilast, t( ilast-1, ilast+1 ), ldt,
904 $ t( ilast, ilast+1 ), ldt, cl, sl )
905 IF( ifrstm.LT.ilast-1 )
906 $
CALL srot( ifirst-ifrstm, t( ifrstm, ilast-1 ), 1,
907 $ t( ifrstm, ilast ), 1, cr, sr )
910 $
CALL srot( n, q( 1, ilast-1 ), 1, q( 1, ilast ), 1, cl,
913 $
CALL srot( n, z( 1, ilast-1 ), 1, z( 1, ilast ), 1, cr,
916 t( ilast-1, ilast-1 ) = b11
917 t( ilast-1, ilast ) = zero
918 t( ilast, ilast-1 ) = zero
919 t( ilast, ilast ) = b22
923 IF( b22.LT.zero )
THEN 924 DO 210 j = ifrstm, ilast
925 h( j, ilast ) = -h( j, ilast )
926 t( j, ilast ) = -t( j, ilast )
931 z( j, ilast ) = -z( j, ilast )
941 CALL slag2( h( ilast-1, ilast-1 ), ldh,
942 $ t( ilast-1, ilast-1 ), ldt, safmin*safety, s1,
943 $ temp, wr, temp2, wi )
954 a11 = h( ilast-1, ilast-1 )
955 a21 = h( ilast, ilast-1 )
956 a12 = h( ilast-1, ilast )
957 a22 = h( ilast, ilast )
965 c11r = s1*a11 - wr*b11
969 c22r = s1*a22 - wr*b22
972 IF( abs( c11r )+abs( c11i )+abs( c12 ).GT.abs( c21 )+
973 $ abs( c22r )+abs( c22i ) )
THEN 974 t1 = slapy3( c12, c11r, c11i )
979 cz = slapy2( c22r, c22i )
980 IF( cz.LE.safmin )
THEN 987 t1 = slapy2( cz, c21 )
989 szr = -c21*tempr / t1
1000 an = abs( a11 ) + abs( a12 ) + abs( a21 ) + abs( a22 )
1001 bn = abs( b11 ) + abs( b22 )
1002 wabs = abs( wr ) + abs( wi )
1003 IF( s1*an.GT.wabs*bn )
THEN 1008 a1r = cz*a11 + szr*a12
1010 a2r = cz*a21 + szr*a22
1012 cq = slapy2( a1r, a1i )
1013 IF( cq.LE.safmin )
THEN 1020 sqr = tempr*a2r + tempi*a2i
1021 sqi = tempi*a2r - tempr*a2i
1024 t1 = slapy3( cq, sqr, sqi )
1031 tempr = sqr*szr - sqi*szi
1032 tempi = sqr*szi + sqi*szr
1033 b1r = cq*cz*b11 + tempr*b22
1035 b1a = slapy2( b1r, b1i )
1036 b2r = cq*cz*b22 + tempr*b11
1038 b2a = slapy2( b2r, b2i )
1042 beta( ilast-1 ) = b1a
1044 alphar( ilast-1 ) = ( wr*b1a )*s1inv
1045 alphai( ilast-1 ) = ( wi*b1a )*s1inv
1046 alphar( ilast ) = ( wr*b2a )*s1inv
1047 alphai( ilast ) = -( wi*b2a )*s1inv
1059 IF( .NOT.ilschr )
THEN 1061 IF( ifrstm.GT.ilast )
1079 ad11 = ( ascale*h( ilast-1, ilast-1 ) ) /
1080 $ ( bscale*t( ilast-1, ilast-1 ) )
1081 ad21 = ( ascale*h( ilast, ilast-1 ) ) /
1082 $ ( bscale*t( ilast-1, ilast-1 ) )
1083 ad12 = ( ascale*h( ilast-1, ilast ) ) /
1084 $ ( bscale*t( ilast, ilast ) )
1085 ad22 = ( ascale*h( ilast, ilast ) ) /
1086 $ ( bscale*t( ilast, ilast ) )
1087 u12 = t( ilast-1, ilast ) / t( ilast, ilast )
1088 ad11l = ( ascale*h( ifirst, ifirst ) ) /
1089 $ ( bscale*t( ifirst, ifirst ) )
1090 ad21l = ( ascale*h( ifirst+1, ifirst ) ) /
1091 $ ( bscale*t( ifirst, ifirst ) )
1092 ad12l = ( ascale*h( ifirst, ifirst+1 ) ) /
1093 $ ( bscale*t( ifirst+1, ifirst+1 ) )
1094 ad22l = ( ascale*h( ifirst+1, ifirst+1 ) ) /
1095 $ ( bscale*t( ifirst+1, ifirst+1 ) )
1096 ad32l = ( ascale*h( ifirst+2, ifirst+1 ) ) /
1097 $ ( bscale*t( ifirst+1, ifirst+1 ) )
1098 u12l = t( ifirst, ifirst+1 ) / t( ifirst+1, ifirst+1 )
1100 v( 1 ) = ( ad11-ad11l )*( ad22-ad11l ) - ad12*ad21 +
1101 $ ad21*u12*ad11l + ( ad12l-ad11l*u12l )*ad21l
1102 v( 2 ) = ( ( ad22l-ad11l )-ad21l*u12l-( ad11-ad11l )-
1103 $ ( ad22-ad11l )+ad21*u12 )*ad21l
1104 v( 3 ) = ad32l*ad21l
1108 CALL slarfg( 3, v( 1 ), v( 2 ), 1, tau )
1113 DO 290 j = istart, ilast - 2
1119 IF( j.GT.istart )
THEN 1120 v( 1 ) = h( j, j-1 )
1121 v( 2 ) = h( j+1, j-1 )
1122 v( 3 ) = h( j+2, j-1 )
1124 CALL slarfg( 3, h( j, j-1 ), v( 2 ), 1, tau )
1126 h( j+1, j-1 ) = zero
1127 h( j+2, j-1 ) = zero
1130 DO 230 jc = j, ilastm
1131 temp = tau*( h( j, jc )+v( 2 )*h( j+1, jc )+v( 3 )*
1133 h( j, jc ) = h( j, jc ) - temp
1134 h( j+1, jc ) = h( j+1, jc ) - temp*v( 2 )
1135 h( j+2, jc ) = h( j+2, jc ) - temp*v( 3 )
1136 temp2 = tau*( t( j, jc )+v( 2 )*t( j+1, jc )+v( 3 )*
1138 t( j, jc ) = t( j, jc ) - temp2
1139 t( j+1, jc ) = t( j+1, jc ) - temp2*v( 2 )
1140 t( j+2, jc ) = t( j+2, jc ) - temp2*v( 3 )
1144 temp = tau*( q( jr, j )+v( 2 )*q( jr, j+1 )+v( 3 )*
1146 q( jr, j ) = q( jr, j ) - temp
1147 q( jr, j+1 ) = q( jr, j+1 ) - temp*v( 2 )
1148 q( jr, j+2 ) = q( jr, j+2 ) - temp*v( 3 )
1157 temp = max( abs( t( j+1, j+1 ) ), abs( t( j+1, j+2 ) ) )
1158 temp2 = max( abs( t( j+2, j+1 ) ), abs( t( j+2, j+2 ) ) )
1159 IF( max( temp, temp2 ).LT.safmin )
THEN 1164 ELSE IF( temp.GE.temp2 )
THEN 1182 IF( abs( w12 ).GT.abs( w11 ) )
THEN 1196 w22 = w22 - temp*w12
1202 IF( abs( w22 ).LT.safmin )
THEN 1208 IF( abs( w22 ).LT.abs( u2 ) )
1209 $ scale = abs( w22 / u2 )
1210 IF( abs( w11 ).LT.abs( u1 ) )
1211 $ scale = min( scale, abs( w11 / u1 ) )
1215 u2 = ( scale*u2 ) / w22
1216 u1 = ( scale*u1-w12*u2 ) / w11
1227 t1 = sqrt( scale**2+u1**2+u2**2 )
1228 tau = one + scale / t1
1229 vs = -one / ( scale+t1 )
1236 DO 260 jr = ifrstm, min( j+3, ilast )
1237 temp = tau*( h( jr, j )+v( 2 )*h( jr, j+1 )+v( 3 )*
1239 h( jr, j ) = h( jr, j ) - temp
1240 h( jr, j+1 ) = h( jr, j+1 ) - temp*v( 2 )
1241 h( jr, j+2 ) = h( jr, j+2 ) - temp*v( 3 )
1243 DO 270 jr = ifrstm, j + 2
1244 temp = tau*( t( jr, j )+v( 2 )*t( jr, j+1 )+v( 3 )*
1246 t( jr, j ) = t( jr, j ) - temp
1247 t( jr, j+1 ) = t( jr, j+1 ) - temp*v( 2 )
1248 t( jr, j+2 ) = t( jr, j+2 ) - temp*v( 3 )
1252 temp = tau*( z( jr, j )+v( 2 )*z( jr, j+1 )+v( 3 )*
1254 z( jr, j ) = z( jr, j ) - temp
1255 z( jr, j+1 ) = z( jr, j+1 ) - temp*v( 2 )
1256 z( jr, j+2 ) = z( jr, j+2 ) - temp*v( 3 )
1269 CALL slartg( temp, h( j+1, j-1 ), c, s, h( j, j-1 ) )
1270 h( j+1, j-1 ) = zero
1272 DO 300 jc = j, ilastm
1273 temp = c*h( j, jc ) + s*h( j+1, jc )
1274 h( j+1, jc ) = -s*h( j, jc ) + c*h( j+1, jc )
1276 temp2 = c*t( j, jc ) + s*t( j+1, jc )
1277 t( j+1, jc ) = -s*t( j, jc ) + c*t( j+1, jc )
1282 temp = c*q( jr, j ) + s*q( jr, j+1 )
1283 q( jr, j+1 ) = -s*q( jr, j ) + c*q( jr, j+1 )
1290 temp = t( j+1, j+1 )
1291 CALL slartg( temp, t( j+1, j ), c, s, t( j+1, j+1 ) )
1294 DO 320 jr = ifrstm, ilast
1295 temp = c*h( jr, j+1 ) + s*h( jr, j )
1296 h( jr, j ) = -s*h( jr, j+1 ) + c*h( jr, j )
1299 DO 330 jr = ifrstm, ilast - 1
1300 temp = c*t( jr, j+1 ) + s*t( jr, j )
1301 t( jr, j ) = -s*t( jr, j+1 ) + c*t( jr, j )
1306 temp = c*z( jr, j+1 ) + s*z( jr, j )
1307 z( jr, j ) = -s*z( jr, j+1 ) + c*z( jr, j )
1334 DO 410 j = 1, ilo - 1
1335 IF( t( j, j ).LT.zero )
THEN 1338 h( jr, j ) = -h( jr, j )
1339 t( jr, j ) = -t( jr, j )
1342 h( j, j ) = -h( j, j )
1343 t( j, j ) = -t( j, j )
1347 z( jr, j ) = -z( jr, j )
1351 alphar( j ) = h( j, j )
1353 beta( j ) = t( j, j )
1363 work( 1 ) =
REAL( n )
subroutine shgeqz(JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT, ALPHAR, ALPHAI, BETA, Q, LDQ, Z, LDZ, WORK, LWORK, INFO)
SHGEQZ
subroutine slasv2(F, G, H, SSMIN, SSMAX, SNR, CSR, SNL, CSL)
SLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix.
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
subroutine slag2(A, LDA, B, LDB, SAFMIN, SCALE1, SCALE2, WR1, WR2, WI)
SLAG2 computes the eigenvalues of a 2-by-2 generalized eigenvalue problem, with scaling as necessary ...
subroutine srot(N, SX, INCX, SY, INCY, C, S)
SROT
subroutine slarfg(N, ALPHA, X, INCX, TAU)
SLARFG generates an elementary reflector (Householder matrix).