00001 SUBROUTINE CLATMR( M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX,
00002 $ RSIGN, GRADE, DL, MODEL, CONDL, DR, MODER,
00003 $ CONDR, PIVTNG, IPIVOT, KL, KU, SPARSE, ANORM,
00004 $ PACK, A, LDA, IWORK, INFO )
00005
00006
00007
00008
00009
00010
00011 CHARACTER DIST, GRADE, PACK, PIVTNG, RSIGN, SYM
00012 INTEGER INFO, KL, KU, LDA, M, MODE, MODEL, MODER, N
00013 REAL ANORM, COND, CONDL, CONDR, SPARSE
00014 COMPLEX DMAX
00015
00016
00017 INTEGER IPIVOT( * ), ISEED( 4 ), IWORK( * )
00018 COMPLEX A( LDA, * ), D( * ), DL( * ), DR( * )
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
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
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384 REAL ZERO
00385 PARAMETER ( ZERO = 0.0E0 )
00386 REAL ONE
00387 PARAMETER ( ONE = 1.0E0 )
00388 COMPLEX CONE
00389 PARAMETER ( CONE = ( 1.0E0, 0.0E0 ) )
00390 COMPLEX CZERO
00391 PARAMETER ( CZERO = ( 0.0E0, 0.0E0 ) )
00392
00393
00394 LOGICAL BADPVT, DZERO, FULBND
00395 INTEGER I, IDIST, IGRADE, IISUB, IPACK, IPVTNG, IRSIGN,
00396 $ ISUB, ISYM, J, JJSUB, JSUB, K, KLL, KUU, MNMIN,
00397 $ MNSUB, MXSUB, NPVTS
00398 REAL ONORM, TEMP
00399 COMPLEX CALPHA, CTEMP
00400
00401
00402 REAL TEMPA( 1 )
00403
00404
00405 LOGICAL LSAME
00406 REAL CLANGB, CLANGE, CLANSB, CLANSP, CLANSY
00407 COMPLEX CLATM2, CLATM3
00408 EXTERNAL LSAME, CLANGB, CLANGE, CLANSB, CLANSP, CLANSY,
00409 $ CLATM2, CLATM3
00410
00411
00412 EXTERNAL CLATM1, CSSCAL, XERBLA
00413
00414
00415 INTRINSIC ABS, CONJG, MAX, MIN, MOD, REAL
00416
00417
00418
00419
00420
00421
00422 INFO = 0
00423
00424
00425
00426 IF( M.EQ.0 .OR. N.EQ.0 )
00427 $ RETURN
00428
00429
00430
00431 IF( LSAME( DIST, 'U' ) ) THEN
00432 IDIST = 1
00433 ELSE IF( LSAME( DIST, 'S' ) ) THEN
00434 IDIST = 2
00435 ELSE IF( LSAME( DIST, 'N' ) ) THEN
00436 IDIST = 3
00437 ELSE IF( LSAME( DIST, 'D' ) ) THEN
00438 IDIST = 4
00439 ELSE
00440 IDIST = -1
00441 END IF
00442
00443
00444
00445 IF( LSAME( SYM, 'H' ) ) THEN
00446 ISYM = 0
00447 ELSE IF( LSAME( SYM, 'N' ) ) THEN
00448 ISYM = 1
00449 ELSE IF( LSAME( SYM, 'S' ) ) THEN
00450 ISYM = 2
00451 ELSE
00452 ISYM = -1
00453 END IF
00454
00455
00456
00457 IF( LSAME( RSIGN, 'F' ) ) THEN
00458 IRSIGN = 0
00459 ELSE IF( LSAME( RSIGN, 'T' ) ) THEN
00460 IRSIGN = 1
00461 ELSE
00462 IRSIGN = -1
00463 END IF
00464
00465
00466
00467 IF( LSAME( PIVTNG, 'N' ) ) THEN
00468 IPVTNG = 0
00469 ELSE IF( LSAME( PIVTNG, ' ' ) ) THEN
00470 IPVTNG = 0
00471 ELSE IF( LSAME( PIVTNG, 'L' ) ) THEN
00472 IPVTNG = 1
00473 NPVTS = M
00474 ELSE IF( LSAME( PIVTNG, 'R' ) ) THEN
00475 IPVTNG = 2
00476 NPVTS = N
00477 ELSE IF( LSAME( PIVTNG, 'B' ) ) THEN
00478 IPVTNG = 3
00479 NPVTS = MIN( N, M )
00480 ELSE IF( LSAME( PIVTNG, 'F' ) ) THEN
00481 IPVTNG = 3
00482 NPVTS = MIN( N, M )
00483 ELSE
00484 IPVTNG = -1
00485 END IF
00486
00487
00488
00489 IF( LSAME( GRADE, 'N' ) ) THEN
00490 IGRADE = 0
00491 ELSE IF( LSAME( GRADE, 'L' ) ) THEN
00492 IGRADE = 1
00493 ELSE IF( LSAME( GRADE, 'R' ) ) THEN
00494 IGRADE = 2
00495 ELSE IF( LSAME( GRADE, 'B' ) ) THEN
00496 IGRADE = 3
00497 ELSE IF( LSAME( GRADE, 'E' ) ) THEN
00498 IGRADE = 4
00499 ELSE IF( LSAME( GRADE, 'H' ) ) THEN
00500 IGRADE = 5
00501 ELSE IF( LSAME( GRADE, 'S' ) ) THEN
00502 IGRADE = 6
00503 ELSE
00504 IGRADE = -1
00505 END IF
00506
00507
00508
00509 IF( LSAME( PACK, 'N' ) ) THEN
00510 IPACK = 0
00511 ELSE IF( LSAME( PACK, 'U' ) ) THEN
00512 IPACK = 1
00513 ELSE IF( LSAME( PACK, 'L' ) ) THEN
00514 IPACK = 2
00515 ELSE IF( LSAME( PACK, 'C' ) ) THEN
00516 IPACK = 3
00517 ELSE IF( LSAME( PACK, 'R' ) ) THEN
00518 IPACK = 4
00519 ELSE IF( LSAME( PACK, 'B' ) ) THEN
00520 IPACK = 5
00521 ELSE IF( LSAME( PACK, 'Q' ) ) THEN
00522 IPACK = 6
00523 ELSE IF( LSAME( PACK, 'Z' ) ) THEN
00524 IPACK = 7
00525 ELSE
00526 IPACK = -1
00527 END IF
00528
00529
00530
00531 MNMIN = MIN( M, N )
00532 KLL = MIN( KL, M-1 )
00533 KUU = MIN( KU, N-1 )
00534
00535
00536
00537 DZERO = .FALSE.
00538 IF( IGRADE.EQ.4 .AND. MODEL.EQ.0 ) THEN
00539 DO 10 I = 1, M
00540 IF( DL( I ).EQ.CZERO )
00541 $ DZERO = .TRUE.
00542 10 CONTINUE
00543 END IF
00544
00545
00546
00547 BADPVT = .FALSE.
00548 IF( IPVTNG.GT.0 ) THEN
00549 DO 20 J = 1, NPVTS
00550 IF( IPIVOT( J ).LE.0 .OR. IPIVOT( J ).GT.NPVTS )
00551 $ BADPVT = .TRUE.
00552 20 CONTINUE
00553 END IF
00554
00555
00556
00557 IF( M.LT.0 ) THEN
00558 INFO = -1
00559 ELSE IF( M.NE.N .AND. ( ISYM.EQ.0 .OR. ISYM.EQ.2 ) ) THEN
00560 INFO = -1
00561 ELSE IF( N.LT.0 ) THEN
00562 INFO = -2
00563 ELSE IF( IDIST.EQ.-1 ) THEN
00564 INFO = -3
00565 ELSE IF( ISYM.EQ.-1 ) THEN
00566 INFO = -5
00567 ELSE IF( MODE.LT.-6 .OR. MODE.GT.6 ) THEN
00568 INFO = -7
00569 ELSE IF( ( MODE.NE.-6 .AND. MODE.NE.0 .AND. MODE.NE.6 ) .AND.
00570 $ COND.LT.ONE ) THEN
00571 INFO = -8
00572 ELSE IF( ( MODE.NE.-6 .AND. MODE.NE.0 .AND. MODE.NE.6 ) .AND.
00573 $ IRSIGN.EQ.-1 ) THEN
00574 INFO = -10
00575 ELSE IF( IGRADE.EQ.-1 .OR. ( IGRADE.EQ.4 .AND. M.NE.N ) .OR.
00576 $ ( ( IGRADE.EQ.1 .OR. IGRADE.EQ.2 .OR. IGRADE.EQ.3 .OR.
00577 $ IGRADE.EQ.4 .OR. IGRADE.EQ.6 ) .AND. ISYM.EQ.0 ) .OR.
00578 $ ( ( IGRADE.EQ.1 .OR. IGRADE.EQ.2 .OR. IGRADE.EQ.3 .OR.
00579 $ IGRADE.EQ.4 .OR. IGRADE.EQ.5 ) .AND. ISYM.EQ.2 ) ) THEN
00580 INFO = -11
00581 ELSE IF( IGRADE.EQ.4 .AND. DZERO ) THEN
00582 INFO = -12
00583 ELSE IF( ( IGRADE.EQ.1 .OR. IGRADE.EQ.3 .OR. IGRADE.EQ.4 .OR.
00584 $ IGRADE.EQ.5 .OR. IGRADE.EQ.6 ) .AND.
00585 $ ( MODEL.LT.-6 .OR. MODEL.GT.6 ) ) THEN
00586 INFO = -13
00587 ELSE IF( ( IGRADE.EQ.1 .OR. IGRADE.EQ.3 .OR. IGRADE.EQ.4 .OR.
00588 $ IGRADE.EQ.5 .OR. IGRADE.EQ.6 ) .AND.
00589 $ ( MODEL.NE.-6 .AND. MODEL.NE.0 .AND. MODEL.NE.6 ) .AND.
00590 $ CONDL.LT.ONE ) THEN
00591 INFO = -14
00592 ELSE IF( ( IGRADE.EQ.2 .OR. IGRADE.EQ.3 ) .AND.
00593 $ ( MODER.LT.-6 .OR. MODER.GT.6 ) ) THEN
00594 INFO = -16
00595 ELSE IF( ( IGRADE.EQ.2 .OR. IGRADE.EQ.3 ) .AND.
00596 $ ( MODER.NE.-6 .AND. MODER.NE.0 .AND. MODER.NE.6 ) .AND.
00597 $ CONDR.LT.ONE ) THEN
00598 INFO = -17
00599 ELSE IF( IPVTNG.EQ.-1 .OR. ( IPVTNG.EQ.3 .AND. M.NE.N ) .OR.
00600 $ ( ( IPVTNG.EQ.1 .OR. IPVTNG.EQ.2 ) .AND. ( ISYM.EQ.0 .OR.
00601 $ ISYM.EQ.2 ) ) ) THEN
00602 INFO = -18
00603 ELSE IF( IPVTNG.NE.0 .AND. BADPVT ) THEN
00604 INFO = -19
00605 ELSE IF( KL.LT.0 ) THEN
00606 INFO = -20
00607 ELSE IF( KU.LT.0 .OR. ( ( ISYM.EQ.0 .OR. ISYM.EQ.2 ) .AND. KL.NE.
00608 $ KU ) ) THEN
00609 INFO = -21
00610 ELSE IF( SPARSE.LT.ZERO .OR. SPARSE.GT.ONE ) THEN
00611 INFO = -22
00612 ELSE IF( IPACK.EQ.-1 .OR. ( ( IPACK.EQ.1 .OR. IPACK.EQ.2 .OR.
00613 $ IPACK.EQ.5 .OR. IPACK.EQ.6 ) .AND. ISYM.EQ.1 ) .OR.
00614 $ ( IPACK.EQ.3 .AND. ISYM.EQ.1 .AND. ( KL.NE.0 .OR. M.NE.
00615 $ N ) ) .OR. ( IPACK.EQ.4 .AND. ISYM.EQ.1 .AND. ( KU.NE.
00616 $ 0 .OR. M.NE.N ) ) ) THEN
00617 INFO = -24
00618 ELSE IF( ( ( IPACK.EQ.0 .OR. IPACK.EQ.1 .OR. IPACK.EQ.2 ) .AND.
00619 $ LDA.LT.MAX( 1, M ) ) .OR. ( ( IPACK.EQ.3 .OR. IPACK.EQ.
00620 $ 4 ) .AND. LDA.LT.1 ) .OR. ( ( IPACK.EQ.5 .OR. IPACK.EQ.
00621 $ 6 ) .AND. LDA.LT.KUU+1 ) .OR.
00622 $ ( IPACK.EQ.7 .AND. LDA.LT.KLL+KUU+1 ) ) THEN
00623 INFO = -26
00624 END IF
00625
00626 IF( INFO.NE.0 ) THEN
00627 CALL XERBLA( 'CLATMR', -INFO )
00628 RETURN
00629 END IF
00630
00631
00632
00633 FULBND = .FALSE.
00634 IF( KUU.EQ.N-1 .AND. KLL.EQ.M-1 )
00635 $ FULBND = .TRUE.
00636
00637
00638
00639 DO 30 I = 1, 4
00640 ISEED( I ) = MOD( ABS( ISEED( I ) ), 4096 )
00641 30 CONTINUE
00642
00643 ISEED( 4 ) = 2*( ISEED( 4 ) / 2 ) + 1
00644
00645
00646
00647
00648
00649 CALL CLATM1( MODE, COND, IRSIGN, IDIST, ISEED, D, MNMIN, INFO )
00650 IF( INFO.NE.0 ) THEN
00651 INFO = 1
00652 RETURN
00653 END IF
00654 IF( MODE.NE.0 .AND. MODE.NE.-6 .AND. MODE.NE.6 ) THEN
00655
00656
00657
00658 TEMP = ABS( D( 1 ) )
00659 DO 40 I = 2, MNMIN
00660 TEMP = MAX( TEMP, ABS( D( I ) ) )
00661 40 CONTINUE
00662 IF( TEMP.EQ.ZERO .AND. DMAX.NE.CZERO ) THEN
00663 INFO = 2
00664 RETURN
00665 END IF
00666 IF( TEMP.NE.ZERO ) THEN
00667 CALPHA = DMAX / TEMP
00668 ELSE
00669 CALPHA = CONE
00670 END IF
00671 DO 50 I = 1, MNMIN
00672 D( I ) = CALPHA*D( I )
00673 50 CONTINUE
00674
00675 END IF
00676
00677
00678
00679 IF( ISYM.EQ.0 ) THEN
00680 DO 60 I = 1, MNMIN
00681 D( I ) = REAL( D( I ) )
00682 60 CONTINUE
00683 END IF
00684
00685
00686
00687 IF( IGRADE.EQ.1 .OR. IGRADE.EQ.3 .OR. IGRADE.EQ.4 .OR. IGRADE.EQ.
00688 $ 5 .OR. IGRADE.EQ.6 ) THEN
00689 CALL CLATM1( MODEL, CONDL, 0, IDIST, ISEED, DL, M, INFO )
00690 IF( INFO.NE.0 ) THEN
00691 INFO = 3
00692 RETURN
00693 END IF
00694 END IF
00695
00696
00697
00698 IF( IGRADE.EQ.2 .OR. IGRADE.EQ.3 ) THEN
00699 CALL CLATM1( MODER, CONDR, 0, IDIST, ISEED, DR, N, INFO )
00700 IF( INFO.NE.0 ) THEN
00701 INFO = 4
00702 RETURN
00703 END IF
00704 END IF
00705
00706
00707
00708 IF( IPVTNG.GT.0 ) THEN
00709 DO 70 I = 1, NPVTS
00710 IWORK( I ) = I
00711 70 CONTINUE
00712 IF( FULBND ) THEN
00713 DO 80 I = 1, NPVTS
00714 K = IPIVOT( I )
00715 J = IWORK( I )
00716 IWORK( I ) = IWORK( K )
00717 IWORK( K ) = J
00718 80 CONTINUE
00719 ELSE
00720 DO 90 I = NPVTS, 1, -1
00721 K = IPIVOT( I )
00722 J = IWORK( I )
00723 IWORK( I ) = IWORK( K )
00724 IWORK( K ) = J
00725 90 CONTINUE
00726 END IF
00727 END IF
00728
00729
00730
00731
00732
00733
00734 IF( FULBND ) THEN
00735
00736
00737
00738
00739 IF( IPACK.EQ.0 ) THEN
00740 IF( ISYM.EQ.0 ) THEN
00741 DO 110 J = 1, N
00742 DO 100 I = 1, J
00743 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00744 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00745 $ IWORK, SPARSE )
00746 A( ISUB, JSUB ) = CTEMP
00747 A( JSUB, ISUB ) = CONJG( CTEMP )
00748 100 CONTINUE
00749 110 CONTINUE
00750 ELSE IF( ISYM.EQ.1 ) THEN
00751 DO 130 J = 1, N
00752 DO 120 I = 1, M
00753 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00754 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00755 $ IWORK, SPARSE )
00756 A( ISUB, JSUB ) = CTEMP
00757 120 CONTINUE
00758 130 CONTINUE
00759 ELSE IF( ISYM.EQ.2 ) THEN
00760 DO 150 J = 1, N
00761 DO 140 I = 1, J
00762 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00763 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00764 $ IWORK, SPARSE )
00765 A( ISUB, JSUB ) = CTEMP
00766 A( JSUB, ISUB ) = CTEMP
00767 140 CONTINUE
00768 150 CONTINUE
00769 END IF
00770
00771 ELSE IF( IPACK.EQ.1 ) THEN
00772
00773 DO 170 J = 1, N
00774 DO 160 I = 1, J
00775 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU, IDIST,
00776 $ ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK,
00777 $ SPARSE )
00778 MNSUB = MIN( ISUB, JSUB )
00779 MXSUB = MAX( ISUB, JSUB )
00780 IF( MXSUB.EQ.ISUB .AND. ISYM.EQ.0 ) THEN
00781 A( MNSUB, MXSUB ) = CONJG( CTEMP )
00782 ELSE
00783 A( MNSUB, MXSUB ) = CTEMP
00784 END IF
00785 IF( MNSUB.NE.MXSUB )
00786 $ A( MXSUB, MNSUB ) = CZERO
00787 160 CONTINUE
00788 170 CONTINUE
00789
00790 ELSE IF( IPACK.EQ.2 ) THEN
00791
00792 DO 190 J = 1, N
00793 DO 180 I = 1, J
00794 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU, IDIST,
00795 $ ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK,
00796 $ SPARSE )
00797 MNSUB = MIN( ISUB, JSUB )
00798 MXSUB = MAX( ISUB, JSUB )
00799 IF( MXSUB.EQ.JSUB .AND. ISYM.EQ.0 ) THEN
00800 A( MXSUB, MNSUB ) = CONJG( CTEMP )
00801 ELSE
00802 A( MXSUB, MNSUB ) = CTEMP
00803 END IF
00804 IF( MNSUB.NE.MXSUB )
00805 $ A( MNSUB, MXSUB ) = CZERO
00806 180 CONTINUE
00807 190 CONTINUE
00808
00809 ELSE IF( IPACK.EQ.3 ) THEN
00810
00811 DO 210 J = 1, N
00812 DO 200 I = 1, J
00813 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU, IDIST,
00814 $ ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK,
00815 $ SPARSE )
00816
00817
00818
00819
00820 MNSUB = MIN( ISUB, JSUB )
00821 MXSUB = MAX( ISUB, JSUB )
00822 K = MXSUB*( MXSUB-1 ) / 2 + MNSUB
00823
00824
00825
00826 JJSUB = ( K-1 ) / LDA + 1
00827 IISUB = K - LDA*( JJSUB-1 )
00828
00829 IF( MXSUB.EQ.ISUB .AND. ISYM.EQ.0 ) THEN
00830 A( IISUB, JJSUB ) = CONJG( CTEMP )
00831 ELSE
00832 A( IISUB, JJSUB ) = CTEMP
00833 END IF
00834 200 CONTINUE
00835 210 CONTINUE
00836
00837 ELSE IF( IPACK.EQ.4 ) THEN
00838
00839 DO 230 J = 1, N
00840 DO 220 I = 1, J
00841 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU, IDIST,
00842 $ ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK,
00843 $ SPARSE )
00844
00845
00846
00847 MNSUB = MIN( ISUB, JSUB )
00848 MXSUB = MAX( ISUB, JSUB )
00849 IF( MNSUB.EQ.1 ) THEN
00850 K = MXSUB
00851 ELSE
00852 K = N*( N+1 ) / 2 - ( N-MNSUB+1 )*( N-MNSUB+2 ) /
00853 $ 2 + MXSUB - MNSUB + 1
00854 END IF
00855
00856
00857
00858 JJSUB = ( K-1 ) / LDA + 1
00859 IISUB = K - LDA*( JJSUB-1 )
00860
00861 IF( MXSUB.EQ.JSUB .AND. ISYM.EQ.0 ) THEN
00862 A( IISUB, JJSUB ) = CONJG( CTEMP )
00863 ELSE
00864 A( IISUB, JJSUB ) = CTEMP
00865 END IF
00866 220 CONTINUE
00867 230 CONTINUE
00868
00869 ELSE IF( IPACK.EQ.5 ) THEN
00870
00871 DO 250 J = 1, N
00872 DO 240 I = J - KUU, J
00873 IF( I.LT.1 ) THEN
00874 A( J-I+1, I+N ) = CZERO
00875 ELSE
00876 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00877 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00878 $ IWORK, SPARSE )
00879 MNSUB = MIN( ISUB, JSUB )
00880 MXSUB = MAX( ISUB, JSUB )
00881 IF( MXSUB.EQ.JSUB .AND. ISYM.EQ.0 ) THEN
00882 A( MXSUB-MNSUB+1, MNSUB ) = CONJG( CTEMP )
00883 ELSE
00884 A( MXSUB-MNSUB+1, MNSUB ) = CTEMP
00885 END IF
00886 END IF
00887 240 CONTINUE
00888 250 CONTINUE
00889
00890 ELSE IF( IPACK.EQ.6 ) THEN
00891
00892 DO 270 J = 1, N
00893 DO 260 I = J - KUU, J
00894 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU, IDIST,
00895 $ ISEED, D, IGRADE, DL, DR, IPVTNG, IWORK,
00896 $ SPARSE )
00897 MNSUB = MIN( ISUB, JSUB )
00898 MXSUB = MAX( ISUB, JSUB )
00899 IF( MXSUB.EQ.ISUB .AND. ISYM.EQ.0 ) THEN
00900 A( MNSUB-MXSUB+KUU+1, MXSUB ) = CONJG( CTEMP )
00901 ELSE
00902 A( MNSUB-MXSUB+KUU+1, MXSUB ) = CTEMP
00903 END IF
00904 260 CONTINUE
00905 270 CONTINUE
00906
00907 ELSE IF( IPACK.EQ.7 ) THEN
00908
00909 IF( ISYM.NE.1 ) THEN
00910 DO 290 J = 1, N
00911 DO 280 I = J - KUU, J
00912 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00913 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00914 $ IWORK, SPARSE )
00915 MNSUB = MIN( ISUB, JSUB )
00916 MXSUB = MAX( ISUB, JSUB )
00917 IF( I.LT.1 )
00918 $ A( J-I+1+KUU, I+N ) = CZERO
00919 IF( MXSUB.EQ.ISUB .AND. ISYM.EQ.0 ) THEN
00920 A( MNSUB-MXSUB+KUU+1, MXSUB ) = CONJG( CTEMP )
00921 ELSE
00922 A( MNSUB-MXSUB+KUU+1, MXSUB ) = CTEMP
00923 END IF
00924 IF( I.GE.1 .AND. MNSUB.NE.MXSUB ) THEN
00925 IF( MNSUB.EQ.ISUB .AND. ISYM.EQ.0 ) THEN
00926 A( MXSUB-MNSUB+1+KUU,
00927 $ MNSUB ) = CONJG( CTEMP )
00928 ELSE
00929 A( MXSUB-MNSUB+1+KUU, MNSUB ) = CTEMP
00930 END IF
00931 END IF
00932 280 CONTINUE
00933 290 CONTINUE
00934 ELSE IF( ISYM.EQ.1 ) THEN
00935 DO 310 J = 1, N
00936 DO 300 I = J - KUU, J + KLL
00937 CTEMP = CLATM3( M, N, I, J, ISUB, JSUB, KL, KU,
00938 $ IDIST, ISEED, D, IGRADE, DL, DR, IPVTNG,
00939 $ IWORK, SPARSE )
00940 A( ISUB-JSUB+KUU+1, JSUB ) = CTEMP
00941 300 CONTINUE
00942 310 CONTINUE
00943 END IF
00944
00945 END IF
00946
00947 ELSE
00948
00949
00950
00951 IF( IPACK.EQ.0 ) THEN
00952 IF( ISYM.EQ.0 ) THEN
00953 DO 330 J = 1, N
00954 DO 320 I = 1, J
00955 A( I, J ) = CLATM2( M, N, I, J, KL, KU, IDIST,
00956 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
00957 $ IWORK, SPARSE )
00958 A( J, I ) = CONJG( A( I, J ) )
00959 320 CONTINUE
00960 330 CONTINUE
00961 ELSE IF( ISYM.EQ.1 ) THEN
00962 DO 350 J = 1, N
00963 DO 340 I = 1, M
00964 A( I, J ) = CLATM2( M, N, I, J, KL, KU, IDIST,
00965 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
00966 $ IWORK, SPARSE )
00967 340 CONTINUE
00968 350 CONTINUE
00969 ELSE IF( ISYM.EQ.2 ) THEN
00970 DO 370 J = 1, N
00971 DO 360 I = 1, J
00972 A( I, J ) = CLATM2( M, N, I, J, KL, KU, IDIST,
00973 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
00974 $ IWORK, SPARSE )
00975 A( J, I ) = A( I, J )
00976 360 CONTINUE
00977 370 CONTINUE
00978 END IF
00979
00980 ELSE IF( IPACK.EQ.1 ) THEN
00981
00982 DO 390 J = 1, N
00983 DO 380 I = 1, J
00984 A( I, J ) = CLATM2( M, N, I, J, KL, KU, IDIST, ISEED,
00985 $ D, IGRADE, DL, DR, IPVTNG, IWORK, SPARSE )
00986 IF( I.NE.J )
00987 $ A( J, I ) = CZERO
00988 380 CONTINUE
00989 390 CONTINUE
00990
00991 ELSE IF( IPACK.EQ.2 ) THEN
00992
00993 DO 410 J = 1, N
00994 DO 400 I = 1, J
00995 IF( ISYM.EQ.0 ) THEN
00996 A( J, I ) = CONJG( CLATM2( M, N, I, J, KL, KU,
00997 $ IDIST, ISEED, D, IGRADE, DL, DR,
00998 $ IPVTNG, IWORK, SPARSE ) )
00999 ELSE
01000 A( J, I ) = CLATM2( M, N, I, J, KL, KU, IDIST,
01001 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
01002 $ IWORK, SPARSE )
01003 END IF
01004 IF( I.NE.J )
01005 $ A( I, J ) = CZERO
01006 400 CONTINUE
01007 410 CONTINUE
01008
01009 ELSE IF( IPACK.EQ.3 ) THEN
01010
01011 ISUB = 0
01012 JSUB = 1
01013 DO 430 J = 1, N
01014 DO 420 I = 1, J
01015 ISUB = ISUB + 1
01016 IF( ISUB.GT.LDA ) THEN
01017 ISUB = 1
01018 JSUB = JSUB + 1
01019 END IF
01020 A( ISUB, JSUB ) = CLATM2( M, N, I, J, KL, KU, IDIST,
01021 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
01022 $ IWORK, SPARSE )
01023 420 CONTINUE
01024 430 CONTINUE
01025
01026 ELSE IF( IPACK.EQ.4 ) THEN
01027
01028 IF( ISYM.EQ.0 .OR. ISYM.EQ.2 ) THEN
01029 DO 450 J = 1, N
01030 DO 440 I = 1, J
01031
01032
01033
01034 IF( I.EQ.1 ) THEN
01035 K = J
01036 ELSE
01037 K = N*( N+1 ) / 2 - ( N-I+1 )*( N-I+2 ) / 2 +
01038 $ J - I + 1
01039 END IF
01040
01041
01042
01043 JSUB = ( K-1 ) / LDA + 1
01044 ISUB = K - LDA*( JSUB-1 )
01045
01046 A( ISUB, JSUB ) = CLATM2( M, N, I, J, KL, KU,
01047 $ IDIST, ISEED, D, IGRADE, DL, DR,
01048 $ IPVTNG, IWORK, SPARSE )
01049 IF( ISYM.EQ.0 )
01050 $ A( ISUB, JSUB ) = CONJG( A( ISUB, JSUB ) )
01051 440 CONTINUE
01052 450 CONTINUE
01053 ELSE
01054 ISUB = 0
01055 JSUB = 1
01056 DO 470 J = 1, N
01057 DO 460 I = J, M
01058 ISUB = ISUB + 1
01059 IF( ISUB.GT.LDA ) THEN
01060 ISUB = 1
01061 JSUB = JSUB + 1
01062 END IF
01063 A( ISUB, JSUB ) = CLATM2( M, N, I, J, KL, KU,
01064 $ IDIST, ISEED, D, IGRADE, DL, DR,
01065 $ IPVTNG, IWORK, SPARSE )
01066 460 CONTINUE
01067 470 CONTINUE
01068 END IF
01069
01070 ELSE IF( IPACK.EQ.5 ) THEN
01071
01072 DO 490 J = 1, N
01073 DO 480 I = J - KUU, J
01074 IF( I.LT.1 ) THEN
01075 A( J-I+1, I+N ) = CZERO
01076 ELSE
01077 IF( ISYM.EQ.0 ) THEN
01078 A( J-I+1, I ) = CONJG( CLATM2( M, N, I, J, KL,
01079 $ KU, IDIST, ISEED, D, IGRADE, DL,
01080 $ DR, IPVTNG, IWORK, SPARSE ) )
01081 ELSE
01082 A( J-I+1, I ) = CLATM2( M, N, I, J, KL, KU,
01083 $ IDIST, ISEED, D, IGRADE, DL, DR,
01084 $ IPVTNG, IWORK, SPARSE )
01085 END IF
01086 END IF
01087 480 CONTINUE
01088 490 CONTINUE
01089
01090 ELSE IF( IPACK.EQ.6 ) THEN
01091
01092 DO 510 J = 1, N
01093 DO 500 I = J - KUU, J
01094 A( I-J+KUU+1, J ) = CLATM2( M, N, I, J, KL, KU, IDIST,
01095 $ ISEED, D, IGRADE, DL, DR, IPVTNG,
01096 $ IWORK, SPARSE )
01097 500 CONTINUE
01098 510 CONTINUE
01099
01100 ELSE IF( IPACK.EQ.7 ) THEN
01101
01102 IF( ISYM.NE.1 ) THEN
01103 DO 530 J = 1, N
01104 DO 520 I = J - KUU, J
01105 A( I-J+KUU+1, J ) = CLATM2( M, N, I, J, KL, KU,
01106 $ IDIST, ISEED, D, IGRADE, DL,
01107 $ DR, IPVTNG, IWORK, SPARSE )
01108 IF( I.LT.1 )
01109 $ A( J-I+1+KUU, I+N ) = CZERO
01110 IF( I.GE.1 .AND. I.NE.J ) THEN
01111 IF( ISYM.EQ.0 ) THEN
01112 A( J-I+1+KUU, I ) = CONJG( A( I-J+KUU+1,
01113 $ J ) )
01114 ELSE
01115 A( J-I+1+KUU, I ) = A( I-J+KUU+1, J )
01116 END IF
01117 END IF
01118 520 CONTINUE
01119 530 CONTINUE
01120 ELSE IF( ISYM.EQ.1 ) THEN
01121 DO 550 J = 1, N
01122 DO 540 I = J - KUU, J + KLL
01123 A( I-J+KUU+1, J ) = CLATM2( M, N, I, J, KL, KU,
01124 $ IDIST, ISEED, D, IGRADE, DL,
01125 $ DR, IPVTNG, IWORK, SPARSE )
01126 540 CONTINUE
01127 550 CONTINUE
01128 END IF
01129
01130 END IF
01131
01132 END IF
01133
01134
01135
01136 IF( IPACK.EQ.0 ) THEN
01137 ONORM = CLANGE( 'M', M, N, A, LDA, TEMPA )
01138 ELSE IF( IPACK.EQ.1 ) THEN
01139 ONORM = CLANSY( 'M', 'U', N, A, LDA, TEMPA )
01140 ELSE IF( IPACK.EQ.2 ) THEN
01141 ONORM = CLANSY( 'M', 'L', N, A, LDA, TEMPA )
01142 ELSE IF( IPACK.EQ.3 ) THEN
01143 ONORM = CLANSP( 'M', 'U', N, A, TEMPA )
01144 ELSE IF( IPACK.EQ.4 ) THEN
01145 ONORM = CLANSP( 'M', 'L', N, A, TEMPA )
01146 ELSE IF( IPACK.EQ.5 ) THEN
01147 ONORM = CLANSB( 'M', 'L', N, KLL, A, LDA, TEMPA )
01148 ELSE IF( IPACK.EQ.6 ) THEN
01149 ONORM = CLANSB( 'M', 'U', N, KUU, A, LDA, TEMPA )
01150 ELSE IF( IPACK.EQ.7 ) THEN
01151 ONORM = CLANGB( 'M', N, KLL, KUU, A, LDA, TEMPA )
01152 END IF
01153
01154 IF( ANORM.GE.ZERO ) THEN
01155
01156 IF( ANORM.GT.ZERO .AND. ONORM.EQ.ZERO ) THEN
01157
01158
01159
01160 INFO = 5
01161 RETURN
01162
01163 ELSE IF( ( ANORM.GT.ONE .AND. ONORM.LT.ONE ) .OR.
01164 $ ( ANORM.LT.ONE .AND. ONORM.GT.ONE ) ) THEN
01165
01166
01167
01168 IF( IPACK.LE.2 ) THEN
01169 DO 560 J = 1, N
01170 CALL CSSCAL( M, ONE / ONORM, A( 1, J ), 1 )
01171 CALL CSSCAL( M, ANORM, A( 1, J ), 1 )
01172 560 CONTINUE
01173
01174 ELSE IF( IPACK.EQ.3 .OR. IPACK.EQ.4 ) THEN
01175
01176 CALL CSSCAL( N*( N+1 ) / 2, ONE / ONORM, A, 1 )
01177 CALL CSSCAL( N*( N+1 ) / 2, ANORM, A, 1 )
01178
01179 ELSE IF( IPACK.GE.5 ) THEN
01180
01181 DO 570 J = 1, N
01182 CALL CSSCAL( KLL+KUU+1, ONE / ONORM, A( 1, J ), 1 )
01183 CALL CSSCAL( KLL+KUU+1, ANORM, A( 1, J ), 1 )
01184 570 CONTINUE
01185
01186 END IF
01187
01188 ELSE
01189
01190
01191
01192 IF( IPACK.LE.2 ) THEN
01193 DO 580 J = 1, N
01194 CALL CSSCAL( M, ANORM / ONORM, A( 1, J ), 1 )
01195 580 CONTINUE
01196
01197 ELSE IF( IPACK.EQ.3 .OR. IPACK.EQ.4 ) THEN
01198
01199 CALL CSSCAL( N*( N+1 ) / 2, ANORM / ONORM, A, 1 )
01200
01201 ELSE IF( IPACK.GE.5 ) THEN
01202
01203 DO 590 J = 1, N
01204 CALL CSSCAL( KLL+KUU+1, ANORM / ONORM, A( 1, J ), 1 )
01205 590 CONTINUE
01206 END IF
01207
01208 END IF
01209
01210 END IF
01211
01212
01213
01214 END