Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add numerical tests for trevc3 #682

Merged
merged 3 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions SRC/claqr5.f
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,13 @@ SUBROUTINE CLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
* . Mth bulge. Exploit fact that first two elements
* . of row are actually zero. ====
*
REFSUM = V( 1, M )*V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM
H( K+3, K+1 ) = -REFSUM*CONJG( V( 2, M ) )
H( K+3, K+2 ) = H( K+3, K+2 ) -
$ REFSUM*CONJG( V( 3, M ) )
T1 = V( 1, M )
T2 = T1*CONJG( V( 2, M ) )
T3 = T1*CONJG( V( 3, M ) )
REFSUM = V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM*T1
H( K+3, K+1 ) = -REFSUM*T2
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*T3
*
* ==== Calculate reflection to move
* . Mth bulge one step. ====
Expand Down Expand Up @@ -572,12 +574,13 @@ SUBROUTINE CLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
$ S( 2*M ), VT )
ALPHA = VT( 1 )
CALL CLARFG( 3, ALPHA, VT( 2 ), 1, VT( 1 ) )
REFSUM = CONJG( VT( 1 ) )*
$ ( H( K+1, K )+CONJG( VT( 2 ) )*
$ H( K+2, K ) )
T1 = CONJG( VT( 1 ) )
T2 = T1*VT( 2 )
T3 = T1*VT( 3 )
REFSUM = H( K+1, K )+CONJG( VT( 2 ) )*H( K+2, K )
*
IF( CABS1( H( K+2, K )-REFSUM*VT( 2 ) )+
$ CABS1( REFSUM*VT( 3 ) ).GT.ULP*
IF( CABS1( H( K+2, K )-REFSUM*T2 )+
$ CABS1( REFSUM*T3 ).GT.ULP*
$ ( CABS1( H( K, K ) )+CABS1( H( K+1,
$ K+1 ) )+CABS1( H( K+2, K+2 ) ) ) ) THEN
*
Expand All @@ -595,7 +598,7 @@ SUBROUTINE CLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
* . Replace the old reflector with
* . the new one. ====
*
H( K+1, K ) = H( K+1, K ) - REFSUM
H( K+1, K ) = H( K+1, K ) - REFSUM*T1
H( K+2, K ) = ZERO
H( K+3, K ) = ZERO
V( 1, M ) = VT( 1 )
Expand Down
70 changes: 37 additions & 33 deletions SRC/dhgeqz.f
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ SUBROUTINE DHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
$ BTOL, C, C11I, C11R, C12, C21, C22I, C22R, CL,
$ CQ, CR, CZ, ESHIFT, S, S1, S1INV, S2, SAFMAX,
$ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T1,
$ TAU, TEMP, TEMP2, TEMPI, TEMPR, U1, U12, U12L,
$ U2, ULP, VS, W11, W12, W21, W22, WABS, WI, WR,
$ WR2
$ T2, T3, TAU, TEMP, TEMP2, TEMPI, TEMPR, U1,
$ U12, U12L, U2, ULP, VS, W11, W12, W21, W22,
$ WABS, WI, WR, WR2
* ..
* .. Local Arrays ..
DOUBLE PRECISION V( 3 )
Expand Down Expand Up @@ -1132,25 +1132,27 @@ SUBROUTINE DHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
H( J+2, J-1 ) = ZERO
END IF
*
T2 = TAU*V( 2 )
T3 = TAU*V( 3 )
DO 230 JC = J, ILASTM
TEMP = TAU*( H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
$ H( J+2, JC ) )
H( J, JC ) = H( J, JC ) - TEMP
H( J+1, JC ) = H( J+1, JC ) - TEMP*V( 2 )
H( J+2, JC ) = H( J+2, JC ) - TEMP*V( 3 )
TEMP2 = TAU*( T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
$ T( J+2, JC ) )
T( J, JC ) = T( J, JC ) - TEMP2
T( J+1, JC ) = T( J+1, JC ) - TEMP2*V( 2 )
T( J+2, JC ) = T( J+2, JC ) - TEMP2*V( 3 )
TEMP = H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
$ H( J+2, JC )
H( J, JC ) = H( J, JC ) - TEMP*TAU
H( J+1, JC ) = H( J+1, JC ) - TEMP*T2
H( J+2, JC ) = H( J+2, JC ) - TEMP*T3
TEMP2 = T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
$ T( J+2, JC )
T( J, JC ) = T( J, JC ) - TEMP2*TAU
T( J+1, JC ) = T( J+1, JC ) - TEMP2*T2
T( J+2, JC ) = T( J+2, JC ) - TEMP2*T3
230 CONTINUE
IF( ILQ ) THEN
DO 240 JR = 1, N
TEMP = TAU*( Q( JR, J )+V( 2 )*Q( JR, J+1 )+V( 3 )*
$ Q( JR, J+2 ) )
Q( JR, J ) = Q( JR, J ) - TEMP
Q( JR, J+1 ) = Q( JR, J+1 ) - TEMP*V( 2 )
Q( JR, J+2 ) = Q( JR, J+2 ) - TEMP*V( 3 )
TEMP = Q( JR, J )+V( 2 )*Q( JR, J+1 )+V( 3 )*
$ Q( JR, J+2 )
Q( JR, J ) = Q( JR, J ) - TEMP*TAU
Q( JR, J+1 ) = Q( JR, J+1 ) - TEMP*T2
Q( JR, J+2 ) = Q( JR, J+2 ) - TEMP*T3
240 CONTINUE
END IF
*
Expand Down Expand Up @@ -1238,27 +1240,29 @@ SUBROUTINE DHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
*
* Apply transformations from the right.
*
T2 = TAU*V(2)
T3 = TAU*V(3)
DO 260 JR = IFRSTM, MIN( J+3, ILAST )
TEMP = TAU*( H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
$ H( JR, J+2 ) )
H( JR, J ) = H( JR, J ) - TEMP
H( JR, J+1 ) = H( JR, J+1 ) - TEMP*V( 2 )
H( JR, J+2 ) = H( JR, J+2 ) - TEMP*V( 3 )
TEMP = H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
$ H( JR, J+2 )
H( JR, J ) = H( JR, J ) - TEMP*TAU
H( JR, J+1 ) = H( JR, J+1 ) - TEMP*T2
H( JR, J+2 ) = H( JR, J+2 ) - TEMP*T3
260 CONTINUE
DO 270 JR = IFRSTM, J + 2
TEMP = TAU*( T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
$ T( JR, J+2 ) )
T( JR, J ) = T( JR, J ) - TEMP
T( JR, J+1 ) = T( JR, J+1 ) - TEMP*V( 2 )
T( JR, J+2 ) = T( JR, J+2 ) - TEMP*V( 3 )
TEMP = T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
$ T( JR, J+2 )
T( JR, J ) = T( JR, J ) - TEMP*TAU
T( JR, J+1 ) = T( JR, J+1 ) - TEMP*T2
T( JR, J+2 ) = T( JR, J+2 ) - TEMP*T3
270 CONTINUE
IF( ILZ ) THEN
DO 280 JR = 1, N
TEMP = TAU*( Z( JR, J )+V( 2 )*Z( JR, J+1 )+V( 3 )*
$ Z( JR, J+2 ) )
Z( JR, J ) = Z( JR, J ) - TEMP
Z( JR, J+1 ) = Z( JR, J+1 ) - TEMP*V( 2 )
Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*V( 3 )
TEMP = Z( JR, J )+V( 2 )*Z( JR, J+1 )+V( 3 )*
$ Z( JR, J+2 )
Z( JR, J ) = Z( JR, J ) - TEMP*TAU
Z( JR, J+1 ) = Z( JR, J+1 ) - TEMP*T2
Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*T3
280 CONTINUE
END IF
T( J+1, J ) = ZERO
Expand Down
23 changes: 14 additions & 9 deletions SRC/dlaqr5.f
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,13 @@ SUBROUTINE DLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
* . Mth bulge. Exploit fact that first two elements
* . of row are actually zero. ====
*
REFSUM = V( 1, M )*V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM
H( K+3, K+1 ) = -REFSUM*V( 2, M )
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*V( 3, M )
T1 = V( 1, M )
T2 = T1*V( 2, M )
T3 = T1*V( 3, M )
REFSUM = V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM*T1
H( K+3, K+1 ) = -REFSUM*T2
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*T3
*
* ==== Calculate reflection to move
* . Mth bulge one step. ====
Expand Down Expand Up @@ -597,11 +600,13 @@ SUBROUTINE DLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
$ VT )
ALPHA = VT( 1 )
CALL DLARFG( 3, ALPHA, VT( 2 ), 1, VT( 1 ) )
REFSUM = VT( 1 )*( H( K+1, K )+VT( 2 )*
$ H( K+2, K ) )
T1 = VT( 1 )
T2 = T1*VT( 2 )
T3 = T1*VT( 3 )
REFSUM = H( K+1, K ) + VT( 2 )*H( K+2, K )
*
IF( ABS( H( K+2, K )-REFSUM*VT( 2 ) )+
$ ABS( REFSUM*VT( 3 ) ).GT.ULP*
IF( ABS( H( K+2, K )-REFSUM*T2 )+
$ ABS( REFSUM*T3 ).GT.ULP*
$ ( ABS( H( K, K ) )+ABS( H( K+1,
$ K+1 ) )+ABS( H( K+2, K+2 ) ) ) ) THEN
*
Expand All @@ -619,7 +624,7 @@ SUBROUTINE DLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
* . Replace the old reflector with
* . the new one. ====
*
H( K+1, K ) = H( K+1, K ) - REFSUM
H( K+1, K ) = H( K+1, K ) - REFSUM*T1
H( K+2, K ) = ZERO
H( K+3, K ) = ZERO
V( 1, M ) = VT( 1 )
Expand Down
70 changes: 37 additions & 33 deletions SRC/shgeqz.f
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ SUBROUTINE SHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
$ BTOL, C, C11I, C11R, C12, C21, C22I, C22R, CL,
$ CQ, CR, CZ, ESHIFT, S, S1, S1INV, S2, SAFMAX,
$ SAFMIN, SCALE, SL, SQI, SQR, SR, SZI, SZR, T1,
$ TAU, TEMP, TEMP2, TEMPI, TEMPR, U1, U12, U12L,
$ U2, ULP, VS, W11, W12, W21, W22, WABS, WI, WR,
$ WR2
$ T2, T3, TAU, TEMP, TEMP2, TEMPI, TEMPR, U1,
$ U12, U12L, U2, ULP, VS, W11, W12, W21, W22,
$ WABS, WI, WR, WR2
* ..
* .. Local Arrays ..
REAL V( 3 )
Expand Down Expand Up @@ -1132,25 +1132,27 @@ SUBROUTINE SHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
H( J+2, J-1 ) = ZERO
END IF
*
T2 = TAU * V( 2 )
T3 = TAU * V( 3 )
DO 230 JC = J, ILASTM
TEMP = TAU*( H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
$ H( J+2, JC ) )
H( J, JC ) = H( J, JC ) - TEMP
H( J+1, JC ) = H( J+1, JC ) - TEMP*V( 2 )
H( J+2, JC ) = H( J+2, JC ) - TEMP*V( 3 )
TEMP2 = TAU*( T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
$ T( J+2, JC ) )
T( J, JC ) = T( J, JC ) - TEMP2
T( J+1, JC ) = T( J+1, JC ) - TEMP2*V( 2 )
T( J+2, JC ) = T( J+2, JC ) - TEMP2*V( 3 )
TEMP = H( J, JC )+V( 2 )*H( J+1, JC )+V( 3 )*
$ H( J+2, JC )
H( J, JC ) = H( J, JC ) - TEMP*TAU
H( J+1, JC ) = H( J+1, JC ) - TEMP*T2
H( J+2, JC ) = H( J+2, JC ) - TEMP*T3
TEMP2 = T( J, JC )+V( 2 )*T( J+1, JC )+V( 3 )*
$ T( J+2, JC )
T( J, JC ) = T( J, JC ) - TEMP2*TAU
T( J+1, JC ) = T( J+1, JC ) - TEMP2*T2
T( J+2, JC ) = T( J+2, JC ) - TEMP2*T3
230 CONTINUE
IF( ILQ ) THEN
DO 240 JR = 1, N
TEMP = TAU*( Q( JR, J )+V( 2 )*Q( JR, J+1 )+V( 3 )*
$ Q( JR, J+2 ) )
Q( JR, J ) = Q( JR, J ) - TEMP
Q( JR, J+1 ) = Q( JR, J+1 ) - TEMP*V( 2 )
Q( JR, J+2 ) = Q( JR, J+2 ) - TEMP*V( 3 )
TEMP = Q( JR, J )+V( 2 )*Q( JR, J+1 )+V( 3 )*
$ Q( JR, J+2 )
Q( JR, J ) = Q( JR, J ) - TEMP*TAU
Q( JR, J+1 ) = Q( JR, J+1 ) - TEMP*T2
Q( JR, J+2 ) = Q( JR, J+2 ) - TEMP*T3
240 CONTINUE
END IF
*
Expand Down Expand Up @@ -1238,27 +1240,29 @@ SUBROUTINE SHGEQZ( JOB, COMPQ, COMPZ, N, ILO, IHI, H, LDH, T, LDT,
*
* Apply transformations from the right.
*
T2 = TAU*V( 2 )
T3 = TAU*V( 3 )
DO 260 JR = IFRSTM, MIN( J+3, ILAST )
TEMP = TAU*( H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
$ H( JR, J+2 ) )
H( JR, J ) = H( JR, J ) - TEMP
H( JR, J+1 ) = H( JR, J+1 ) - TEMP*V( 2 )
H( JR, J+2 ) = H( JR, J+2 ) - TEMP*V( 3 )
TEMP = H( JR, J )+V( 2 )*H( JR, J+1 )+V( 3 )*
$ H( JR, J+2 )
H( JR, J ) = H( JR, J ) - TEMP*TAU
H( JR, J+1 ) = H( JR, J+1 ) - TEMP*T2
H( JR, J+2 ) = H( JR, J+2 ) - TEMP*T3
260 CONTINUE
DO 270 JR = IFRSTM, J + 2
TEMP = TAU*( T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
$ T( JR, J+2 ) )
T( JR, J ) = T( JR, J ) - TEMP
T( JR, J+1 ) = T( JR, J+1 ) - TEMP*V( 2 )
T( JR, J+2 ) = T( JR, J+2 ) - TEMP*V( 3 )
TEMP = T( JR, J )+V( 2 )*T( JR, J+1 )+V( 3 )*
$ T( JR, J+2 )
T( JR, J ) = T( JR, J ) - TEMP*TAU
T( JR, J+1 ) = T( JR, J+1 ) - TEMP*T2
T( JR, J+2 ) = T( JR, J+2 ) - TEMP*T3
270 CONTINUE
IF( ILZ ) THEN
DO 280 JR = 1, N
TEMP = TAU*( Z( JR, J )+V( 2 )*Z( JR, J+1 )+V( 3 )*
$ Z( JR, J+2 ) )
Z( JR, J ) = Z( JR, J ) - TEMP
Z( JR, J+1 ) = Z( JR, J+1 ) - TEMP*V( 2 )
Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*V( 3 )
TEMP = Z( JR, J )+V( 2 )*Z( JR, J+1 )+V( 3 )*
$ Z( JR, J+2 )
Z( JR, J ) = Z( JR, J ) - TEMP*TAU
Z( JR, J+1 ) = Z( JR, J+1 ) - TEMP*T2
Z( JR, J+2 ) = Z( JR, J+2 ) - TEMP*T3
280 CONTINUE
END IF
T( J+1, J ) = ZERO
Expand Down
23 changes: 14 additions & 9 deletions SRC/slaqr5.f
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,13 @@ SUBROUTINE SLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
* . Mth bulge. Exploit fact that first two elements
* . of row are actually zero. ====
*
REFSUM = V( 1, M )*V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM
H( K+3, K+1 ) = -REFSUM*V( 2, M )
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*V( 3, M )
T1 = V( 1, M )
T2 = T1*V( 2, M )
T3 = T1*V( 3, M )
REFSUM = V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM*T1
H( K+3, K+1 ) = -REFSUM*T2
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*T3
*
* ==== Calculate reflection to move
* . Mth bulge one step. ====
Expand Down Expand Up @@ -597,11 +600,13 @@ SUBROUTINE SLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
$ VT )
ALPHA = VT( 1 )
CALL SLARFG( 3, ALPHA, VT( 2 ), 1, VT( 1 ) )
REFSUM = VT( 1 )*( H( K+1, K )+VT( 2 )*
$ H( K+2, K ) )
T1 = VT( 1 )
T2 = T1*VT( 2 )
T3 = T2*VT( 3 )
REFSUM = H( K+1, K )+VT( 2 )*H( K+2, K )
*
IF( ABS( H( K+2, K )-REFSUM*VT( 2 ) )+
$ ABS( REFSUM*VT( 3 ) ).GT.ULP*
IF( ABS( H( K+2, K )-REFSUM*T2 )+
$ ABS( REFSUM*T3 ).GT.ULP*
$ ( ABS( H( K, K ) )+ABS( H( K+1,
$ K+1 ) )+ABS( H( K+2, K+2 ) ) ) ) THEN
*
Expand All @@ -619,7 +624,7 @@ SUBROUTINE SLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS,
* . Replace the old reflector with
* . the new one. ====
*
H( K+1, K ) = H( K+1, K ) - REFSUM
H( K+1, K ) = H( K+1, K ) - REFSUM*T1
H( K+2, K ) = ZERO
H( K+3, K ) = ZERO
V( 1, M ) = VT( 1 )
Expand Down
25 changes: 14 additions & 11 deletions SRC/zlaqr5.f
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,13 @@ SUBROUTINE ZLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
* . Mth bulge. Exploit fact that first two elements
* . of row are actually zero. ====
*
REFSUM = V( 1, M )*V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM
H( K+3, K+1 ) = -REFSUM*DCONJG( V( 2, M ) )
H( K+3, K+2 ) = H( K+3, K+2 ) -
$ REFSUM*DCONJG( V( 3, M ) )
T1 = V( 1, M )
T2 = T1*DCONJG( V( 2, M ) )
T3 = T1*DCONJG( V( 3, M ) )
REFSUM = V( 3, M )*H( K+3, K+2 )
H( K+3, K ) = -REFSUM*T1
H( K+3, K+1 ) = -REFSUM*T2
H( K+3, K+2 ) = H( K+3, K+2 ) - REFSUM*T3
*
* ==== Calculate reflection to move
* . Mth bulge one step. ====
Expand Down Expand Up @@ -572,12 +574,13 @@ SUBROUTINE ZLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
$ S( 2*M ), VT )
ALPHA = VT( 1 )
CALL ZLARFG( 3, ALPHA, VT( 2 ), 1, VT( 1 ) )
REFSUM = DCONJG( VT( 1 ) )*
$ ( H( K+1, K )+DCONJG( VT( 2 ) )*
$ H( K+2, K ) )
T1 = DCONJG( VT( 1 ) )
T2 = T1*VT( 2 )
T3 = T1*VT( 3 )
REFSUM = H( K+1, K )+DCONJG( VT( 2 ) )*H( K+2, K )
*
IF( CABS1( H( K+2, K )-REFSUM*VT( 2 ) )+
$ CABS1( REFSUM*VT( 3 ) ).GT.ULP*
IF( CABS1( H( K+2, K )-REFSUM*T2 )+
$ CABS1( REFSUM*T3 ).GT.ULP*
$ ( CABS1( H( K, K ) )+CABS1( H( K+1,
$ K+1 ) )+CABS1( H( K+2, K+2 ) ) ) ) THEN
*
Expand All @@ -595,7 +598,7 @@ SUBROUTINE ZLAQR5( WANTT, WANTZ, KACC22, N, KTOP, KBOT, NSHFTS, S,
* . Replace the old reflector with
* . the new one. ====
*
H( K+1, K ) = H( K+1, K ) - REFSUM
H( K+1, K ) = H( K+1, K ) - REFSUM*T1
H( K+2, K ) = ZERO
H( K+3, K ) = ZERO
V( 1, M ) = VT( 1 )
Expand Down
Loading