338 SUBROUTINE dgesvj( JOBA, JOBU, JOBV, M, N, A, LDA, SVA, MV, V,
339 $ LDV, WORK, LWORK, INFO )
346 INTEGER INFO, LDA, LDV, LWORK, M, MV, N
347 CHARACTER*1 JOBA, JOBU, JOBV
350 DOUBLE PRECISION A( LDA, * ), SVA( N ), V( LDV, * ),
357 DOUBLE PRECISION ZERO, HALF, ONE
358 parameter( zero = 0.0d0, half = 0.5d0, one = 1.0d0)
360 parameter( nsweep = 30 )
363 DOUBLE PRECISION AAPP, AAPP0, AAPQ, AAQQ, APOAQ, AQOAP, BIG,
364 $ bigtheta, cs, ctol, epsln, large, mxaapq,
365 $ mxsinj, rootbig, rooteps, rootsfmin, roottol,
366 $ skl, sfmin, small, sn, t, temp1, theta,
368 INTEGER BLSKIP, EMPTSW, i, ibr, IERR, igl, IJBLSK, ir1,
369 $ iswrot, jbc, jgl, kbl, lkahead, mvl, n2, n34,
370 $ n4, nbl, notrot, p, pskipped, q, rowskip,
371 $ swband, minmn, lwmin
372 LOGICAL APPLV, GOSCALE, LOWER, LQUERY, LSVEC, NOSCALE,
373 $ rotok, rsvec, uctol, upper
376 DOUBLE PRECISION FASTR( 5 )
379 INTRINSIC dabs, max, min, dble, dsign, dsqrt
384 DOUBLE PRECISION DDOT, DNRM2
389 DOUBLE PRECISION DLAMCH
407 lsvec = lsame( jobu,
'U' )
408 uctol = lsame( jobu,
'C' )
409 rsvec = lsame( jobv,
'V' )
410 applv = lsame( jobv,
'A' )
411 upper = lsame( joba,
'U' )
412 lower = lsame( joba,
'L' )
415 IF( minmn.EQ.0 )
THEN
418 lwmin = max( 6, m+n )
421 lquery = ( lwork.EQ.-1 )
422 IF( .NOT.( upper .OR. lower .OR. lsame( joba,
'G' ) ) )
THEN
424 ELSE IF( .NOT.( lsvec .OR.
426 $ lsame( jobu,
'N' ) ) )
THEN
428 ELSE IF( .NOT.( rsvec .OR.
430 $ lsame( jobv,
'N' ) ) )
THEN
432 ELSE IF( m.LT.0 )
THEN
434 ELSE IF( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
436 ELSE IF( lda.LT.m )
THEN
438 ELSE IF( mv.LT.0 )
THEN
440 ELSE IF( ( rsvec .AND. ( ldv.LT.n ) ) .OR.
441 $ ( applv .AND. ( ldv.LT.mv ) ) )
THEN
443 ELSE IF( uctol .AND. ( work( 1 ).LE.one ) )
THEN
445 ELSE IF( lwork.LT.lwmin .AND. ( .NOT.lquery ) )
THEN
453 CALL xerbla(
'DGESVJ', -info )
455 ELSE IF( lquery )
THEN
462 IF( minmn.EQ.0 )
RETURN
476 IF( lsvec .OR. rsvec .OR. applv )
THEN
477 ctol = dsqrt( dble( m ) )
485 epsln = dlamch(
'Epsilon' )
486 rooteps = dsqrt( epsln )
487 sfmin = dlamch(
'SafeMinimum' )
488 rootsfmin = dsqrt( sfmin )
489 small = sfmin / epsln
490 big = dlamch(
'Overflow' )
492 rootbig = one / rootsfmin
493 large = big / dsqrt( dble( m*n ) )
494 bigtheta = one / rooteps
497 roottol = dsqrt( tol )
499 IF( dble( m )*epsln.GE.one )
THEN
501 CALL xerbla(
'DGESVJ', -info )
509 CALL dlaset(
'A', mvl, n, zero, one, v, ldv )
510 ELSE IF( applv )
THEN
513 rsvec = rsvec .OR. applv
524 skl= one / dsqrt( dble( m )*dble( n ) )
533 CALL dlassq( m-p+1, a( p, p ), 1, aapp, aaqq )
534 IF( aapp.GT.big )
THEN
536 CALL xerbla(
'DGESVJ', -info )
540 IF( ( aapp.LT.( big / aaqq ) ) .AND. noscale )
THEN
544 sva( p ) = aapp*( aaqq*skl)
548 sva( q ) = sva( q )*skl
553 ELSE IF( upper )
THEN
558 CALL dlassq( p, a( 1, p ), 1, aapp, aaqq )
559 IF( aapp.GT.big )
THEN
561 CALL xerbla(
'DGESVJ', -info )
565 IF( ( aapp.LT.( big / aaqq ) ) .AND. noscale )
THEN
569 sva( p ) = aapp*( aaqq*skl)
573 sva( q ) = sva( q )*skl
583 CALL dlassq( m, a( 1, p ), 1, aapp, aaqq )
584 IF( aapp.GT.big )
THEN
586 CALL xerbla(
'DGESVJ', -info )
590 IF( ( aapp.LT.( big / aaqq ) ) .AND. noscale )
THEN
594 sva( p ) = aapp*( aaqq*skl)
598 sva( q ) = sva( q )*skl
605 IF( noscale )skl= one
614 IF( sva( p ).NE.zero )aaqq = min( aaqq, sva( p ) )
615 aapp = max( aapp, sva( p ) )
620 IF( aapp.EQ.zero )
THEN
621 IF( lsvec )
CALL dlaset(
'G', m, n, zero, one, a, lda )
634 IF( lsvec )
CALL dlascl(
'G', 0, 0, sva( 1 ), skl, m, 1,
635 $ a( 1, 1 ), lda, ierr )
636 work( 1 ) = one / skl
637 IF( sva( 1 ).GE.sfmin )
THEN
652 sn = dsqrt( sfmin / epsln )
653 temp1 = dsqrt( big / dble( n ) )
654 IF( ( aapp.LE.sn ) .OR. ( aaqq.GE.temp1 ) .OR.
655 $ ( ( sn.LE.aaqq ) .AND. ( aapp.LE.temp1 ) ) )
THEN
656 temp1 = min( big, temp1 / aapp )
659 ELSE IF( ( aaqq.LE.sn ) .AND. ( aapp.LE.temp1 ) )
THEN
660 temp1 = min( sn / aaqq, big / ( aapp*dsqrt( dble( n ) ) ) )
663 ELSE IF( ( aaqq.GE.sn ) .AND. ( aapp.GE.temp1 ) )
THEN
664 temp1 = max( sn / aaqq, temp1 / aapp )
667 ELSE IF( ( aaqq.LE.sn ) .AND. ( aapp.GE.temp1 ) )
THEN
668 temp1 = min( sn / aaqq, big / ( dsqrt( dble( n ) )*aapp ) )
677 IF( temp1.NE.one )
THEN
678 CALL dlascl(
'G', 0, 0, one, temp1, n, 1, sva, n, ierr )
681 IF( skl.NE.one )
THEN
682 CALL dlascl( joba, 0, 0, one, skl, m, n, a, lda, ierr )
688 emptsw = ( n*( n-1 ) ) / 2
716 IF( ( nbl*kbl ).NE.n )nbl = nbl + 1
721 rowskip = min( 5, kbl )
732 IF( ( lower .OR. upper ) .AND. ( n.GT.max( 64, 4*kbl ) ) )
THEN
754 CALL dgsvj0( jobv, m-n34, n-n34, a( n34+1, n34+1 ), lda,
755 $ work( n34+1 ), sva( n34+1 ), mvl,
756 $ v( n34*q+1, n34+1 ), ldv, epsln, sfmin, tol,
757 $ 2, work( n+1 ), lwork-n, ierr )
759 CALL dgsvj0( jobv, m-n2, n34-n2, a( n2+1, n2+1 ), lda,
760 $ work( n2+1 ), sva( n2+1 ), mvl,
761 $ v( n2*q+1, n2+1 ), ldv, epsln, sfmin, tol, 2,
762 $ work( n+1 ), lwork-n, ierr )
764 CALL dgsvj1( jobv, m-n2, n-n2, n4, a( n2+1, n2+1 ), lda,
765 $ work( n2+1 ), sva( n2+1 ), mvl,
766 $ v( n2*q+1, n2+1 ), ldv, epsln, sfmin, tol, 1,
767 $ work( n+1 ), lwork-n, ierr )
769 CALL dgsvj0( jobv, m-n4, n2-n4, a( n4+1, n4+1 ), lda,
770 $ work( n4+1 ), sva( n4+1 ), mvl,
771 $ v( n4*q+1, n4+1 ), ldv, epsln, sfmin, tol, 1,
772 $ work( n+1 ), lwork-n, ierr )
774 CALL dgsvj0( jobv, m, n4, a, lda, work, sva, mvl, v, ldv,
775 $ epsln, sfmin, tol, 1, work( n+1 ), lwork-n,
778 CALL dgsvj1( jobv, m, n2, n4, a, lda, work, sva, mvl, v,
779 $ ldv, epsln, sfmin, tol, 1, work( n+1 ),
783 ELSE IF( upper )
THEN
786 CALL dgsvj0( jobv, n4, n4, a, lda, work, sva, mvl, v,
788 $ epsln, sfmin, tol, 2, work( n+1 ), lwork-n,
791 CALL dgsvj0( jobv, n2, n4, a( 1, n4+1 ), lda,
793 $ sva( n4+1 ), mvl, v( n4*q+1, n4+1 ), ldv,
794 $ epsln, sfmin, tol, 1, work( n+1 ), lwork-n,
797 CALL dgsvj1( jobv, n2, n2, n4, a, lda, work, sva, mvl, v,
798 $ ldv, epsln, sfmin, tol, 1, work( n+1 ),
801 CALL dgsvj0( jobv, n2+n4, n4, a( 1, n2+1 ), lda,
802 $ work( n2+1 ), sva( n2+1 ), mvl,
803 $ v( n2*q+1, n2+1 ), ldv, epsln, sfmin, tol, 1,
804 $ work( n+1 ), lwork-n, ierr )
812 DO 1993 i = 1, nsweep
830 igl = ( ibr-1 )*kbl + 1
832 DO 1002 ir1 = 0, min( lkahead, nbl-ibr )
836 DO 2001 p = igl, min( igl+kbl-1, n-1 )
840 q = idamax( n-p+1, sva( p ), 1 ) + p - 1
842 CALL dswap( m, a( 1, p ), 1, a( 1, q ), 1 )
843 IF( rsvec )
CALL dswap( mvl, v( 1, p ), 1,
849 work( p ) = work( q )
867 IF( ( sva( p ).LT.rootbig ) .AND.
868 $ ( sva( p ).GT.rootsfmin ) )
THEN
869 sva( p ) = dnrm2( m, a( 1, p ), 1 )*work( p )
873 CALL dlassq( m, a( 1, p ), 1, temp1, aapp )
874 sva( p ) = temp1*dsqrt( aapp )*work( p )
881 IF( aapp.GT.zero )
THEN
885 DO 2002 q = p + 1, min( igl+kbl-1, n )
889 IF( aaqq.GT.zero )
THEN
892 IF( aaqq.GE.one )
THEN
893 rotok = ( small*aapp ).LE.aaqq
894 IF( aapp.LT.( big / aaqq ) )
THEN
895 aapq = ( ddot( m, a( 1, p ), 1,
897 $ q ), 1 )*work( p )*work( q ) /
900 CALL dcopy( m, a( 1, p ), 1,
902 CALL dlascl(
'G', 0, 0, aapp,
904 $ work( n+1 ), lda, ierr )
905 aapq = ddot( m, work( n+1 ), 1,
906 $ a( 1, q ), 1 )*work( q ) / aaqq
909 rotok = aapp.LE.( aaqq / small )
910 IF( aapp.GT.( small / aaqq ) )
THEN
911 aapq = ( ddot( m, a( 1, p ), 1,
913 $ q ), 1 )*work( p )*work( q ) /
916 CALL dcopy( m, a( 1, q ), 1,
918 CALL dlascl(
'G', 0, 0, aaqq,
920 $ work( n+1 ), lda, ierr )
921 aapq = ddot( m, work( n+1 ), 1,
922 $ a( 1, p ), 1 )*work( p ) / aapp
926 mxaapq = max( mxaapq, dabs( aapq ) )
930 IF( dabs( aapq ).GT.tol )
THEN
945 theta = -half*dabs(aqoap-apoaq)/aapq
947 IF( dabs( theta ).GT.bigtheta )
THEN
950 fastr( 3 ) = t*work( p ) / work( q )
951 fastr( 4 ) = -t*work( q ) /
953 CALL drotm( m, a( 1, p ), 1,
954 $ a( 1, q ), 1, fastr )
955 IF( rsvec )
CALL drotm( mvl,
959 sva( q ) = aaqq*dsqrt( max( zero,
960 $ one+t*apoaq*aapq ) )
961 aapp = aapp*dsqrt( max( zero,
962 $ one-t*aqoap*aapq ) )
963 mxsinj = max( mxsinj, dabs( t ) )
969 thsign = -dsign( one, aapq )
970 t = one / ( theta+thsign*
971 $ dsqrt( one+theta*theta ) )
972 cs = dsqrt( one / ( one+t*t ) )
975 mxsinj = max( mxsinj, dabs( sn ) )
976 sva( q ) = aaqq*dsqrt( max( zero,
977 $ one+t*apoaq*aapq ) )
978 aapp = aapp*dsqrt( max( zero,
979 $ one-t*aqoap*aapq ) )
981 apoaq = work( p ) / work( q )
982 aqoap = work( q ) / work( p )
983 IF( work( p ).GE.one )
THEN
984 IF( work( q ).GE.one )
THEN
986 fastr( 4 ) = -t*aqoap
987 work( p ) = work( p )*cs
988 work( q ) = work( q )*cs
989 CALL drotm( m, a( 1, p ),
993 IF( rsvec )
CALL drotm( mvl,
994 $ v( 1, p ), 1, v( 1, q ),
997 CALL daxpy( m, -t*aqoap,
1000 CALL daxpy( m, cs*sn*apoaq,
1003 work( p ) = work( p )*cs
1004 work( q ) = work( q ) / cs
1017 IF( work( q ).GE.one )
THEN
1018 CALL daxpy( m, t*apoaq,
1025 work( p ) = work( p ) / cs
1026 work( q ) = work( q )*cs
1038 IF( work( p ).GE.work( q ) )
1040 CALL daxpy( m, -t*aqoap,
1047 work( p ) = work( p )*cs
1048 work( q ) = work( q ) / cs
1060 CALL daxpy( m, t*apoaq,
1067 work( p ) = work( p ) / cs
1068 work( q ) = work( q )*cs
1071 $ t*apoaq, v( 1, p ),
1085 CALL dcopy( m, a( 1, p ), 1,
1087 CALL dlascl(
'G', 0, 0, aapp, one,
1089 $ 1, work( n+1 ), lda,
1091 CALL dlascl(
'G', 0, 0, aaqq, one,
1093 $ 1, a( 1, q ), lda, ierr )
1094 temp1 = -aapq*work( p ) / work( q )
1095 CALL daxpy( m, temp1, work( n+1 ),
1098 CALL dlascl(
'G', 0, 0, one, aaqq,
1100 $ 1, a( 1, q ), lda, ierr )
1101 sva( q ) = aaqq*dsqrt( max( zero,
1103 mxsinj = max( mxsinj, sfmin )
1110 IF( ( sva( q ) / aaqq )**2.LE.rooteps )
1112 IF( ( aaqq.LT.rootbig ) .AND.
1113 $ ( aaqq.GT.rootsfmin ) )
THEN
1114 sva( q ) = dnrm2( m, a( 1, q ),
1120 CALL dlassq( m, a( 1, q ), 1, t,
1122 sva( q ) = t*dsqrt( aaqq )*work( q )
1125 IF( ( aapp / aapp0 ).LE.rooteps )
THEN
1126 IF( ( aapp.LT.rootbig ) .AND.
1127 $ ( aapp.GT.rootsfmin ) )
THEN
1128 aapp = dnrm2( m, a( 1, p ), 1 )*
1133 CALL dlassq( m, a( 1, p ), 1, t,
1135 aapp = t*dsqrt( aapp )*work( p )
1142 IF( ir1.EQ.0 )notrot = notrot + 1
1144 pskipped = pskipped + 1
1148 IF( ir1.EQ.0 )notrot = notrot + 1
1149 pskipped = pskipped + 1
1152 IF( ( i.LE.swband ) .AND.
1153 $ ( pskipped.GT.rowskip ) )
THEN
1154 IF( ir1.EQ.0 )aapp = -aapp
1169 IF( ( ir1.EQ.0 ) .AND. ( aapp.EQ.zero ) )
1170 $ notrot = notrot + min( igl+kbl-1, n ) - p
1181 igl = ( ibr-1 )*kbl + 1
1183 DO 2010 jbc = ibr + 1, nbl
1185 jgl = ( jbc-1 )*kbl + 1
1190 DO 2100 p = igl, min( igl+kbl-1, n )
1193 IF( aapp.GT.zero )
THEN
1197 DO 2200 q = jgl, min( jgl+kbl-1, n )
1200 IF( aaqq.GT.zero )
THEN
1207 IF( aaqq.GE.one )
THEN
1208 IF( aapp.GE.aaqq )
THEN
1209 rotok = ( small*aapp ).LE.aaqq
1211 rotok = ( small*aaqq ).LE.aapp
1213 IF( aapp.LT.( big / aaqq ) )
THEN
1214 aapq = ( ddot( m, a( 1, p ), 1,
1216 $ q ), 1 )*work( p )*work( q ) /
1219 CALL dcopy( m, a( 1, p ), 1,
1221 CALL dlascl(
'G', 0, 0, aapp,
1223 $ work( n+1 ), lda, ierr )
1224 aapq = ddot( m, work( n+1 ), 1,
1225 $ a( 1, q ), 1 )*work( q ) / aaqq
1228 IF( aapp.GE.aaqq )
THEN
1229 rotok = aapp.LE.( aaqq / small )
1231 rotok = aaqq.LE.( aapp / small )
1233 IF( aapp.GT.( small / aaqq ) )
THEN
1234 aapq = ( ddot( m, a( 1, p ), 1,
1236 $ q ), 1 )*work( p )*work( q ) /
1239 CALL dcopy( m, a( 1, q ), 1,
1241 CALL dlascl(
'G', 0, 0, aaqq,
1243 $ work( n+1 ), lda, ierr )
1244 aapq = ddot( m, work( n+1 ), 1,
1245 $ a( 1, p ), 1 )*work( p ) / aapp
1249 mxaapq = max( mxaapq, dabs( aapq ) )
1253 IF( dabs( aapq ).GT.tol )
THEN
1263 theta = -half*dabs(aqoap-apoaq)/aapq
1264 IF( aaqq.GT.aapp0 )theta = -theta
1266 IF( dabs( theta ).GT.bigtheta )
THEN
1268 fastr( 3 ) = t*work( p ) / work( q )
1269 fastr( 4 ) = -t*work( q ) /
1271 CALL drotm( m, a( 1, p ), 1,
1272 $ a( 1, q ), 1, fastr )
1273 IF( rsvec )
CALL drotm( mvl,
1277 sva( q ) = aaqq*dsqrt( max( zero,
1278 $ one+t*apoaq*aapq ) )
1279 aapp = aapp*dsqrt( max( zero,
1280 $ one-t*aqoap*aapq ) )
1281 mxsinj = max( mxsinj, dabs( t ) )
1286 thsign = -dsign( one, aapq )
1287 IF( aaqq.GT.aapp0 )thsign = -thsign
1288 t = one / ( theta+thsign*
1289 $ dsqrt( one+theta*theta ) )
1290 cs = dsqrt( one / ( one+t*t ) )
1292 mxsinj = max( mxsinj, dabs( sn ) )
1293 sva( q ) = aaqq*dsqrt( max( zero,
1294 $ one+t*apoaq*aapq ) )
1295 aapp = aapp*dsqrt( max( zero,
1296 $ one-t*aqoap*aapq ) )
1298 apoaq = work( p ) / work( q )
1299 aqoap = work( q ) / work( p )
1300 IF( work( p ).GE.one )
THEN
1302 IF( work( q ).GE.one )
THEN
1303 fastr( 3 ) = t*apoaq
1304 fastr( 4 ) = -t*aqoap
1305 work( p ) = work( p )*cs
1306 work( q ) = work( q )*cs
1307 CALL drotm( m, a( 1, p ),
1311 IF( rsvec )
CALL drotm( mvl,
1312 $ v( 1, p ), 1, v( 1, q ),
1315 CALL daxpy( m, -t*aqoap,
1318 CALL daxpy( m, cs*sn*apoaq,
1331 work( p ) = work( p )*cs
1332 work( q ) = work( q ) / cs
1335 IF( work( q ).GE.one )
THEN
1336 CALL daxpy( m, t*apoaq,
1353 work( p ) = work( p ) / cs
1354 work( q ) = work( q )*cs
1356 IF( work( p ).GE.work( q ) )
1358 CALL daxpy( m, -t*aqoap,
1365 work( p ) = work( p )*cs
1366 work( q ) = work( q ) / cs
1378 CALL daxpy( m, t*apoaq,
1385 work( p ) = work( p ) / cs
1386 work( q ) = work( q )*cs
1389 $ t*apoaq, v( 1, p ),
1402 IF( aapp.GT.aaqq )
THEN
1403 CALL dcopy( m, a( 1, p ), 1,
1405 CALL dlascl(
'G', 0, 0, aapp,
1407 $ m, 1, work( n+1 ), lda,
1409 CALL dlascl(
'G', 0, 0, aaqq,
1411 $ m, 1, a( 1, q ), lda,
1413 temp1 = -aapq*work( p ) / work( q )
1414 CALL daxpy( m, temp1,
1417 CALL dlascl(
'G', 0, 0, one,
1419 $ m, 1, a( 1, q ), lda,
1421 sva( q ) = aaqq*dsqrt( max( zero,
1423 mxsinj = max( mxsinj, sfmin )
1425 CALL dcopy( m, a( 1, q ), 1,
1427 CALL dlascl(
'G', 0, 0, aaqq,
1429 $ m, 1, work( n+1 ), lda,
1431 CALL dlascl(
'G', 0, 0, aapp,
1433 $ m, 1, a( 1, p ), lda,
1435 temp1 = -aapq*work( q ) / work( p )
1436 CALL daxpy( m, temp1,
1439 CALL dlascl(
'G', 0, 0, one,
1441 $ m, 1, a( 1, p ), lda,
1443 sva( p ) = aapp*dsqrt( max( zero,
1445 mxsinj = max( mxsinj, sfmin )
1452 IF( ( sva( q ) / aaqq )**2.LE.rooteps )
1454 IF( ( aaqq.LT.rootbig ) .AND.
1455 $ ( aaqq.GT.rootsfmin ) )
THEN
1456 sva( q ) = dnrm2( m, a( 1, q ),
1462 CALL dlassq( m, a( 1, q ), 1, t,
1464 sva( q ) = t*dsqrt( aaqq )*work( q )
1467 IF( ( aapp / aapp0 )**2.LE.rooteps )
THEN
1468 IF( ( aapp.LT.rootbig ) .AND.
1469 $ ( aapp.GT.rootsfmin ) )
THEN
1470 aapp = dnrm2( m, a( 1, p ), 1 )*
1475 CALL dlassq( m, a( 1, p ), 1, t,
1477 aapp = t*dsqrt( aapp )*work( p )
1485 pskipped = pskipped + 1
1490 pskipped = pskipped + 1
1494 IF( ( i.LE.swband ) .AND. ( ijblsk.GE.blskip ) )
1500 IF( ( i.LE.swband ) .AND.
1501 $ ( pskipped.GT.rowskip ) )
THEN
1515 IF( aapp.EQ.zero )notrot = notrot +
1516 $ min( jgl+kbl-1, n ) - jgl + 1
1517 IF( aapp.LT.zero )notrot = 0
1527 DO 2012 p = igl, min( igl+kbl-1, n )
1528 sva( p ) = dabs( sva( p ) )
1535 IF( ( sva( n ).LT.rootbig ) .AND. ( sva( n ).GT.rootsfmin ) )
1537 sva( n ) = dnrm2( m, a( 1, n ), 1 )*work( n )
1541 CALL dlassq( m, a( 1, n ), 1, t, aapp )
1542 sva( n ) = t*dsqrt( aapp )*work( n )
1547 IF( ( i.LT.swband ) .AND. ( ( mxaapq.LE.roottol ) .OR.
1548 $ ( iswrot.LE.n ) ) )swband = i
1550 IF( ( i.GT.swband+1 ) .AND. ( mxaapq.LT.dsqrt( dble( n ) )*
1551 $ tol ) .AND. ( dble( n )*mxaapq*mxsinj.LT.tol ) )
THEN
1555 IF( notrot.GE.emptsw )
GO TO 1994
1577 DO 5991 p = 1, n - 1
1578 q = idamax( n-p+1, sva( p ), 1 ) + p - 1
1584 work( p ) = work( q )
1586 CALL dswap( m, a( 1, p ), 1, a( 1, q ), 1 )
1587 IF( rsvec )
CALL dswap( mvl, v( 1, p ), 1, v( 1, q ), 1 )
1589 IF( sva( p ).NE.zero )
THEN
1591 IF( sva( p )*skl.GT.sfmin )n2 = n2 + 1
1594 IF( sva( n ).NE.zero )
THEN
1596 IF( sva( n )*skl.GT.sfmin )n2 = n2 + 1
1601 IF( lsvec .OR. uctol )
THEN
1603 CALL dscal( m, work( p ) / sva( p ), a( 1, p ), 1 )
1612 CALL dscal( mvl, work( p ), v( 1, p ), 1 )
1616 temp1 = one / dnrm2( mvl, v( 1, p ), 1 )
1617 CALL dscal( mvl, temp1, v( 1, p ), 1 )
1623 IF( ( ( skl.GT.one ) .AND. ( sva( 1 ).LT.( big / skl) ) )
1624 $ .OR. ( ( skl.LT.one ) .AND. ( sva( max( n2, 1 ) ) .GT.
1625 $ ( sfmin / skl) ) ) )
THEN
1627 sva( p ) = skl*sva( p )
1637 work( 2 ) = dble( n4 )
1640 work( 3 ) = dble( n2 )
1645 work( 4 ) = dble( i )