00001 SUBROUTINE ZCHKHB( NSIZES, NN, NWDTHS, KK, NTYPES, DOTYPE, ISEED,
00002 $ THRESH, NOUNIT, A, LDA, SD, SE, U, LDU, WORK,
00003 $ LWORK, RWORK, RESULT, INFO )
00004
00005
00006
00007
00008
00009
00010 INTEGER INFO, LDA, LDU, LWORK, NOUNIT, NSIZES, NTYPES,
00011 $ NWDTHS
00012 DOUBLE PRECISION THRESH
00013
00014
00015 LOGICAL DOTYPE( * )
00016 INTEGER ISEED( 4 ), KK( * ), NN( * )
00017 DOUBLE PRECISION RESULT( * ), RWORK( * ), SD( * ), SE( * )
00018 COMPLEX*16 A( LDA, * ), U( LDU, * ), WORK( * )
00019
00020
00021
00022
00023
00024
00025
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 COMPLEX*16 CZERO, CONE
00216 PARAMETER ( CZERO = ( 0.0D+0, 0.0D+0 ),
00217 $ CONE = ( 1.0D+0, 0.0D+0 ) )
00218 DOUBLE PRECISION ZERO, ONE, TWO, TEN
00219 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0,
00220 $ TEN = 10.0D+0 )
00221 DOUBLE PRECISION HALF
00222 PARAMETER ( HALF = ONE / TWO )
00223 INTEGER MAXTYP
00224 PARAMETER ( MAXTYP = 15 )
00225
00226
00227 LOGICAL BADNN, BADNNB
00228 INTEGER I, IINFO, IMODE, ITYPE, J, JC, JCOL, JR, JSIZE,
00229 $ JTYPE, JWIDTH, K, KMAX, MTYPES, N, NERRS,
00230 $ NMATS, NMAX, NTEST, NTESTT
00231 DOUBLE PRECISION ANINV, ANORM, COND, OVFL, RTOVFL, RTUNFL,
00232 $ TEMP1, ULP, ULPINV, UNFL
00233
00234
00235 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KMAGN( MAXTYP ),
00236 $ KMODE( MAXTYP ), KTYPE( MAXTYP )
00237
00238
00239 DOUBLE PRECISION DLAMCH
00240 EXTERNAL DLAMCH
00241
00242
00243 EXTERNAL DLASUM, XERBLA, ZHBT21, ZHBTRD, ZLACPY, ZLASET,
00244 $ ZLATMR, ZLATMS
00245
00246
00247 INTRINSIC ABS, DBLE, DCONJG, MAX, MIN, SQRT
00248
00249
00250 DATA KTYPE / 1, 2, 5*4, 5*5, 3*8 /
00251 DATA KMAGN / 2*1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 3, 1,
00252 $ 2, 3 /
00253 DATA KMODE / 2*0, 4, 3, 1, 4, 4, 4, 3, 1, 4, 4, 0,
00254 $ 0, 0 /
00255
00256
00257
00258
00259
00260 NTESTT = 0
00261 INFO = 0
00262
00263
00264
00265 BADNN = .FALSE.
00266 NMAX = 1
00267 DO 10 J = 1, NSIZES
00268 NMAX = MAX( NMAX, NN( J ) )
00269 IF( NN( J ).LT.0 )
00270 $ BADNN = .TRUE.
00271 10 CONTINUE
00272
00273 BADNNB = .FALSE.
00274 KMAX = 0
00275 DO 20 J = 1, NSIZES
00276 KMAX = MAX( KMAX, KK( J ) )
00277 IF( KK( J ).LT.0 )
00278 $ BADNNB = .TRUE.
00279 20 CONTINUE
00280 KMAX = MIN( NMAX-1, KMAX )
00281
00282
00283
00284 IF( NSIZES.LT.0 ) THEN
00285 INFO = -1
00286 ELSE IF( BADNN ) THEN
00287 INFO = -2
00288 ELSE IF( NWDTHS.LT.0 ) THEN
00289 INFO = -3
00290 ELSE IF( BADNNB ) THEN
00291 INFO = -4
00292 ELSE IF( NTYPES.LT.0 ) THEN
00293 INFO = -5
00294 ELSE IF( LDA.LT.KMAX+1 ) THEN
00295 INFO = -11
00296 ELSE IF( LDU.LT.NMAX ) THEN
00297 INFO = -15
00298 ELSE IF( ( MAX( LDA, NMAX )+1 )*NMAX.GT.LWORK ) THEN
00299 INFO = -17
00300 END IF
00301
00302 IF( INFO.NE.0 ) THEN
00303 CALL XERBLA( 'ZCHKHB', -INFO )
00304 RETURN
00305 END IF
00306
00307
00308
00309 IF( NSIZES.EQ.0 .OR. NTYPES.EQ.0 .OR. NWDTHS.EQ.0 )
00310 $ RETURN
00311
00312
00313
00314 UNFL = DLAMCH( 'Safe minimum' )
00315 OVFL = ONE / UNFL
00316 ULP = DLAMCH( 'Epsilon' )*DLAMCH( 'Base' )
00317 ULPINV = ONE / ULP
00318 RTUNFL = SQRT( UNFL )
00319 RTOVFL = SQRT( OVFL )
00320
00321
00322
00323 NERRS = 0
00324 NMATS = 0
00325
00326 DO 190 JSIZE = 1, NSIZES
00327 N = NN( JSIZE )
00328 ANINV = ONE / DBLE( MAX( 1, N ) )
00329
00330 DO 180 JWIDTH = 1, NWDTHS
00331 K = KK( JWIDTH )
00332 IF( K.GT.N )
00333 $ GO TO 180
00334 K = MAX( 0, MIN( N-1, K ) )
00335
00336 IF( NSIZES.NE.1 ) THEN
00337 MTYPES = MIN( MAXTYP, NTYPES )
00338 ELSE
00339 MTYPES = MIN( MAXTYP+1, NTYPES )
00340 END IF
00341
00342 DO 170 JTYPE = 1, MTYPES
00343 IF( .NOT.DOTYPE( JTYPE ) )
00344 $ GO TO 170
00345 NMATS = NMATS + 1
00346 NTEST = 0
00347
00348 DO 30 J = 1, 4
00349 IOLDSD( J ) = ISEED( J )
00350 30 CONTINUE
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369 IF( MTYPES.GT.MAXTYP )
00370 $ GO TO 100
00371
00372 ITYPE = KTYPE( JTYPE )
00373 IMODE = KMODE( JTYPE )
00374
00375
00376
00377 GO TO ( 40, 50, 60 )KMAGN( JTYPE )
00378
00379 40 CONTINUE
00380 ANORM = ONE
00381 GO TO 70
00382
00383 50 CONTINUE
00384 ANORM = ( RTOVFL*ULP )*ANINV
00385 GO TO 70
00386
00387 60 CONTINUE
00388 ANORM = RTUNFL*N*ULPINV
00389 GO TO 70
00390
00391 70 CONTINUE
00392
00393 CALL ZLASET( 'Full', LDA, N, CZERO, CZERO, A, LDA )
00394 IINFO = 0
00395 IF( JTYPE.LE.15 ) THEN
00396 COND = ULPINV
00397 ELSE
00398 COND = ULPINV*ANINV / TEN
00399 END IF
00400
00401
00402
00403
00404
00405 IF( ITYPE.EQ.1 ) THEN
00406 IINFO = 0
00407
00408 ELSE IF( ITYPE.EQ.2 ) THEN
00409
00410
00411
00412 DO 80 JCOL = 1, N
00413 A( K+1, JCOL ) = ANORM
00414 80 CONTINUE
00415
00416 ELSE IF( ITYPE.EQ.4 ) THEN
00417
00418
00419
00420 CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE,
00421 $ COND, ANORM, 0, 0, 'Q', A( K+1, 1 ), LDA,
00422 $ WORK, IINFO )
00423
00424 ELSE IF( ITYPE.EQ.5 ) THEN
00425
00426
00427
00428 CALL ZLATMS( N, N, 'S', ISEED, 'H', RWORK, IMODE,
00429 $ COND, ANORM, K, K, 'Q', A, LDA, WORK,
00430 $ IINFO )
00431
00432 ELSE IF( ITYPE.EQ.7 ) THEN
00433
00434
00435
00436 CALL ZLATMR( N, N, 'S', ISEED, 'H', WORK, 6, ONE,
00437 $ CONE, 'T', 'N', WORK( N+1 ), 1, ONE,
00438 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, 0, 0,
00439 $ ZERO, ANORM, 'Q', A( K+1, 1 ), LDA,
00440 $ IDUMMA, IINFO )
00441
00442 ELSE IF( ITYPE.EQ.8 ) THEN
00443
00444
00445
00446 CALL ZLATMR( N, N, 'S', ISEED, 'H', WORK, 6, ONE,
00447 $ CONE, 'T', 'N', WORK( N+1 ), 1, ONE,
00448 $ WORK( 2*N+1 ), 1, ONE, 'N', IDUMMA, K, K,
00449 $ ZERO, ANORM, 'Q', A, LDA, IDUMMA, IINFO )
00450
00451 ELSE IF( ITYPE.EQ.9 ) THEN
00452
00453
00454
00455 CALL ZLATMS( N, N, 'S', ISEED, 'P', RWORK, IMODE,
00456 $ COND, ANORM, K, K, 'Q', A, LDA,
00457 $ WORK( N+1 ), IINFO )
00458
00459 ELSE IF( ITYPE.EQ.10 ) THEN
00460
00461
00462
00463 IF( N.GT.1 )
00464 $ K = MAX( 1, K )
00465 CALL ZLATMS( N, N, 'S', ISEED, 'P', RWORK, IMODE,
00466 $ COND, ANORM, 1, 1, 'Q', A( K, 1 ), LDA,
00467 $ WORK, IINFO )
00468 DO 90 I = 2, N
00469 TEMP1 = ABS( A( K, I ) ) /
00470 $ SQRT( ABS( A( K+1, I-1 )*A( K+1, I ) ) )
00471 IF( TEMP1.GT.HALF ) THEN
00472 A( K, I ) = HALF*SQRT( ABS( A( K+1,
00473 $ I-1 )*A( K+1, I ) ) )
00474 END IF
00475 90 CONTINUE
00476
00477 ELSE
00478
00479 IINFO = 1
00480 END IF
00481
00482 IF( IINFO.NE.0 ) THEN
00483 WRITE( NOUNIT, FMT = 9999 )'Generator', IINFO, N,
00484 $ JTYPE, IOLDSD
00485 INFO = ABS( IINFO )
00486 RETURN
00487 END IF
00488
00489 100 CONTINUE
00490
00491
00492
00493 CALL ZLACPY( ' ', K+1, N, A, LDA, WORK, LDA )
00494
00495 NTEST = 1
00496 CALL ZHBTRD( 'V', 'U', N, K, WORK, LDA, SD, SE, U, LDU,
00497 $ WORK( LDA*N+1 ), IINFO )
00498
00499 IF( IINFO.NE.0 ) THEN
00500 WRITE( NOUNIT, FMT = 9999 )'ZHBTRD(U)', IINFO, N,
00501 $ JTYPE, IOLDSD
00502 INFO = ABS( IINFO )
00503 IF( IINFO.LT.0 ) THEN
00504 RETURN
00505 ELSE
00506 RESULT( 1 ) = ULPINV
00507 GO TO 150
00508 END IF
00509 END IF
00510
00511
00512
00513 CALL ZHBT21( 'Upper', N, K, 1, A, LDA, SD, SE, U, LDU,
00514 $ WORK, RWORK, RESULT( 1 ) )
00515
00516
00517
00518
00519 DO 120 JC = 1, N
00520 DO 110 JR = 0, MIN( K, N-JC )
00521 A( JR+1, JC ) = DCONJG( A( K+1-JR, JC+JR ) )
00522 110 CONTINUE
00523 120 CONTINUE
00524 DO 140 JC = N + 1 - K, N
00525 DO 130 JR = MIN( K, N-JC ) + 1, K
00526 A( JR+1, JC ) = ZERO
00527 130 CONTINUE
00528 140 CONTINUE
00529
00530
00531
00532 CALL ZLACPY( ' ', K+1, N, A, LDA, WORK, LDA )
00533
00534 NTEST = 3
00535 CALL ZHBTRD( 'V', 'L', N, K, WORK, LDA, SD, SE, U, LDU,
00536 $ WORK( LDA*N+1 ), IINFO )
00537
00538 IF( IINFO.NE.0 ) THEN
00539 WRITE( NOUNIT, FMT = 9999 )'ZHBTRD(L)', IINFO, N,
00540 $ JTYPE, IOLDSD
00541 INFO = ABS( IINFO )
00542 IF( IINFO.LT.0 ) THEN
00543 RETURN
00544 ELSE
00545 RESULT( 3 ) = ULPINV
00546 GO TO 150
00547 END IF
00548 END IF
00549 NTEST = 4
00550
00551
00552
00553 CALL ZHBT21( 'Lower', N, K, 1, A, LDA, SD, SE, U, LDU,
00554 $ WORK, RWORK, RESULT( 3 ) )
00555
00556
00557
00558 150 CONTINUE
00559 NTESTT = NTESTT + NTEST
00560
00561
00562
00563 DO 160 JR = 1, NTEST
00564 IF( RESULT( JR ).GE.THRESH ) THEN
00565
00566
00567
00568
00569 IF( NERRS.EQ.0 ) THEN
00570 WRITE( NOUNIT, FMT = 9998 )'ZHB'
00571 WRITE( NOUNIT, FMT = 9997 )
00572 WRITE( NOUNIT, FMT = 9996 )
00573 WRITE( NOUNIT, FMT = 9995 )'Hermitian'
00574 WRITE( NOUNIT, FMT = 9994 )'unitary', '*',
00575 $ 'conjugate transpose', ( '*', J = 1, 4 )
00576 END IF
00577 NERRS = NERRS + 1
00578 WRITE( NOUNIT, FMT = 9993 )N, K, IOLDSD, JTYPE,
00579 $ JR, RESULT( JR )
00580 END IF
00581 160 CONTINUE
00582
00583 170 CONTINUE
00584 180 CONTINUE
00585 190 CONTINUE
00586
00587
00588
00589 CALL DLASUM( 'ZHB', NOUNIT, NERRS, NTESTT )
00590 RETURN
00591
00592 9999 FORMAT( ' ZCHKHB: ', A, ' returned INFO=', I6, '.', / 9X, 'N=',
00593 $ I6, ', JTYPE=', I6, ', ISEED=(', 3( I5, ',' ), I5, ')' )
00594 9998 FORMAT( / 1X, A3,
00595 $ ' -- Complex Hermitian Banded Tridiagonal Reduction Routines'
00596 $ )
00597 9997 FORMAT( ' Matrix types (see DCHK23 for details): ' )
00598
00599 9996 FORMAT( / ' Special Matrices:',
00600 $ / ' 1=Zero matrix. ',
00601 $ ' 5=Diagonal: clustered entries.',
00602 $ / ' 2=Identity matrix. ',
00603 $ ' 6=Diagonal: large, evenly spaced.',
00604 $ / ' 3=Diagonal: evenly spaced entries. ',
00605 $ ' 7=Diagonal: small, evenly spaced.',
00606 $ / ' 4=Diagonal: geometr. spaced entries.' )
00607 9995 FORMAT( ' Dense ', A, ' Banded Matrices:',
00608 $ / ' 8=Evenly spaced eigenvals. ',
00609 $ ' 12=Small, evenly spaced eigenvals.',
00610 $ / ' 9=Geometrically spaced eigenvals. ',
00611 $ ' 13=Matrix with random O(1) entries.',
00612 $ / ' 10=Clustered eigenvalues. ',
00613 $ ' 14=Matrix with large random entries.',
00614 $ / ' 11=Large, evenly spaced eigenvals. ',
00615 $ ' 15=Matrix with small random entries.' )
00616
00617 9994 FORMAT( / ' Tests performed: (S is Tridiag, U is ', A, ',',
00618 $ / 20X, A, ' means ', A, '.', / ' UPLO=''U'':',
00619 $ / ' 1= | A - U S U', A1, ' | / ( |A| n ulp ) ',
00620 $ ' 2= | I - U U', A1, ' | / ( n ulp )', / ' UPLO=''L'':',
00621 $ / ' 3= | A - U S U', A1, ' | / ( |A| n ulp ) ',
00622 $ ' 4= | I - U U', A1, ' | / ( n ulp )' )
00623 9993 FORMAT( ' N=', I5, ', K=', I4, ', seed=', 4( I4, ',' ), ' type ',
00624 $ I2, ', test(', I2, ')=', G10.3 )
00625
00626
00627
00628 END