155 SUBROUTINE dlagv2( A, LDA, B, LDB, ALPHAR, ALPHAI, BETA, CSL, SNL,
164 DOUBLE PRECISION CSL, CSR, SNL, SNR
167 DOUBLE PRECISION A( LDA, * ), ALPHAI( 2 ), ALPHAR( 2 ),
168 $ b( ldb, * ), beta( 2 )
174 DOUBLE PRECISION ZERO, ONE
175 parameter( zero = 0.0d+0, one = 1.0d+0 )
178 DOUBLE PRECISION ANORM, ASCALE, BNORM, BSCALE, H1, H2, H3, QQ,
179 $ r, rr, safmin, scale1, scale2, t, ulp, wi, wr1,
186 DOUBLE PRECISION DLAMCH, DLAPY2
187 EXTERNAL dlamch, dlapy2
194 safmin = dlamch(
'S' )
199 anorm = max( abs( a( 1, 1 ) )+abs( a( 2, 1 ) ),
200 $ abs( a( 1, 2 ) )+abs( a( 2, 2 ) ), safmin )
202 a( 1, 1 ) = ascale*a( 1, 1 )
203 a( 1, 2 ) = ascale*a( 1, 2 )
204 a( 2, 1 ) = ascale*a( 2, 1 )
205 a( 2, 2 ) = ascale*a( 2, 2 )
209 bnorm = max( abs( b( 1, 1 ) ), abs( b( 1, 2 ) )+abs( b( 2, 2 ) ),
212 b( 1, 1 ) = bscale*b( 1, 1 )
213 b( 1, 2 ) = bscale*b( 1, 2 )
214 b( 2, 2 ) = bscale*b( 2, 2 )
218 IF( abs( a( 2, 1 ) ).LE.ulp )
THEN
229 ELSE IF( abs( b( 1, 1 ) ).LE.ulp )
THEN
230 CALL dlartg( a( 1, 1 ), a( 2, 1 ), csl, snl, r )
233 CALL drot( 2, a( 1, 1 ), lda, a( 2, 1 ), lda, csl, snl )
234 CALL drot( 2, b( 1, 1 ), ldb, b( 2, 1 ), ldb, csl, snl )
240 ELSE IF( abs( b( 2, 2 ) ).LE.ulp )
THEN
241 CALL dlartg( a( 2, 2 ), a( 2, 1 ), csr, snr, t )
243 CALL drot( 2, a( 1, 1 ), 1, a( 1, 2 ), 1, csr, snr )
244 CALL drot( 2, b( 1, 1 ), 1, b( 1, 2 ), 1, csr, snr )
256 CALL dlag2( a, lda, b, ldb, safmin, scale1, scale2, wr1, wr2,
259 IF( wi.EQ.zero )
THEN
263 h1 = scale1*a( 1, 1 ) - wr1*b( 1, 1 )
264 h2 = scale1*a( 1, 2 ) - wr1*b( 1, 2 )
265 h3 = scale1*a( 2, 2 ) - wr1*b( 2, 2 )
267 rr = dlapy2( h1, h2 )
268 qq = dlapy2( scale1*a( 2, 1 ), h3 )
275 CALL dlartg( h2, h1, csr, snr, t )
282 CALL dlartg( h3, scale1*a( 2, 1 ), csr, snr, t )
287 CALL drot( 2, a( 1, 1 ), 1, a( 1, 2 ), 1, csr, snr )
288 CALL drot( 2, b( 1, 1 ), 1, b( 1, 2 ), 1, csr, snr )
292 h1 = max( abs( a( 1, 1 ) )+abs( a( 1, 2 ) ),
293 $ abs( a( 2, 1 ) )+abs( a( 2, 2 ) ) )
294 h2 = max( abs( b( 1, 1 ) )+abs( b( 1, 2 ) ),
295 $ abs( b( 2, 1 ) )+abs( b( 2, 2 ) ) )
297 IF( ( scale1*h1 ).GE.abs( wr1 )*h2 )
THEN
301 CALL dlartg( b( 1, 1 ), b( 2, 1 ), csl, snl, r )
307 CALL dlartg( a( 1, 1 ), a( 2, 1 ), csl, snl, r )
311 CALL drot( 2, a( 1, 1 ), lda, a( 2, 1 ), lda, csl, snl )
312 CALL drot( 2, b( 1, 1 ), ldb, b( 2, 1 ), ldb, csl, snl )
322 CALL dlasv2( b( 1, 1 ), b( 1, 2 ), b( 2, 2 ), r, t, snr,
328 CALL drot( 2, a( 1, 1 ), lda, a( 2, 1 ), lda, csl, snl )
329 CALL drot( 2, b( 1, 1 ), ldb, b( 2, 1 ), ldb, csl, snl )
330 CALL drot( 2, a( 1, 1 ), 1, a( 1, 2 ), 1, csr, snr )
331 CALL drot( 2, b( 1, 1 ), 1, b( 1, 2 ), 1, csr, snr )
342 a( 1, 1 ) = anorm*a( 1, 1 )
343 a( 2, 1 ) = anorm*a( 2, 1 )
344 a( 1, 2 ) = anorm*a( 1, 2 )
345 a( 2, 2 ) = anorm*a( 2, 2 )
346 b( 1, 1 ) = bnorm*b( 1, 1 )
347 b( 2, 1 ) = bnorm*b( 2, 1 )
348 b( 1, 2 ) = bnorm*b( 1, 2 )
349 b( 2, 2 ) = bnorm*b( 2, 2 )
351 IF( wi.EQ.zero )
THEN
352 alphar( 1 ) = a( 1, 1 )
353 alphar( 2 ) = a( 2, 2 )
356 beta( 1 ) = b( 1, 1 )
357 beta( 2 ) = b( 2, 2 )
359 alphar( 1 ) = anorm*wr1 / scale1 / bnorm
360 alphai( 1 ) = anorm*wi / scale1 / bnorm
361 alphar( 2 ) = alphar( 1 )
362 alphai( 2 ) = -alphai( 1 )
subroutine dlag2(a, lda, b, ldb, safmin, scale1, scale2, wr1, wr2, wi)
DLAG2 computes the eigenvalues of a 2-by-2 generalized eigenvalue problem, with scaling as necessary ...
subroutine dlagv2(a, lda, b, ldb, alphar, alphai, beta, csl, snl, csr, snr)
DLAGV2 computes the Generalized Schur factorization of a real 2-by-2 matrix pencil (A,...
subroutine dlartg(f, g, c, s, r)
DLARTG generates a plane rotation with real cosine and real sine.
subroutine dlasv2(f, g, h, ssmin, ssmax, snr, csr, snl, csl)
DLASV2 computes the singular value decomposition of a 2-by-2 triangular matrix.
subroutine drot(n, dx, incx, dy, incy, c, s)
DROT