00001 SUBROUTINE DGSVJ0( JOBV, M, N, A, LDA, D, SVA, MV, V, LDV, EPS,
00002 + SFMIN, TOL, NSWEEP, WORK, LWORK, INFO )
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 IMPLICIT NONE
00019
00020 INTEGER INFO, LDA, LDV, LWORK, M, MV, N, NSWEEP
00021 DOUBLE PRECISION EPS, SFMIN, TOL
00022 CHARACTER*1 JOBV
00023
00024
00025 DOUBLE PRECISION A( LDA, * ), SVA( N ), D( N ), V( LDV, * ),
00026 + WORK( LWORK )
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 DOUBLE PRECISION ZERO, HALF, ONE, TWO
00146 PARAMETER ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0,
00147 + TWO = 2.0D0 )
00148
00149
00150 DOUBLE PRECISION AAPP, AAPP0, AAPQ, AAQQ, APOAQ, AQOAP, BIG,
00151 + BIGTHETA, CS, MXAAPQ, MXSINJ, ROOTBIG, ROOTEPS,
00152 + ROOTSFMIN, ROOTTOL, SMALL, SN, T, TEMP1, THETA,
00153 + THSIGN
00154 INTEGER BLSKIP, EMPTSW, i, ibr, IERR, igl, IJBLSK, ir1,
00155 + ISWROT, jbc, jgl, KBL, LKAHEAD, MVL, NBL,
00156 + NOTROT, p, PSKIPPED, q, ROWSKIP, SWBAND
00157 LOGICAL APPLV, ROTOK, RSVEC
00158
00159
00160 DOUBLE PRECISION FASTR( 5 )
00161
00162
00163 INTRINSIC DABS, DMAX1, DBLE, MIN0, DSIGN, DSQRT
00164
00165
00166 DOUBLE PRECISION DDOT, DNRM2
00167 INTEGER IDAMAX
00168 LOGICAL LSAME
00169 EXTERNAL IDAMAX, LSAME, DDOT, DNRM2
00170
00171
00172 EXTERNAL DAXPY, DCOPY, DLASCL, DLASSQ, DROTM, DSWAP
00173
00174
00175
00176 APPLV = LSAME( JOBV, 'A' )
00177 RSVEC = LSAME( JOBV, 'V' )
00178 IF( .NOT.( RSVEC .OR. APPLV .OR. LSAME( JOBV, 'N' ) ) ) THEN
00179 INFO = -1
00180 ELSE IF( M.LT.0 ) THEN
00181 INFO = -2
00182 ELSE IF( ( N.LT.0 ) .OR. ( N.GT.M ) ) THEN
00183 INFO = -3
00184 ELSE IF( LDA.LT.M ) THEN
00185 INFO = -5
00186 ELSE IF( ( RSVEC.OR.APPLV ) .AND. ( MV.LT.0 ) ) THEN
00187 INFO = -8
00188 ELSE IF( ( RSVEC.AND.( LDV.LT.N ) ).OR.
00189 & ( APPLV.AND.( LDV.LT.MV ) ) ) THEN
00190 INFO = -10
00191 ELSE IF( TOL.LE.EPS ) THEN
00192 INFO = -13
00193 ELSE IF( NSWEEP.LT.0 ) THEN
00194 INFO = -14
00195 ELSE IF( LWORK.LT.M ) THEN
00196 INFO = -16
00197 ELSE
00198 INFO = 0
00199 END IF
00200
00201
00202 IF( INFO.NE.0 ) THEN
00203 CALL XERBLA( 'DGSVJ0', -INFO )
00204 RETURN
00205 END IF
00206
00207 IF( RSVEC ) THEN
00208 MVL = N
00209 ELSE IF( APPLV ) THEN
00210 MVL = MV
00211 END IF
00212 RSVEC = RSVEC .OR. APPLV
00213
00214 ROOTEPS = DSQRT( EPS )
00215 ROOTSFMIN = DSQRT( SFMIN )
00216 SMALL = SFMIN / EPS
00217 BIG = ONE / SFMIN
00218 ROOTBIG = ONE / ROOTSFMIN
00219 BIGTHETA = ONE / ROOTEPS
00220 ROOTTOL = DSQRT( TOL )
00221
00222
00223
00224
00225 EMPTSW = ( N*( N-1 ) ) / 2
00226 NOTROT = 0
00227 FASTR( 1 ) = ZERO
00228
00229
00230
00231
00232 SWBAND = 0
00233
00234
00235
00236
00237
00238 KBL = MIN0( 8, N )
00239
00240
00241
00242
00243
00244 NBL = N / KBL
00245 IF( ( NBL*KBL ).NE.N )NBL = NBL + 1
00246
00247 BLSKIP = ( KBL**2 ) + 1
00248
00249
00250 ROWSKIP = MIN0( 5, KBL )
00251
00252
00253 LKAHEAD = 1
00254
00255 SWBAND = 0
00256 PSKIPPED = 0
00257
00258 DO 1993 i = 1, NSWEEP
00259
00260
00261 MXAAPQ = ZERO
00262 MXSINJ = ZERO
00263 ISWROT = 0
00264
00265 NOTROT = 0
00266 PSKIPPED = 0
00267
00268 DO 2000 ibr = 1, NBL
00269
00270 igl = ( ibr-1 )*KBL + 1
00271
00272 DO 1002 ir1 = 0, MIN0( LKAHEAD, NBL-ibr )
00273
00274 igl = igl + ir1*KBL
00275
00276 DO 2001 p = igl, MIN0( igl+KBL-1, N-1 )
00277
00278
00279 q = IDAMAX( N-p+1, SVA( p ), 1 ) + p - 1
00280 IF( p.NE.q ) THEN
00281 CALL DSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
00282 IF( RSVEC )CALL DSWAP( MVL, V( 1, p ), 1,
00283 + V( 1, q ), 1 )
00284 TEMP1 = SVA( p )
00285 SVA( p ) = SVA( q )
00286 SVA( q ) = TEMP1
00287 TEMP1 = D( p )
00288 D( p ) = D( q )
00289 D( q ) = TEMP1
00290 END IF
00291
00292 IF( ir1.EQ.0 ) THEN
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306 IF( ( SVA( p ).LT.ROOTBIG ) .AND.
00307 + ( SVA( p ).GT.ROOTSFMIN ) ) THEN
00308 SVA( p ) = DNRM2( M, A( 1, p ), 1 )*D( p )
00309 ELSE
00310 TEMP1 = ZERO
00311 AAPP = ONE
00312 CALL DLASSQ( M, A( 1, p ), 1, TEMP1, AAPP )
00313 SVA( p ) = TEMP1*DSQRT( AAPP )*D( p )
00314 END IF
00315 AAPP = SVA( p )
00316 ELSE
00317 AAPP = SVA( p )
00318 END IF
00319
00320
00321 IF( AAPP.GT.ZERO ) THEN
00322
00323 PSKIPPED = 0
00324
00325 DO 2002 q = p + 1, MIN0( igl+KBL-1, N )
00326
00327 AAQQ = SVA( q )
00328
00329 IF( AAQQ.GT.ZERO ) THEN
00330
00331 AAPP0 = AAPP
00332 IF( AAQQ.GE.ONE ) THEN
00333 ROTOK = ( SMALL*AAPP ).LE.AAQQ
00334 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
00335 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
00336 + q ), 1 )*D( p )*D( q ) / AAQQ )
00337 + / AAPP
00338 ELSE
00339 CALL DCOPY( M, A( 1, p ), 1, WORK, 1 )
00340 CALL DLASCL( 'G', 0, 0, AAPP, D( p ),
00341 + M, 1, WORK, LDA, IERR )
00342 AAPQ = DDOT( M, WORK, 1, A( 1, q ),
00343 + 1 )*D( q ) / AAQQ
00344 END IF
00345 ELSE
00346 ROTOK = AAPP.LE.( AAQQ / SMALL )
00347 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
00348 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
00349 + q ), 1 )*D( p )*D( q ) / AAQQ )
00350 + / AAPP
00351 ELSE
00352 CALL DCOPY( M, A( 1, q ), 1, WORK, 1 )
00353 CALL DLASCL( 'G', 0, 0, AAQQ, D( q ),
00354 + M, 1, WORK, LDA, IERR )
00355 AAPQ = DDOT( M, WORK, 1, A( 1, p ),
00356 + 1 )*D( p ) / AAPP
00357 END IF
00358 END IF
00359
00360 MXAAPQ = DMAX1( MXAAPQ, DABS( AAPQ ) )
00361
00362
00363
00364 IF( DABS( AAPQ ).GT.TOL ) THEN
00365
00366
00367
00368
00369 IF( ir1.EQ.0 ) THEN
00370 NOTROT = 0
00371 PSKIPPED = 0
00372 ISWROT = ISWROT + 1
00373 END IF
00374
00375 IF( ROTOK ) THEN
00376
00377 AQOAP = AAQQ / AAPP
00378 APOAQ = AAPP / AAQQ
00379 THETA = -HALF*DABS( AQOAP-APOAQ ) /
00380 + AAPQ
00381
00382 IF( DABS( THETA ).GT.BIGTHETA ) THEN
00383
00384 T = HALF / THETA
00385 FASTR( 3 ) = T*D( p ) / D( q )
00386 FASTR( 4 ) = -T*D( q ) / D( p )
00387 CALL DROTM( M, A( 1, p ), 1,
00388 + A( 1, q ), 1, FASTR )
00389 IF( RSVEC )CALL DROTM( MVL,
00390 + V( 1, p ), 1,
00391 + V( 1, q ), 1,
00392 + FASTR )
00393 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00394 + ONE+T*APOAQ*AAPQ ) )
00395 AAPP = AAPP*DSQRT( DMAX1( ZERO,
00396 + ONE-T*AQOAP*AAPQ ) )
00397 MXSINJ = DMAX1( MXSINJ, DABS( T ) )
00398
00399 ELSE
00400
00401
00402
00403 THSIGN = -DSIGN( ONE, AAPQ )
00404 T = ONE / ( THETA+THSIGN*
00405 + DSQRT( ONE+THETA*THETA ) )
00406 CS = DSQRT( ONE / ( ONE+T*T ) )
00407 SN = T*CS
00408
00409 MXSINJ = DMAX1( MXSINJ, DABS( SN ) )
00410 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00411 + ONE+T*APOAQ*AAPQ ) )
00412 AAPP = AAPP*DSQRT( DMAX1( ZERO,
00413 + ONE-T*AQOAP*AAPQ ) )
00414
00415 APOAQ = D( p ) / D( q )
00416 AQOAP = D( q ) / D( p )
00417 IF( D( p ).GE.ONE ) THEN
00418 IF( D( q ).GE.ONE ) THEN
00419 FASTR( 3 ) = T*APOAQ
00420 FASTR( 4 ) = -T*AQOAP
00421 D( p ) = D( p )*CS
00422 D( q ) = D( q )*CS
00423 CALL DROTM( M, A( 1, p ), 1,
00424 + A( 1, q ), 1,
00425 + FASTR )
00426 IF( RSVEC )CALL DROTM( MVL,
00427 + V( 1, p ), 1, V( 1, q ),
00428 + 1, FASTR )
00429 ELSE
00430 CALL DAXPY( M, -T*AQOAP,
00431 + A( 1, q ), 1,
00432 + A( 1, p ), 1 )
00433 CALL DAXPY( M, CS*SN*APOAQ,
00434 + A( 1, p ), 1,
00435 + A( 1, q ), 1 )
00436 D( p ) = D( p )*CS
00437 D( q ) = D( q ) / CS
00438 IF( RSVEC ) THEN
00439 CALL DAXPY( MVL, -T*AQOAP,
00440 + V( 1, q ), 1,
00441 + V( 1, p ), 1 )
00442 CALL DAXPY( MVL,
00443 + CS*SN*APOAQ,
00444 + V( 1, p ), 1,
00445 + V( 1, q ), 1 )
00446 END IF
00447 END IF
00448 ELSE
00449 IF( D( q ).GE.ONE ) THEN
00450 CALL DAXPY( M, T*APOAQ,
00451 + A( 1, p ), 1,
00452 + A( 1, q ), 1 )
00453 CALL DAXPY( M, -CS*SN*AQOAP,
00454 + A( 1, q ), 1,
00455 + A( 1, p ), 1 )
00456 D( p ) = D( p ) / CS
00457 D( q ) = D( q )*CS
00458 IF( RSVEC ) THEN
00459 CALL DAXPY( MVL, T*APOAQ,
00460 + V( 1, p ), 1,
00461 + V( 1, q ), 1 )
00462 CALL DAXPY( MVL,
00463 + -CS*SN*AQOAP,
00464 + V( 1, q ), 1,
00465 + V( 1, p ), 1 )
00466 END IF
00467 ELSE
00468 IF( D( p ).GE.D( q ) ) THEN
00469 CALL DAXPY( M, -T*AQOAP,
00470 + A( 1, q ), 1,
00471 + A( 1, p ), 1 )
00472 CALL DAXPY( M, CS*SN*APOAQ,
00473 + A( 1, p ), 1,
00474 + A( 1, q ), 1 )
00475 D( p ) = D( p )*CS
00476 D( q ) = D( q ) / CS
00477 IF( RSVEC ) THEN
00478 CALL DAXPY( MVL,
00479 + -T*AQOAP,
00480 + V( 1, q ), 1,
00481 + V( 1, p ), 1 )
00482 CALL DAXPY( MVL,
00483 + CS*SN*APOAQ,
00484 + V( 1, p ), 1,
00485 + V( 1, q ), 1 )
00486 END IF
00487 ELSE
00488 CALL DAXPY( M, T*APOAQ,
00489 + A( 1, p ), 1,
00490 + A( 1, q ), 1 )
00491 CALL DAXPY( M,
00492 + -CS*SN*AQOAP,
00493 + A( 1, q ), 1,
00494 + A( 1, p ), 1 )
00495 D( p ) = D( p ) / CS
00496 D( q ) = D( q )*CS
00497 IF( RSVEC ) THEN
00498 CALL DAXPY( MVL,
00499 + T*APOAQ, V( 1, p ),
00500 + 1, V( 1, q ), 1 )
00501 CALL DAXPY( MVL,
00502 + -CS*SN*AQOAP,
00503 + V( 1, q ), 1,
00504 + V( 1, p ), 1 )
00505 END IF
00506 END IF
00507 END IF
00508 END IF
00509 END IF
00510
00511 ELSE
00512
00513 CALL DCOPY( M, A( 1, p ), 1, WORK, 1 )
00514 CALL DLASCL( 'G', 0, 0, AAPP, ONE, M,
00515 + 1, WORK, LDA, IERR )
00516 CALL DLASCL( 'G', 0, 0, AAQQ, ONE, M,
00517 + 1, A( 1, q ), LDA, IERR )
00518 TEMP1 = -AAPQ*D( p ) / D( q )
00519 CALL DAXPY( M, TEMP1, WORK, 1,
00520 + A( 1, q ), 1 )
00521 CALL DLASCL( 'G', 0, 0, ONE, AAQQ, M,
00522 + 1, A( 1, q ), LDA, IERR )
00523 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00524 + ONE-AAPQ*AAPQ ) )
00525 MXSINJ = DMAX1( MXSINJ, SFMIN )
00526 END IF
00527
00528
00529
00530
00531 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
00532 + THEN
00533 IF( ( AAQQ.LT.ROOTBIG ) .AND.
00534 + ( AAQQ.GT.ROOTSFMIN ) ) THEN
00535 SVA( q ) = DNRM2( M, A( 1, q ), 1 )*
00536 + D( q )
00537 ELSE
00538 T = ZERO
00539 AAQQ = ONE
00540 CALL DLASSQ( M, A( 1, q ), 1, T,
00541 + AAQQ )
00542 SVA( q ) = T*DSQRT( AAQQ )*D( q )
00543 END IF
00544 END IF
00545 IF( ( AAPP / AAPP0 ).LE.ROOTEPS ) THEN
00546 IF( ( AAPP.LT.ROOTBIG ) .AND.
00547 + ( AAPP.GT.ROOTSFMIN ) ) THEN
00548 AAPP = DNRM2( M, A( 1, p ), 1 )*
00549 + D( p )
00550 ELSE
00551 T = ZERO
00552 AAPP = ONE
00553 CALL DLASSQ( M, A( 1, p ), 1, T,
00554 + AAPP )
00555 AAPP = T*DSQRT( AAPP )*D( p )
00556 END IF
00557 SVA( p ) = AAPP
00558 END IF
00559
00560 ELSE
00561
00562 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
00563 PSKIPPED = PSKIPPED + 1
00564 END IF
00565 ELSE
00566
00567 IF( ir1.EQ.0 )NOTROT = NOTROT + 1
00568 PSKIPPED = PSKIPPED + 1
00569 END IF
00570
00571 IF( ( i.LE.SWBAND ) .AND.
00572 + ( PSKIPPED.GT.ROWSKIP ) ) THEN
00573 IF( ir1.EQ.0 )AAPP = -AAPP
00574 NOTROT = 0
00575 GO TO 2103
00576 END IF
00577
00578 2002 CONTINUE
00579
00580
00581 2103 CONTINUE
00582
00583
00584 SVA( p ) = AAPP
00585
00586 ELSE
00587 SVA( p ) = AAPP
00588 IF( ( ir1.EQ.0 ) .AND. ( AAPP.EQ.ZERO ) )
00589 + NOTROT = NOTROT + MIN0( igl+KBL-1, N ) - p
00590 END IF
00591
00592 2001 CONTINUE
00593
00594
00595 1002 CONTINUE
00596
00597
00598
00599
00600
00601 igl = ( ibr-1 )*KBL + 1
00602
00603 DO 2010 jbc = ibr + 1, NBL
00604
00605 jgl = ( jbc-1 )*KBL + 1
00606
00607
00608
00609 IJBLSK = 0
00610 DO 2100 p = igl, MIN0( igl+KBL-1, N )
00611
00612 AAPP = SVA( p )
00613
00614 IF( AAPP.GT.ZERO ) THEN
00615
00616 PSKIPPED = 0
00617
00618 DO 2200 q = jgl, MIN0( jgl+KBL-1, N )
00619
00620 AAQQ = SVA( q )
00621
00622 IF( AAQQ.GT.ZERO ) THEN
00623 AAPP0 = AAPP
00624
00625
00626
00627
00628
00629 IF( AAQQ.GE.ONE ) THEN
00630 IF( AAPP.GE.AAQQ ) THEN
00631 ROTOK = ( SMALL*AAPP ).LE.AAQQ
00632 ELSE
00633 ROTOK = ( SMALL*AAQQ ).LE.AAPP
00634 END IF
00635 IF( AAPP.LT.( BIG / AAQQ ) ) THEN
00636 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
00637 + q ), 1 )*D( p )*D( q ) / AAQQ )
00638 + / AAPP
00639 ELSE
00640 CALL DCOPY( M, A( 1, p ), 1, WORK, 1 )
00641 CALL DLASCL( 'G', 0, 0, AAPP, D( p ),
00642 + M, 1, WORK, LDA, IERR )
00643 AAPQ = DDOT( M, WORK, 1, A( 1, q ),
00644 + 1 )*D( q ) / AAQQ
00645 END IF
00646 ELSE
00647 IF( AAPP.GE.AAQQ ) THEN
00648 ROTOK = AAPP.LE.( AAQQ / SMALL )
00649 ELSE
00650 ROTOK = AAQQ.LE.( AAPP / SMALL )
00651 END IF
00652 IF( AAPP.GT.( SMALL / AAQQ ) ) THEN
00653 AAPQ = ( DDOT( M, A( 1, p ), 1, A( 1,
00654 + q ), 1 )*D( p )*D( q ) / AAQQ )
00655 + / AAPP
00656 ELSE
00657 CALL DCOPY( M, A( 1, q ), 1, WORK, 1 )
00658 CALL DLASCL( 'G', 0, 0, AAQQ, D( q ),
00659 + M, 1, WORK, LDA, IERR )
00660 AAPQ = DDOT( M, WORK, 1, A( 1, p ),
00661 + 1 )*D( p ) / AAPP
00662 END IF
00663 END IF
00664
00665 MXAAPQ = DMAX1( MXAAPQ, DABS( AAPQ ) )
00666
00667
00668
00669 IF( DABS( AAPQ ).GT.TOL ) THEN
00670 NOTROT = 0
00671
00672 PSKIPPED = 0
00673 ISWROT = ISWROT + 1
00674
00675 IF( ROTOK ) THEN
00676
00677 AQOAP = AAQQ / AAPP
00678 APOAQ = AAPP / AAQQ
00679 THETA = -HALF*DABS( AQOAP-APOAQ ) /
00680 + AAPQ
00681 IF( AAQQ.GT.AAPP0 )THETA = -THETA
00682
00683 IF( DABS( THETA ).GT.BIGTHETA ) THEN
00684 T = HALF / THETA
00685 FASTR( 3 ) = T*D( p ) / D( q )
00686 FASTR( 4 ) = -T*D( q ) / D( p )
00687 CALL DROTM( M, A( 1, p ), 1,
00688 + A( 1, q ), 1, FASTR )
00689 IF( RSVEC )CALL DROTM( MVL,
00690 + V( 1, p ), 1,
00691 + V( 1, q ), 1,
00692 + FASTR )
00693 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00694 + ONE+T*APOAQ*AAPQ ) )
00695 AAPP = AAPP*DSQRT( DMAX1( ZERO,
00696 + ONE-T*AQOAP*AAPQ ) )
00697 MXSINJ = DMAX1( MXSINJ, DABS( T ) )
00698 ELSE
00699
00700
00701
00702 THSIGN = -DSIGN( ONE, AAPQ )
00703 IF( AAQQ.GT.AAPP0 )THSIGN = -THSIGN
00704 T = ONE / ( THETA+THSIGN*
00705 + DSQRT( ONE+THETA*THETA ) )
00706 CS = DSQRT( ONE / ( ONE+T*T ) )
00707 SN = T*CS
00708 MXSINJ = DMAX1( MXSINJ, DABS( SN ) )
00709 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00710 + ONE+T*APOAQ*AAPQ ) )
00711 AAPP = AAPP*DSQRT( DMAX1( ZERO,
00712 + ONE-T*AQOAP*AAPQ ) )
00713
00714 APOAQ = D( p ) / D( q )
00715 AQOAP = D( q ) / D( p )
00716 IF( D( p ).GE.ONE ) THEN
00717
00718 IF( D( q ).GE.ONE ) THEN
00719 FASTR( 3 ) = T*APOAQ
00720 FASTR( 4 ) = -T*AQOAP
00721 D( p ) = D( p )*CS
00722 D( q ) = D( q )*CS
00723 CALL DROTM( M, A( 1, p ), 1,
00724 + A( 1, q ), 1,
00725 + FASTR )
00726 IF( RSVEC )CALL DROTM( MVL,
00727 + V( 1, p ), 1, V( 1, q ),
00728 + 1, FASTR )
00729 ELSE
00730 CALL DAXPY( M, -T*AQOAP,
00731 + A( 1, q ), 1,
00732 + A( 1, p ), 1 )
00733 CALL DAXPY( M, CS*SN*APOAQ,
00734 + A( 1, p ), 1,
00735 + A( 1, q ), 1 )
00736 IF( RSVEC ) THEN
00737 CALL DAXPY( MVL, -T*AQOAP,
00738 + V( 1, q ), 1,
00739 + V( 1, p ), 1 )
00740 CALL DAXPY( MVL,
00741 + CS*SN*APOAQ,
00742 + V( 1, p ), 1,
00743 + V( 1, q ), 1 )
00744 END IF
00745 D( p ) = D( p )*CS
00746 D( q ) = D( q ) / CS
00747 END IF
00748 ELSE
00749 IF( D( q ).GE.ONE ) THEN
00750 CALL DAXPY( M, T*APOAQ,
00751 + A( 1, p ), 1,
00752 + A( 1, q ), 1 )
00753 CALL DAXPY( M, -CS*SN*AQOAP,
00754 + A( 1, q ), 1,
00755 + A( 1, p ), 1 )
00756 IF( RSVEC ) THEN
00757 CALL DAXPY( MVL, T*APOAQ,
00758 + V( 1, p ), 1,
00759 + V( 1, q ), 1 )
00760 CALL DAXPY( MVL,
00761 + -CS*SN*AQOAP,
00762 + V( 1, q ), 1,
00763 + V( 1, p ), 1 )
00764 END IF
00765 D( p ) = D( p ) / CS
00766 D( q ) = D( q )*CS
00767 ELSE
00768 IF( D( p ).GE.D( q ) ) THEN
00769 CALL DAXPY( M, -T*AQOAP,
00770 + A( 1, q ), 1,
00771 + A( 1, p ), 1 )
00772 CALL DAXPY( M, CS*SN*APOAQ,
00773 + A( 1, p ), 1,
00774 + A( 1, q ), 1 )
00775 D( p ) = D( p )*CS
00776 D( q ) = D( q ) / CS
00777 IF( RSVEC ) THEN
00778 CALL DAXPY( MVL,
00779 + -T*AQOAP,
00780 + V( 1, q ), 1,
00781 + V( 1, p ), 1 )
00782 CALL DAXPY( MVL,
00783 + CS*SN*APOAQ,
00784 + V( 1, p ), 1,
00785 + V( 1, q ), 1 )
00786 END IF
00787 ELSE
00788 CALL DAXPY( M, T*APOAQ,
00789 + A( 1, p ), 1,
00790 + A( 1, q ), 1 )
00791 CALL DAXPY( M,
00792 + -CS*SN*AQOAP,
00793 + A( 1, q ), 1,
00794 + A( 1, p ), 1 )
00795 D( p ) = D( p ) / CS
00796 D( q ) = D( q )*CS
00797 IF( RSVEC ) THEN
00798 CALL DAXPY( MVL,
00799 + T*APOAQ, V( 1, p ),
00800 + 1, V( 1, q ), 1 )
00801 CALL DAXPY( MVL,
00802 + -CS*SN*AQOAP,
00803 + V( 1, q ), 1,
00804 + V( 1, p ), 1 )
00805 END IF
00806 END IF
00807 END IF
00808 END IF
00809 END IF
00810
00811 ELSE
00812 IF( AAPP.GT.AAQQ ) THEN
00813 CALL DCOPY( M, A( 1, p ), 1, WORK,
00814 + 1 )
00815 CALL DLASCL( 'G', 0, 0, AAPP, ONE,
00816 + M, 1, WORK, LDA, IERR )
00817 CALL DLASCL( 'G', 0, 0, AAQQ, ONE,
00818 + M, 1, A( 1, q ), LDA,
00819 + IERR )
00820 TEMP1 = -AAPQ*D( p ) / D( q )
00821 CALL DAXPY( M, TEMP1, WORK, 1,
00822 + A( 1, q ), 1 )
00823 CALL DLASCL( 'G', 0, 0, ONE, AAQQ,
00824 + M, 1, A( 1, q ), LDA,
00825 + IERR )
00826 SVA( q ) = AAQQ*DSQRT( DMAX1( ZERO,
00827 + ONE-AAPQ*AAPQ ) )
00828 MXSINJ = DMAX1( MXSINJ, SFMIN )
00829 ELSE
00830 CALL DCOPY( M, A( 1, q ), 1, WORK,
00831 + 1 )
00832 CALL DLASCL( 'G', 0, 0, AAQQ, ONE,
00833 + M, 1, WORK, LDA, IERR )
00834 CALL DLASCL( 'G', 0, 0, AAPP, ONE,
00835 + M, 1, A( 1, p ), LDA,
00836 + IERR )
00837 TEMP1 = -AAPQ*D( q ) / D( p )
00838 CALL DAXPY( M, TEMP1, WORK, 1,
00839 + A( 1, p ), 1 )
00840 CALL DLASCL( 'G', 0, 0, ONE, AAPP,
00841 + M, 1, A( 1, p ), LDA,
00842 + IERR )
00843 SVA( p ) = AAPP*DSQRT( DMAX1( ZERO,
00844 + ONE-AAPQ*AAPQ ) )
00845 MXSINJ = DMAX1( MXSINJ, SFMIN )
00846 END IF
00847 END IF
00848
00849
00850
00851
00852 IF( ( SVA( q ) / AAQQ )**2.LE.ROOTEPS )
00853 + THEN
00854 IF( ( AAQQ.LT.ROOTBIG ) .AND.
00855 + ( AAQQ.GT.ROOTSFMIN ) ) THEN
00856 SVA( q ) = DNRM2( M, A( 1, q ), 1 )*
00857 + D( q )
00858 ELSE
00859 T = ZERO
00860 AAQQ = ONE
00861 CALL DLASSQ( M, A( 1, q ), 1, T,
00862 + AAQQ )
00863 SVA( q ) = T*DSQRT( AAQQ )*D( q )
00864 END IF
00865 END IF
00866 IF( ( AAPP / AAPP0 )**2.LE.ROOTEPS ) THEN
00867 IF( ( AAPP.LT.ROOTBIG ) .AND.
00868 + ( AAPP.GT.ROOTSFMIN ) ) THEN
00869 AAPP = DNRM2( M, A( 1, p ), 1 )*
00870 + D( p )
00871 ELSE
00872 T = ZERO
00873 AAPP = ONE
00874 CALL DLASSQ( M, A( 1, p ), 1, T,
00875 + AAPP )
00876 AAPP = T*DSQRT( AAPP )*D( p )
00877 END IF
00878 SVA( p ) = AAPP
00879 END IF
00880
00881 ELSE
00882 NOTROT = NOTROT + 1
00883 PSKIPPED = PSKIPPED + 1
00884 IJBLSK = IJBLSK + 1
00885 END IF
00886 ELSE
00887 NOTROT = NOTROT + 1
00888 PSKIPPED = PSKIPPED + 1
00889 IJBLSK = IJBLSK + 1
00890 END IF
00891
00892 IF( ( i.LE.SWBAND ) .AND. ( IJBLSK.GE.BLSKIP ) )
00893 + THEN
00894 SVA( p ) = AAPP
00895 NOTROT = 0
00896 GO TO 2011
00897 END IF
00898 IF( ( i.LE.SWBAND ) .AND.
00899 + ( PSKIPPED.GT.ROWSKIP ) ) THEN
00900 AAPP = -AAPP
00901 NOTROT = 0
00902 GO TO 2203
00903 END IF
00904
00905 2200 CONTINUE
00906
00907 2203 CONTINUE
00908
00909 SVA( p ) = AAPP
00910
00911 ELSE
00912 IF( AAPP.EQ.ZERO )NOTROT = NOTROT +
00913 + MIN0( jgl+KBL-1, N ) - jgl + 1
00914 IF( AAPP.LT.ZERO )NOTROT = 0
00915 END IF
00916
00917 2100 CONTINUE
00918
00919 2010 CONTINUE
00920
00921 2011 CONTINUE
00922
00923 DO 2012 p = igl, MIN0( igl+KBL-1, N )
00924 SVA( p ) = DABS( SVA( p ) )
00925 2012 CONTINUE
00926
00927 2000 CONTINUE
00928
00929
00930
00931 IF( ( SVA( N ).LT.ROOTBIG ) .AND. ( SVA( N ).GT.ROOTSFMIN ) )
00932 + THEN
00933 SVA( N ) = DNRM2( M, A( 1, N ), 1 )*D( N )
00934 ELSE
00935 T = ZERO
00936 AAPP = ONE
00937 CALL DLASSQ( M, A( 1, N ), 1, T, AAPP )
00938 SVA( N ) = T*DSQRT( AAPP )*D( N )
00939 END IF
00940
00941
00942
00943 IF( ( i.LT.SWBAND ) .AND. ( ( MXAAPQ.LE.ROOTTOL ) .OR.
00944 + ( ISWROT.LE.N ) ) )SWBAND = i
00945
00946 IF( ( i.GT.SWBAND+1 ) .AND. ( MXAAPQ.LT.DBLE( N )*TOL ) .AND.
00947 + ( DBLE( N )*MXAAPQ*MXSINJ.LT.TOL ) ) THEN
00948 GO TO 1994
00949 END IF
00950
00951 IF( NOTROT.GE.EMPTSW )GO TO 1994
00952
00953 1993 CONTINUE
00954
00955
00956
00957 INFO = NSWEEP - 1
00958 GO TO 1995
00959 1994 CONTINUE
00960
00961
00962
00963 INFO = 0
00964
00965 1995 CONTINUE
00966
00967
00968 DO 5991 p = 1, N - 1
00969 q = IDAMAX( N-p+1, SVA( p ), 1 ) + p - 1
00970 IF( p.NE.q ) THEN
00971 TEMP1 = SVA( p )
00972 SVA( p ) = SVA( q )
00973 SVA( q ) = TEMP1
00974 TEMP1 = D( p )
00975 D( p ) = D( q )
00976 D( q ) = TEMP1
00977 CALL DSWAP( M, A( 1, p ), 1, A( 1, q ), 1 )
00978 IF( RSVEC )CALL DSWAP( MVL, V( 1, p ), 1, V( 1, q ), 1 )
00979 END IF
00980 5991 CONTINUE
00981
00982 RETURN
00983
00984
00985
00986 END