1 SUBROUTINE zlamsh( S, LDS, NBULGE, JBLK, H, LDH, N, ULP )
9 INTEGER JBLK, LDH, LDS, N, NBULGE
13 COMPLEX*16 H( LDH, * ), S( LDS, * )
78 DOUBLE PRECISION RONE, TEN
79 parameter( rone = 1.0d+0, ten = 10.0d+0 )
81 parameter( zero = ( 0.0d+0, 0.0d+0 ) )
84 INTEGER I, IBULGE, IVAL, J, K, M, NR
85 DOUBLE PRECISION DVAL, S1, TST1
86 COMPLEX*16 CDUM, H00, H10, H11, H12, H21, H22, H33, H33S,
87 $ H43H34, H44, H44S, SUM, T1, T2, T3, V1, V2, V3
93 EXTERNAL zcopy, zlarfg
96 INTRINSIC abs, dble, dconjg, dimag,
max,
min
99 DOUBLE PRECISION CABS1
102 cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( cdum ) )
107 DO 50 ibulge = 1, nbulge
108 h44 = s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+2 )
109 h33 = s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+1 )
110 h43h34 = s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+2 )*
111 $ s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+1 )
118 v1 = ( h33s*h44s-h43h34 ) / h21 + h12
119 v2 = h22 - h11 - h33s - h44s
121 s1 = cabs1( v1 ) + cabs1( v2 ) + cabs1( v3 )
130 tst1 = cabs1( v1 )*( cabs1( h00 )+cabs1( h11 )+cabs1( h22 ) )
131 IF( cabs1( h10 )*( cabs1( v2 )+cabs1( v3 ) ).GT.ulp*tst1 )
THEN
133 dval = ( cabs1( h10 )*( cabs1( v2 )+cabs1( v3 ) ) ) /
136 DO 10 i = ibulge + 1, nbulge
137 h44 = s( 2*jblk-2*i+2, 2*jblk-2*i+2 )
138 h33 = s( 2*jblk-2*i+1, 2*jblk-2*i+1 )
139 h43h34 = s( 2*jblk-2*i+1, 2*jblk-2*i+2 )*
140 $ s( 2*jblk-2*i+2, 2*jblk-2*i+1 )
147 v1 = ( h33s*h44s-h43h34 ) / h21 + h12
148 v2 = h22 - h11 - h33s - h44s
150 s1 = cabs1( v1 ) + cabs1( v2 ) + cabs1( v3 )
159 tst1 = cabs1( v1 )*( cabs1( h00 )+cabs1( h11 )+
161 IF( ( dval.GT.( cabs1( h10 )*( cabs1( v2 )+
162 $ cabs1( v3 ) ) ) / ( ulp*tst1 ) ) .AND.
163 $ ( dval.GT.rone ) )
THEN
164 dval = ( cabs1( h10 )*( cabs1( v2 )+cabs1( v3 ) ) ) /
169 IF( ( dval.LT.ten ) .AND. ( ival.NE.ibulge ) )
THEN
170 h44 = s( 2*jblk-2*ival+2, 2*jblk-2*ival+2 )
171 h33 = s( 2*jblk-2*ival+1, 2*jblk-2*ival+1 )
172 h43h34 = s( 2*jblk-2*ival+1, 2*jblk-2*ival+2 )
173 h10 = s( 2*jblk-2*ival+2, 2*jblk-2*ival+1 )
174 s( 2*jblk-2*ival+2, 2*jblk-2*ival+2 ) = s( 2*jblk-2*
175 $ ibulge+2, 2*jblk-2*ibulge+2 )
176 s( 2*jblk-2*ival+1, 2*jblk-2*ival+1 ) = s( 2*jblk-2*
177 $ ibulge+1, 2*jblk-2*ibulge+1 )
178 s( 2*jblk-2*ival+1, 2*jblk-2*ival+2 ) = s( 2*jblk-2*
179 $ ibulge+1, 2*jblk-2*ibulge+2 )
180 s( 2*jblk-2*ival+2, 2*jblk-2*ival+1 ) = s( 2*jblk-2*
181 $ ibulge+2, 2*jblk-2*ibulge+1 )
182 s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+2 ) = h44
183 s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+1 ) = h33
184 s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+2 ) = h43h34
185 s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+1 ) = h10
187 h44 = s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+2 )
188 h33 = s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+1 )
189 h43h34 = s( 2*jblk-2*ibulge+1, 2*jblk-2*ibulge+2 )*
190 $ s( 2*jblk-2*ibulge+2, 2*jblk-2*ibulge+1 )
197 v1 = ( h33s*h44s-h43h34 ) / h21 + h12
198 v2 = h22 - h11 - h33s - h44s
200 s1 = cabs1( v1 ) + cabs1( v2 ) + cabs1( v3 )
209 tst1 = cabs1( v1 )*( cabs1( h00 )+cabs1( h11 )+
212 IF( cabs1( h10 )*( cabs1( v2 )+cabs1( v3 ) ).GT.ten*ulp*tst1 )
215 nbulge =
max( ibulge-1, 1 )
221 $
CALL zcopy( nr, h( k, k-1 ), 1, v, 1 )
222 CALL zlarfg( nr, v( 1 ), v( 2 ), 1, t1 )
227 $ h( k+2, k-1 ) = zero
231 h( k, k-1 ) = h( k, k-1 ) - dconjg( t1 )*h( k, k-1 )
239 sum = dconjg( t1 )*h( k, j ) +
240 $ dconjg( t2 )*h( k+1, j ) +
241 $ dconjg( t3 )*h( k+2, j )
242 h( k, j ) = h( k, j ) - sum
243 h( k+1, j ) = h( k+1, j ) - sum*v2
244 h( k+2, j ) = h( k+2, j ) - sum*v3
246 DO 30 j = 1,
min( k+3, n )
247 sum = t1*h( j, k ) + t2*h( j, k+1 ) + t3*h( j, k+2 )
248 h( j, k ) = h( j, k ) - sum
249 h( j, k+1 ) = h( j, k+1 ) - sum*dconjg( v2 )
250 h( j, k+2 ) = h( j, k+2 ) - sum*dconjg( v3 )