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