00001 SUBROUTINE SGET23( COMP, BALANC, JTYPE, THRESH, ISEED, NOUNIT, N,
00002 $ A, LDA, H, WR, WI, WR1, WI1, VL, LDVL, VR,
00003 $ LDVR, LRE, LDLRE, RCONDV, RCNDV1, RCDVIN,
00004 $ RCONDE, RCNDE1, RCDEIN, SCALE, SCALE1, RESULT,
00005 $ WORK, LWORK, IWORK, INFO )
00006
00007
00008
00009
00010
00011
00012 LOGICAL COMP
00013 CHARACTER BALANC
00014 INTEGER INFO, JTYPE, LDA, LDLRE, LDVL, LDVR, LWORK, N,
00015 $ NOUNIT
00016 REAL THRESH
00017
00018
00019 INTEGER ISEED( 4 ), IWORK( * )
00020 REAL A( LDA, * ), H( LDA, * ), LRE( LDLRE, * ),
00021 $ RCDEIN( * ), RCDVIN( * ), RCNDE1( * ),
00022 $ RCNDV1( * ), RCONDE( * ), RCONDV( * ),
00023 $ RESULT( 11 ), SCALE( * ), SCALE1( * ),
00024 $ VL( LDVL, * ), VR( LDVR, * ), WI( * ),
00025 $ WI1( * ), WORK( * ), WR( * ), WR1( * )
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253 REAL ZERO, ONE, TWO
00254 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0, TWO = 2.0E0 )
00255 REAL EPSIN
00256 PARAMETER ( EPSIN = 5.9605E-8 )
00257
00258
00259 LOGICAL BALOK, NOBAL
00260 CHARACTER SENSE
00261 INTEGER I, IHI, IHI1, IINFO, ILO, ILO1, ISENS, ISENSM,
00262 $ J, JJ, KMIN
00263 REAL ABNRM, ABNRM1, EPS, SMLNUM, TNRM, TOL, TOLIN,
00264 $ ULP, ULPINV, V, VIMIN, VMAX, VMX, VRMIN, VRMX,
00265 $ VTST
00266
00267
00268 CHARACTER SENS( 2 )
00269 REAL DUM( 1 ), RES( 2 )
00270
00271
00272 LOGICAL LSAME
00273 REAL SLAMCH, SLAPY2, SNRM2
00274 EXTERNAL LSAME, SLAMCH, SLAPY2, SNRM2
00275
00276
00277 EXTERNAL SGEEVX, SGET22, SLACPY, XERBLA
00278
00279
00280 INTRINSIC ABS, MAX, MIN, REAL
00281
00282
00283 DATA SENS / 'N', 'V' /
00284
00285
00286
00287
00288
00289 NOBAL = LSAME( BALANC, 'N' )
00290 BALOK = NOBAL .OR. LSAME( BALANC, 'P' ) .OR.
00291 $ LSAME( BALANC, 'S' ) .OR. LSAME( BALANC, 'B' )
00292 INFO = 0
00293 IF( .NOT.BALOK ) THEN
00294 INFO = -2
00295 ELSE IF( THRESH.LT.ZERO ) THEN
00296 INFO = -4
00297 ELSE IF( NOUNIT.LE.0 ) THEN
00298 INFO = -6
00299 ELSE IF( N.LT.0 ) THEN
00300 INFO = -7
00301 ELSE IF( LDA.LT.1 .OR. LDA.LT.N ) THEN
00302 INFO = -9
00303 ELSE IF( LDVL.LT.1 .OR. LDVL.LT.N ) THEN
00304 INFO = -16
00305 ELSE IF( LDVR.LT.1 .OR. LDVR.LT.N ) THEN
00306 INFO = -18
00307 ELSE IF( LDLRE.LT.1 .OR. LDLRE.LT.N ) THEN
00308 INFO = -20
00309 ELSE IF( LWORK.LT.3*N .OR. ( COMP .AND. LWORK.LT.6*N+N*N ) ) THEN
00310 INFO = -31
00311 END IF
00312
00313 IF( INFO.NE.0 ) THEN
00314 CALL XERBLA( 'SGET23', -INFO )
00315 RETURN
00316 END IF
00317
00318
00319
00320 DO 10 I = 1, 11
00321 RESULT( I ) = -ONE
00322 10 CONTINUE
00323
00324 IF( N.EQ.0 )
00325 $ RETURN
00326
00327
00328
00329 ULP = SLAMCH( 'Precision' )
00330 SMLNUM = SLAMCH( 'S' )
00331 ULPINV = ONE / ULP
00332
00333
00334
00335 IF( LWORK.GE.6*N+N*N ) THEN
00336 SENSE = 'B'
00337 ISENSM = 2
00338 ELSE
00339 SENSE = 'E'
00340 ISENSM = 1
00341 END IF
00342 CALL SLACPY( 'F', N, N, A, LDA, H, LDA )
00343 CALL SGEEVX( BALANC, 'V', 'V', SENSE, N, H, LDA, WR, WI, VL, LDVL,
00344 $ VR, LDVR, ILO, IHI, SCALE, ABNRM, RCONDE, RCONDV,
00345 $ WORK, LWORK, IWORK, IINFO )
00346 IF( IINFO.NE.0 ) THEN
00347 RESULT( 1 ) = ULPINV
00348 IF( JTYPE.NE.22 ) THEN
00349 WRITE( NOUNIT, FMT = 9998 )'SGEEVX1', IINFO, N, JTYPE,
00350 $ BALANC, ISEED
00351 ELSE
00352 WRITE( NOUNIT, FMT = 9999 )'SGEEVX1', IINFO, N, ISEED( 1 )
00353 END IF
00354 INFO = ABS( IINFO )
00355 RETURN
00356 END IF
00357
00358
00359
00360 CALL SGET22( 'N', 'N', 'N', N, A, LDA, VR, LDVR, WR, WI, WORK,
00361 $ RES )
00362 RESULT( 1 ) = RES( 1 )
00363
00364
00365
00366 CALL SGET22( 'T', 'N', 'T', N, A, LDA, VL, LDVL, WR, WI, WORK,
00367 $ RES )
00368 RESULT( 2 ) = RES( 1 )
00369
00370
00371
00372 DO 30 J = 1, N
00373 TNRM = ONE
00374 IF( WI( J ).EQ.ZERO ) THEN
00375 TNRM = SNRM2( N, VR( 1, J ), 1 )
00376 ELSE IF( WI( J ).GT.ZERO ) THEN
00377 TNRM = SLAPY2( SNRM2( N, VR( 1, J ), 1 ),
00378 $ SNRM2( N, VR( 1, J+1 ), 1 ) )
00379 END IF
00380 RESULT( 3 ) = MAX( RESULT( 3 ),
00381 $ MIN( ULPINV, ABS( TNRM-ONE ) / ULP ) )
00382 IF( WI( J ).GT.ZERO ) THEN
00383 VMX = ZERO
00384 VRMX = ZERO
00385 DO 20 JJ = 1, N
00386 VTST = SLAPY2( VR( JJ, J ), VR( JJ, J+1 ) )
00387 IF( VTST.GT.VMX )
00388 $ VMX = VTST
00389 IF( VR( JJ, J+1 ).EQ.ZERO .AND. ABS( VR( JJ, J ) ).GT.
00390 $ VRMX )VRMX = ABS( VR( JJ, J ) )
00391 20 CONTINUE
00392 IF( VRMX / VMX.LT.ONE-TWO*ULP )
00393 $ RESULT( 3 ) = ULPINV
00394 END IF
00395 30 CONTINUE
00396
00397
00398
00399 DO 50 J = 1, N
00400 TNRM = ONE
00401 IF( WI( J ).EQ.ZERO ) THEN
00402 TNRM = SNRM2( N, VL( 1, J ), 1 )
00403 ELSE IF( WI( J ).GT.ZERO ) THEN
00404 TNRM = SLAPY2( SNRM2( N, VL( 1, J ), 1 ),
00405 $ SNRM2( N, VL( 1, J+1 ), 1 ) )
00406 END IF
00407 RESULT( 4 ) = MAX( RESULT( 4 ),
00408 $ MIN( ULPINV, ABS( TNRM-ONE ) / ULP ) )
00409 IF( WI( J ).GT.ZERO ) THEN
00410 VMX = ZERO
00411 VRMX = ZERO
00412 DO 40 JJ = 1, N
00413 VTST = SLAPY2( VL( JJ, J ), VL( JJ, J+1 ) )
00414 IF( VTST.GT.VMX )
00415 $ VMX = VTST
00416 IF( VL( JJ, J+1 ).EQ.ZERO .AND. ABS( VL( JJ, J ) ).GT.
00417 $ VRMX )VRMX = ABS( VL( JJ, J ) )
00418 40 CONTINUE
00419 IF( VRMX / VMX.LT.ONE-TWO*ULP )
00420 $ RESULT( 4 ) = ULPINV
00421 END IF
00422 50 CONTINUE
00423
00424
00425
00426 DO 200 ISENS = 1, ISENSM
00427
00428 SENSE = SENS( ISENS )
00429
00430
00431
00432 CALL SLACPY( 'F', N, N, A, LDA, H, LDA )
00433 CALL SGEEVX( BALANC, 'N', 'N', SENSE, N, H, LDA, WR1, WI1, DUM,
00434 $ 1, DUM, 1, ILO1, IHI1, SCALE1, ABNRM1, RCNDE1,
00435 $ RCNDV1, WORK, LWORK, IWORK, IINFO )
00436 IF( IINFO.NE.0 ) THEN
00437 RESULT( 1 ) = ULPINV
00438 IF( JTYPE.NE.22 ) THEN
00439 WRITE( NOUNIT, FMT = 9998 )'SGEEVX2', IINFO, N, JTYPE,
00440 $ BALANC, ISEED
00441 ELSE
00442 WRITE( NOUNIT, FMT = 9999 )'SGEEVX2', IINFO, N,
00443 $ ISEED( 1 )
00444 END IF
00445 INFO = ABS( IINFO )
00446 GO TO 190
00447 END IF
00448
00449
00450
00451 DO 60 J = 1, N
00452 IF( WR( J ).NE.WR1( J ) .OR. WI( J ).NE.WI1( J ) )
00453 $ RESULT( 5 ) = ULPINV
00454 60 CONTINUE
00455
00456
00457
00458 IF( .NOT.NOBAL ) THEN
00459 DO 70 J = 1, N
00460 IF( SCALE( J ).NE.SCALE1( J ) )
00461 $ RESULT( 8 ) = ULPINV
00462 70 CONTINUE
00463 IF( ILO.NE.ILO1 )
00464 $ RESULT( 8 ) = ULPINV
00465 IF( IHI.NE.IHI1 )
00466 $ RESULT( 8 ) = ULPINV
00467 IF( ABNRM.NE.ABNRM1 )
00468 $ RESULT( 8 ) = ULPINV
00469 END IF
00470
00471
00472
00473 IF( ISENS.EQ.2 .AND. N.GT.1 ) THEN
00474 DO 80 J = 1, N
00475 IF( RCONDV( J ).NE.RCNDV1( J ) )
00476 $ RESULT( 9 ) = ULPINV
00477 80 CONTINUE
00478 END IF
00479
00480
00481
00482 CALL SLACPY( 'F', N, N, A, LDA, H, LDA )
00483 CALL SGEEVX( BALANC, 'N', 'V', SENSE, N, H, LDA, WR1, WI1, DUM,
00484 $ 1, LRE, LDLRE, ILO1, IHI1, SCALE1, ABNRM1, RCNDE1,
00485 $ RCNDV1, WORK, LWORK, IWORK, IINFO )
00486 IF( IINFO.NE.0 ) THEN
00487 RESULT( 1 ) = ULPINV
00488 IF( JTYPE.NE.22 ) THEN
00489 WRITE( NOUNIT, FMT = 9998 )'SGEEVX3', IINFO, N, JTYPE,
00490 $ BALANC, ISEED
00491 ELSE
00492 WRITE( NOUNIT, FMT = 9999 )'SGEEVX3', IINFO, N,
00493 $ ISEED( 1 )
00494 END IF
00495 INFO = ABS( IINFO )
00496 GO TO 190
00497 END IF
00498
00499
00500
00501 DO 90 J = 1, N
00502 IF( WR( J ).NE.WR1( J ) .OR. WI( J ).NE.WI1( J ) )
00503 $ RESULT( 5 ) = ULPINV
00504 90 CONTINUE
00505
00506
00507
00508 DO 110 J = 1, N
00509 DO 100 JJ = 1, N
00510 IF( VR( J, JJ ).NE.LRE( J, JJ ) )
00511 $ RESULT( 6 ) = ULPINV
00512 100 CONTINUE
00513 110 CONTINUE
00514
00515
00516
00517 IF( .NOT.NOBAL ) THEN
00518 DO 120 J = 1, N
00519 IF( SCALE( J ).NE.SCALE1( J ) )
00520 $ RESULT( 8 ) = ULPINV
00521 120 CONTINUE
00522 IF( ILO.NE.ILO1 )
00523 $ RESULT( 8 ) = ULPINV
00524 IF( IHI.NE.IHI1 )
00525 $ RESULT( 8 ) = ULPINV
00526 IF( ABNRM.NE.ABNRM1 )
00527 $ RESULT( 8 ) = ULPINV
00528 END IF
00529
00530
00531
00532 IF( ISENS.EQ.2 .AND. N.GT.1 ) THEN
00533 DO 130 J = 1, N
00534 IF( RCONDV( J ).NE.RCNDV1( J ) )
00535 $ RESULT( 9 ) = ULPINV
00536 130 CONTINUE
00537 END IF
00538
00539
00540
00541 CALL SLACPY( 'F', N, N, A, LDA, H, LDA )
00542 CALL SGEEVX( BALANC, 'V', 'N', SENSE, N, H, LDA, WR1, WI1, LRE,
00543 $ LDLRE, DUM, 1, ILO1, IHI1, SCALE1, ABNRM1, RCNDE1,
00544 $ RCNDV1, WORK, LWORK, IWORK, IINFO )
00545 IF( IINFO.NE.0 ) THEN
00546 RESULT( 1 ) = ULPINV
00547 IF( JTYPE.NE.22 ) THEN
00548 WRITE( NOUNIT, FMT = 9998 )'SGEEVX4', IINFO, N, JTYPE,
00549 $ BALANC, ISEED
00550 ELSE
00551 WRITE( NOUNIT, FMT = 9999 )'SGEEVX4', IINFO, N,
00552 $ ISEED( 1 )
00553 END IF
00554 INFO = ABS( IINFO )
00555 GO TO 190
00556 END IF
00557
00558
00559
00560 DO 140 J = 1, N
00561 IF( WR( J ).NE.WR1( J ) .OR. WI( J ).NE.WI1( J ) )
00562 $ RESULT( 5 ) = ULPINV
00563 140 CONTINUE
00564
00565
00566
00567 DO 160 J = 1, N
00568 DO 150 JJ = 1, N
00569 IF( VL( J, JJ ).NE.LRE( J, JJ ) )
00570 $ RESULT( 7 ) = ULPINV
00571 150 CONTINUE
00572 160 CONTINUE
00573
00574
00575
00576 IF( .NOT.NOBAL ) THEN
00577 DO 170 J = 1, N
00578 IF( SCALE( J ).NE.SCALE1( J ) )
00579 $ RESULT( 8 ) = ULPINV
00580 170 CONTINUE
00581 IF( ILO.NE.ILO1 )
00582 $ RESULT( 8 ) = ULPINV
00583 IF( IHI.NE.IHI1 )
00584 $ RESULT( 8 ) = ULPINV
00585 IF( ABNRM.NE.ABNRM1 )
00586 $ RESULT( 8 ) = ULPINV
00587 END IF
00588
00589
00590
00591 IF( ISENS.EQ.2 .AND. N.GT.1 ) THEN
00592 DO 180 J = 1, N
00593 IF( RCONDV( J ).NE.RCNDV1( J ) )
00594 $ RESULT( 9 ) = ULPINV
00595 180 CONTINUE
00596 END IF
00597
00598 190 CONTINUE
00599
00600 200 CONTINUE
00601
00602
00603
00604 IF( COMP ) THEN
00605 CALL SLACPY( 'F', N, N, A, LDA, H, LDA )
00606 CALL SGEEVX( 'N', 'V', 'V', 'B', N, H, LDA, WR, WI, VL, LDVL,
00607 $ VR, LDVR, ILO, IHI, SCALE, ABNRM, RCONDE, RCONDV,
00608 $ WORK, LWORK, IWORK, IINFO )
00609 IF( IINFO.NE.0 ) THEN
00610 RESULT( 1 ) = ULPINV
00611 WRITE( NOUNIT, FMT = 9999 )'SGEEVX5', IINFO, N, ISEED( 1 )
00612 INFO = ABS( IINFO )
00613 GO TO 250
00614 END IF
00615
00616
00617
00618
00619 DO 220 I = 1, N - 1
00620 KMIN = I
00621 VRMIN = WR( I )
00622 VIMIN = WI( I )
00623 DO 210 J = I + 1, N
00624 IF( WR( J ).LT.VRMIN ) THEN
00625 KMIN = J
00626 VRMIN = WR( J )
00627 VIMIN = WI( J )
00628 END IF
00629 210 CONTINUE
00630 WR( KMIN ) = WR( I )
00631 WI( KMIN ) = WI( I )
00632 WR( I ) = VRMIN
00633 WI( I ) = VIMIN
00634 VRMIN = RCONDE( KMIN )
00635 RCONDE( KMIN ) = RCONDE( I )
00636 RCONDE( I ) = VRMIN
00637 VRMIN = RCONDV( KMIN )
00638 RCONDV( KMIN ) = RCONDV( I )
00639 RCONDV( I ) = VRMIN
00640 220 CONTINUE
00641
00642
00643
00644
00645 RESULT( 10 ) = ZERO
00646 EPS = MAX( EPSIN, ULP )
00647 V = MAX( REAL( N )*EPS*ABNRM, SMLNUM )
00648 IF( ABNRM.EQ.ZERO )
00649 $ V = ONE
00650 DO 230 I = 1, N
00651 IF( V.GT.RCONDV( I )*RCONDE( I ) ) THEN
00652 TOL = RCONDV( I )
00653 ELSE
00654 TOL = V / RCONDE( I )
00655 END IF
00656 IF( V.GT.RCDVIN( I )*RCDEIN( I ) ) THEN
00657 TOLIN = RCDVIN( I )
00658 ELSE
00659 TOLIN = V / RCDEIN( I )
00660 END IF
00661 TOL = MAX( TOL, SMLNUM / EPS )
00662 TOLIN = MAX( TOLIN, SMLNUM / EPS )
00663 IF( EPS*( RCDVIN( I )-TOLIN ).GT.RCONDV( I )+TOL ) THEN
00664 VMAX = ONE / EPS
00665 ELSE IF( RCDVIN( I )-TOLIN.GT.RCONDV( I )+TOL ) THEN
00666 VMAX = ( RCDVIN( I )-TOLIN ) / ( RCONDV( I )+TOL )
00667 ELSE IF( RCDVIN( I )+TOLIN.LT.EPS*( RCONDV( I )-TOL ) ) THEN
00668 VMAX = ONE / EPS
00669 ELSE IF( RCDVIN( I )+TOLIN.LT.RCONDV( I )-TOL ) THEN
00670 VMAX = ( RCONDV( I )-TOL ) / ( RCDVIN( I )+TOLIN )
00671 ELSE
00672 VMAX = ONE
00673 END IF
00674 RESULT( 10 ) = MAX( RESULT( 10 ), VMAX )
00675 230 CONTINUE
00676
00677
00678
00679
00680 RESULT( 11 ) = ZERO
00681 DO 240 I = 1, N
00682 IF( V.GT.RCONDV( I ) ) THEN
00683 TOL = ONE
00684 ELSE
00685 TOL = V / RCONDV( I )
00686 END IF
00687 IF( V.GT.RCDVIN( I ) ) THEN
00688 TOLIN = ONE
00689 ELSE
00690 TOLIN = V / RCDVIN( I )
00691 END IF
00692 TOL = MAX( TOL, SMLNUM / EPS )
00693 TOLIN = MAX( TOLIN, SMLNUM / EPS )
00694 IF( EPS*( RCDEIN( I )-TOLIN ).GT.RCONDE( I )+TOL ) THEN
00695 VMAX = ONE / EPS
00696 ELSE IF( RCDEIN( I )-TOLIN.GT.RCONDE( I )+TOL ) THEN
00697 VMAX = ( RCDEIN( I )-TOLIN ) / ( RCONDE( I )+TOL )
00698 ELSE IF( RCDEIN( I )+TOLIN.LT.EPS*( RCONDE( I )-TOL ) ) THEN
00699 VMAX = ONE / EPS
00700 ELSE IF( RCDEIN( I )+TOLIN.LT.RCONDE( I )-TOL ) THEN
00701 VMAX = ( RCONDE( I )-TOL ) / ( RCDEIN( I )+TOLIN )
00702 ELSE
00703 VMAX = ONE
00704 END IF
00705 RESULT( 11 ) = MAX( RESULT( 11 ), VMAX )
00706 240 CONTINUE
00707 250 CONTINUE
00708
00709 END IF
00710
00711 9999 FORMAT( ' SGET23: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00712 $ I6, ', INPUT EXAMPLE NUMBER = ', I4 )
00713 9998 FORMAT( ' SGET23: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00714 $ I6, ', JTYPE=', I6, ', BALANC = ', A, ', ISEED=(',
00715 $ 3( I5, ',' ), I5, ')' )
00716
00717 RETURN
00718
00719
00720
00721 END