412 SUBROUTINE sgesvdq( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
413 $ S, U, LDU, V, LDV, NUMRANK, IWORK, LIWORK,
414 $ WORK, LWORK, RWORK, LRWORK, INFO )
417 CHARACTER JOBA, JOBP, JOBR, JOBU, JOBV
418 INTEGER M, N, LDA, LDU, LDV, NUMRANK, LIWORK, LWORK, LRWORK,
422 REAL A( LDA, * ), U( LDU, * ), V( LDV, * ), WORK( * )
423 REAL S( * ), RWORK( * )
430 PARAMETER ( ZERO = 0.0e0, one = 1.0e0 )
433 INTEGER IERR, IWOFF, NR, N1, OPTRATIO, p, q
434 INTEGER LWCON, LWQP3, LWRK_SGELQF, LWRK_SGESVD, LWRK_SGESVD2,
435 $ lwrk_sgeqp3, lwrk_sgeqrf, lwrk_sormlq, lwrk_sormqr,
436 $ lwrk_sormqr2, lwlqf, lwqrf, lwsvd, lwsvd2, lworq,
437 $ lworq2, lwunlq, minwrk, minwrk2, optwrk, optwrk2,
439 LOGICAL ACCLA, ACCLM, ACCLH, ASCALED, CONDA, DNTWU, DNTWV,
440 $ LQUERY, LSVC0, LSVEC, ROWPRM, RSVEC, RTRANS, WNTUA,
441 $ wntuf, wntur, wntus, wntva, wntvr
442 REAL BIG, EPSLN, RTMP, SCONDA, SFMIN
455 REAL SLANGE, SNRM2, SLAMCH
456 EXTERNAL slange, lsame, isamax, snrm2, slamch
459 INTRINSIC abs, max, min, real, sqrt
465 wntus = lsame( jobu,
'S' ) .OR. lsame( jobu,
'U' )
466 wntur = lsame( jobu,
'R' )
467 wntua = lsame( jobu,
'A' )
468 wntuf = lsame( jobu,
'F' )
469 lsvc0 = wntus .OR. wntur .OR. wntua
470 lsvec = lsvc0 .OR. wntuf
471 dntwu = lsame( jobu,
'N' )
473 wntvr = lsame( jobv,
'R' )
474 wntva = lsame( jobv,
'A' ) .OR. lsame( jobv,
'V' )
475 rsvec = wntvr .OR. wntva
476 dntwv = lsame( jobv,
'N' )
478 accla = lsame( joba,
'A' )
479 acclm = lsame( joba,
'M' )
480 conda = lsame( joba,
'E' )
481 acclh = lsame( joba,
'H' ) .OR. conda
483 rowprm = lsame( jobp,
'P' )
484 rtrans = lsame( jobr,
'T' )
488 iminwrk = max( 1, n + m - 1 + n )
490 iminwrk = max( 1, n + m - 1 )
492 rminwrk = max( 2, m )
495 iminwrk = max( 1, n + n )
497 iminwrk = max( 1, n )
501 lquery = (liwork .EQ. -1 .OR. lwork .EQ. -1 .OR. lrwork .EQ. -1)
503 IF ( .NOT. ( accla .OR. acclm .OR. acclh ) )
THEN
505 ELSE IF ( .NOT.( rowprm .OR. lsame( jobp,
'N' ) ) )
THEN
507 ELSE IF ( .NOT.( rtrans .OR. lsame( jobr,
'N' ) ) )
THEN
509 ELSE IF ( .NOT.( lsvec .OR. dntwu ) )
THEN
511 ELSE IF ( wntur .AND. wntva )
THEN
513 ELSE IF ( .NOT.( rsvec .OR. dntwv ))
THEN
515 ELSE IF ( m.LT.0 )
THEN
517 ELSE IF ( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
519 ELSE IF ( lda.LT.max( 1, m ) )
THEN
521 ELSE IF ( ldu.LT.1 .OR. ( lsvc0 .AND. ldu.LT.m ) .OR.
522 $ ( wntuf .AND. ldu.LT.n ) )
THEN
524 ELSE IF ( ldv.LT.1 .OR. ( rsvec .AND. ldv.LT.n ) .OR.
525 $ ( conda .AND. ldv.LT.n ) )
THEN
527 ELSE IF ( liwork .LT. iminwrk .AND. .NOT. lquery )
THEN
532 IF ( info .EQ. 0 )
THEN
542 IF ( wntus .OR. wntur )
THEN
544 ELSE IF ( wntua )
THEN
550 lwsvd = max( 5 * n, 1 )
552 CALL sgeqp3( m, n, a, lda, iwork, rdummy, rdummy, -1,
554 lwrk_sgeqp3 = int( rdummy(1) )
555 IF ( wntus .OR. wntur )
THEN
556 CALL sormqr(
'L',
'N', m, n, n, a, lda, rdummy, u,
557 $ ldu, rdummy, -1, ierr )
558 lwrk_sormqr = int( rdummy(1) )
559 ELSE IF ( wntua )
THEN
560 CALL sormqr(
'L',
'N', m, m, n, a, lda, rdummy, u,
561 $ ldu, rdummy, -1, ierr )
562 lwrk_sormqr = int( rdummy(1) )
569 IF ( .NOT. (lsvec .OR. rsvec ))
THEN
573 minwrk = max( n+lwqp3, lwcon, lwsvd )
575 minwrk = max( n+lwqp3, lwsvd )
578 CALL sgesvd(
'N',
'N', n, n, a, lda, s, u, ldu,
579 $ v, ldv, rdummy, -1, ierr )
580 lwrk_sgesvd = int( rdummy(1) )
582 optwrk = max( n+lwrk_sgeqp3, n+lwcon, lwrk_sgesvd )
584 optwrk = max( n+lwrk_sgeqp3, lwrk_sgesvd )
587 ELSE IF ( lsvec .AND. (.NOT.rsvec) )
THEN
591 minwrk = n + max( lwqp3, lwcon, lwsvd, lworq )
593 minwrk = n + max( lwqp3, lwsvd, lworq )
597 CALL sgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
598 $ v, ldv, rdummy, -1, ierr )
600 CALL sgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
601 $ v, ldv, rdummy, -1, ierr )
603 lwrk_sgesvd = int( rdummy(1) )
605 optwrk = n + max( lwrk_sgeqp3, lwcon, lwrk_sgesvd,
608 optwrk = n + max( lwrk_sgeqp3, lwrk_sgesvd,
612 ELSE IF ( rsvec .AND. (.NOT.lsvec) )
THEN
616 minwrk = n + max( lwqp3, lwcon, lwsvd )
618 minwrk = n + max( lwqp3, lwsvd )
622 CALL sgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
623 $ v, ldv, rdummy, -1, ierr )
625 CALL sgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
626 $ v, ldv, rdummy, -1, ierr )
628 lwrk_sgesvd = int( rdummy(1) )
630 optwrk = n + max( lwrk_sgeqp3, lwcon, lwrk_sgesvd )
632 optwrk = n + max( lwrk_sgeqp3, lwrk_sgesvd )
639 minwrk = max( lwqp3, lwsvd, lworq )
640 IF ( conda ) minwrk = max( minwrk, lwcon )
644 lwqrf = max( n/2, 1 )
646 lwsvd2 = max( 5 * (n/2), 1 )
648 minwrk2 = max( lwqp3, n/2+lwqrf, n/2+lwsvd2,
649 $ n/2+lworq2, lworq )
650 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
651 minwrk2 = n + minwrk2
652 minwrk = max( minwrk, minwrk2 )
655 minwrk = max( lwqp3, lwsvd, lworq )
656 IF ( conda ) minwrk = max( minwrk, lwcon )
660 lwlqf = max( n/2, 1 )
661 lwsvd2 = max( 5 * (n/2), 1 )
662 lwunlq = max( n , 1 )
663 minwrk2 = max( lwqp3, n/2+lwlqf, n/2+lwsvd2,
664 $ n/2+lwunlq, lworq )
665 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
666 minwrk2 = n + minwrk2
667 minwrk = max( minwrk, minwrk2 )
672 CALL sgesvd(
'O',
'A', n, n, a, lda, s, u, ldu,
673 $ v, ldv, rdummy, -1, ierr )
674 lwrk_sgesvd = int( rdummy(1) )
675 optwrk = max(lwrk_sgeqp3,lwrk_sgesvd,lwrk_sormqr)
676 IF ( conda ) optwrk = max( optwrk, lwcon )
679 CALL sgeqrf(n,n/2,u,ldu,rdummy,rdummy,-1,ierr)
680 lwrk_sgeqrf = int( rdummy(1) )
681 CALL sgesvd(
'S',
'O', n/2,n/2, v,ldv, s, u,ldu,
682 $ v, ldv, rdummy, -1, ierr )
683 lwrk_sgesvd2 = int( rdummy(1) )
684 CALL sormqr(
'R',
'C', n, n, n/2, u, ldu, rdummy,
685 $ v, ldv, rdummy, -1, ierr )
686 lwrk_sormqr2 = int( rdummy(1) )
687 optwrk2 = max( lwrk_sgeqp3, n/2+lwrk_sgeqrf,
688 $ n/2+lwrk_sgesvd2, n/2+lwrk_sormqr2 )
689 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
690 optwrk2 = n + optwrk2
691 optwrk = max( optwrk, optwrk2 )
694 CALL sgesvd(
'S',
'O', n, n, a, lda, s, u, ldu,
695 $ v, ldv, rdummy, -1, ierr )
696 lwrk_sgesvd = int( rdummy(1) )
697 optwrk = max(lwrk_sgeqp3,lwrk_sgesvd,lwrk_sormqr)
698 IF ( conda ) optwrk = max( optwrk, lwcon )
701 CALL sgelqf(n/2,n,u,ldu,rdummy,rdummy,-1,ierr)
702 lwrk_sgelqf = int( rdummy(1) )
703 CALL sgesvd(
'S',
'O', n/2,n/2, v, ldv, s, u, ldu,
704 $ v, ldv, rdummy, -1, ierr )
705 lwrk_sgesvd2 = int( rdummy(1) )
706 CALL sormlq(
'R',
'N', n, n, n/2, u, ldu, rdummy,
707 $ v, ldv, rdummy,-1,ierr )
708 lwrk_sormlq = int( rdummy(1) )
709 optwrk2 = max( lwrk_sgeqp3, n/2+lwrk_sgelqf,
710 $ n/2+lwrk_sgesvd2, n/2+lwrk_sormlq )
711 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
712 optwrk2 = n + optwrk2
713 optwrk = max( optwrk, optwrk2 )
719 minwrk = max( 2, minwrk )
720 optwrk = max( 2, optwrk )
721 IF ( lwork .LT. minwrk .AND. (.NOT.lquery) ) info = -19
725 IF (info .EQ. 0 .AND. lrwork .LT. rminwrk .AND. .NOT. lquery)
THEN
729 CALL xerbla(
'SGESVDQ', -info )
731 ELSE IF ( lquery )
THEN
744 IF( ( m.EQ.0 ) .OR. ( n.EQ.0 ) )
THEN
760 rwork(p) = slange(
'M', 1, n, a(p,1), lda, rdummy )
762 IF ( ( rwork(p) .NE. rwork(p) ) .OR.
763 $ ( (rwork(p)*zero) .NE. zero ) )
THEN
765 CALL xerbla(
'SGESVDQ', -info )
770 q = isamax( m-p+1, rwork(p), 1 ) + p - 1
779 IF ( rwork(1) .EQ. zero )
THEN
782 CALL slaset(
'G', n, 1, zero, zero, s, n )
783 IF ( wntus )
CALL slaset(
'G', m, n, zero, one, u, ldu)
784 IF ( wntua )
CALL slaset(
'G', m, m, zero, one, u, ldu)
785 IF ( wntva )
CALL slaset(
'G', n, n, zero, one, v, ldv)
787 CALL slaset(
'G', n, 1, zero, zero, work, n )
788 CALL slaset(
'G', m, n, zero, one, u, ldu )
794 DO 5002 p = n + 1, n + m - 1
798 IF ( conda ) rwork(1) = -1
803 IF ( rwork(1) .GT. big / sqrt(real(m)) )
THEN
806 CALL slascl(
'G',0,0,sqrt(real(m)),one, m,n, a,lda, ierr)
809 CALL slaswp( n, a, lda, 1, m-1, iwork(n+1), 1 )
817 IF ( .NOT.rowprm )
THEN
818 rtmp = slange(
'M', m, n, a, lda, rdummy )
819 IF ( ( rtmp .NE. rtmp ) .OR.
820 $ ( (rtmp*zero) .NE. zero ) )
THEN
822 CALL xerbla(
'SGESVDQ', -info )
825 IF ( rtmp .GT. big / sqrt(real(m)) )
THEN
828 CALL slascl(
'G',0,0, sqrt(real(m)),one, m,n, a,lda, ierr)
842 CALL sgeqp3( m, n, a, lda, iwork, work, work(n+1), lwork-n,
861 rtmp = sqrt(real(n))*epsln
863 IF ( abs(a(p,p)) .LT. (rtmp*abs(a(1,1))) )
GO TO 3002
868 ELSEIF ( acclm )
THEN
877 IF ( ( abs(a(p,p)) .LT. (epsln*abs(a(p-1,p-1))) ) .OR.
878 $ ( abs(a(p,p)) .LT. sfmin ) )
GO TO 3402
890 IF ( abs(a(p,p)) .EQ. zero )
GO TO 3502
899 CALL slacpy(
'U', n, n, a, lda, v, ldv )
906 rtmp = snrm2( p, v(1,p), 1 )
907 CALL sscal( p, one/rtmp, v(1,p), 1 )
909 IF ( .NOT. ( lsvec .OR. rsvec ) )
THEN
910 CALL spocon(
'U', nr, v, ldv, one, rtmp,
911 $ work, iwork(n+iwoff), ierr )
913 CALL spocon(
'U', nr, v, ldv, one, rtmp,
914 $ work(n+1), iwork(n+iwoff), ierr )
916 sconda = one / sqrt(rtmp)
926 ELSE IF ( wntus .OR. wntuf)
THEN
928 ELSE IF ( wntua )
THEN
932 IF ( .NOT. ( rsvec .OR. lsvec ) )
THEN
941 DO 1146 p = 1, min( n, nr )
944 IF ( q .LE. nr ) a(p,q) = zero
948 CALL sgesvd(
'N',
'N', n, nr, a, lda, s, u, ldu,
949 $ v, ldv, work, lwork, info )
956 $
CALL slaset(
'L', nr-1,nr-1, zero,zero, a(2,1), lda )
957 CALL sgesvd(
'N',
'N', nr, n, a, lda, s, u, ldu,
958 $ v, ldv, work, lwork, info )
962 ELSE IF ( lsvec .AND. ( .NOT. rsvec) )
THEN
976 $
CALL slaset(
'U', nr-1,nr-1, zero,zero, u(1,2), ldu )
980 CALL sgesvd(
'N',
'O', n, nr, u, ldu, s, u, ldu,
981 $ u, ldu, work(n+1), lwork-n, info )
984 DO 1120 q = p + 1, nr
994 CALL slacpy(
'U', nr, n, a, lda, u, ldu )
996 $
CALL slaset(
'L', nr-1, nr-1, zero, zero, u(2,1), ldu )
999 CALL sgesvd(
'O',
'N', nr, n, u, ldu, s, u, ldu,
1000 $ v, ldv, work(n+1), lwork-n, info )
1008 IF ( ( nr .LT. m ) .AND. ( .NOT.wntuf ) )
THEN
1009 CALL slaset(
'A', m-nr, nr, zero, zero, u(nr+1,1), ldu)
1010 IF ( nr .LT. n1 )
THEN
1011 CALL slaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1), ldu )
1012 CALL slaset(
'A',m-nr,n1-nr,zero,one,
1013 $ u(nr+1,nr+1), ldu )
1021 $
CALL sormqr(
'L',
'N', m, n1, n, a, lda, work, u,
1022 $ ldu, work(n+1), lwork-n, ierr )
1023 IF ( rowprm .AND. .NOT.wntuf )
1024 $
CALL slaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1026 ELSE IF ( rsvec .AND. ( .NOT. lsvec ) )
THEN
1039 $
CALL slaset(
'U', nr-1,nr-1, zero,zero, v(1,2), ldv )
1042 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1043 CALL sgesvd(
'O',
'N', n, nr, v, ldv, s, u, ldu,
1044 $ u, ldu, work(n+1), lwork-n, info )
1047 DO 1122 q = p + 1, nr
1054 IF ( nr .LT. n )
THEN
1056 DO 1104 q = nr + 1, n
1061 CALL slapmt( .false., nr, n, v, ldv, iwork )
1068 CALL slaset(
'G', n, n-nr, zero, zero, v(1,nr+1), ldv)
1069 CALL sgesvd(
'O',
'N', n, n, v, ldv, s, u, ldu,
1070 $ u, ldu, work(n+1), lwork-n, info )
1073 DO 1124 q = p + 1, n
1079 CALL slapmt( .false., n, n, v, ldv, iwork )
1085 CALL slacpy(
'U', nr, n, a, lda, v, ldv )
1087 $
CALL slaset(
'L', nr-1, nr-1, zero, zero, v(2,1), ldv )
1090 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1091 CALL sgesvd(
'N',
'O', nr, n, v, ldv, s, u, ldu,
1092 $ v, ldv, work(n+1), lwork-n, info )
1093 CALL slapmt( .false., nr, n, v, ldv, iwork )
1101 CALL slaset(
'G', n-nr, n, zero,zero, v(nr+1,1), ldv)
1102 CALL sgesvd(
'N',
'O', n, n, v, ldv, s, u, ldu,
1103 $ v, ldv, work(n+1), lwork-n, info )
1104 CALL slapmt( .false., n, n, v, ldv, iwork )
1118 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1127 $
CALL slaset(
'U', nr-1,nr-1, zero,zero, v(1,2), ldv )
1131 CALL sgesvd(
'O',
'A', n, nr, v, ldv, s, v, ldv,
1132 $ u, ldu, work(n+1), lwork-n, info )
1135 DO 1116 q = p + 1, nr
1141 IF ( nr .LT. n )
THEN
1148 CALL slapmt( .false., nr, n, v, ldv, iwork )
1151 DO 1118 q = p + 1, nr
1158 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1159 CALL slaset(
'A', m-nr,nr, zero,zero, u(nr+1,1), ldu)
1160 IF ( nr .LT. n1 )
THEN
1161 CALL slaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1162 CALL slaset(
'A',m-nr,n1-nr,zero,one,
1163 $ u(nr+1,nr+1), ldu )
1177 IF ( optratio*nr .GT. n )
THEN
1184 $
CALL slaset(
'U',nr-1,nr-1, zero,zero, v(1,2),ldv)
1186 CALL slaset(
'A',n,n-nr,zero,zero,v(1,nr+1),ldv)
1187 CALL sgesvd(
'O',
'A', n, n, v, ldv, s, v, ldv,
1188 $ u, ldu, work(n+1), lwork-n, info )
1191 DO 1114 q = p + 1, n
1197 CALL slapmt( .false., n, n, v, ldv, iwork )
1202 DO 1112 q = p + 1, n
1209 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1210 CALL slaset(
'A',m-n,n,zero,zero,u(n+1,1),ldu)
1211 IF ( n .LT. n1 )
THEN
1212 CALL slaset(
'A',n,n1-n,zero,zero,u(1,n+1),ldu)
1213 CALL slaset(
'A',m-n,n1-n,zero,one,
1226 $
CALL slaset(
'U',nr-1,nr-1,zero,zero,u(1,nr+2),ldu)
1227 CALL sgeqrf( n, nr, u(1,nr+1), ldu, work(n+1),
1228 $ work(n+nr+1), lwork-n-nr, ierr )
1234 CALL slaset(
'U',nr-1,nr-1,zero,zero,v(1,2),ldv)
1235 CALL sgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1236 $ v,ldv, work(n+nr+1),lwork-n-nr, info )
1237 CALL slaset(
'A',n-nr,nr,zero,zero,v(nr+1,1),ldv)
1238 CALL slaset(
'A',nr,n-nr,zero,zero,v(1,nr+1),ldv)
1239 CALL slaset(
'A',n-nr,n-nr,zero,one,v(nr+1,nr+1),ldv)
1240 CALL sormqr(
'R',
'C', n, n, nr, u(1,nr+1), ldu,
1241 $ work(n+1),v,ldv,work(n+nr+1),lwork-n-nr,ierr)
1242 CALL slapmt( .false., n, n, v, ldv, iwork )
1245 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1246 CALL slaset(
'A',m-nr,nr,zero,zero,u(nr+1,1),ldu)
1247 IF ( nr .LT. n1 )
THEN
1248 CALL slaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1249 CALL slaset(
'A',m-nr,n1-nr,zero,one,
1260 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1262 CALL slacpy(
'U', nr, n, a, lda, v, ldv )
1264 $
CALL slaset(
'L', nr-1,nr-1, zero,zero, v(2,1), ldv )
1267 CALL sgesvd(
'S',
'O', nr, n, v, ldv, s, u, ldu,
1268 $ v, ldv, work(n+1), lwork-n, info )
1269 CALL slapmt( .false., nr, n, v, ldv, iwork )
1273 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1274 CALL slaset(
'A', m-nr,nr, zero,zero, u(nr+1,1), ldu)
1275 IF ( nr .LT. n1 )
THEN
1276 CALL slaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1277 CALL slaset(
'A',m-nr,n1-nr,zero,one,
1278 $ u(nr+1,nr+1), ldu )
1292 IF ( optratio * nr .GT. n )
THEN
1293 CALL slacpy(
'U', nr, n, a, lda, v, ldv )
1295 $
CALL slaset(
'L', nr-1,nr-1, zero,zero, v(2,1),ldv)
1298 CALL slaset(
'A', n-nr,n, zero,zero, v(nr+1,1),ldv)
1299 CALL sgesvd(
'S',
'O', n, n, v, ldv, s, u, ldu,
1300 $ v, ldv, work(n+1), lwork-n, info )
1301 CALL slapmt( .false., n, n, v, ldv, iwork )
1307 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1308 CALL slaset(
'A',m-n,n,zero,zero,u(n+1,1),ldu)
1309 IF ( n .LT. n1 )
THEN
1310 CALL slaset(
'A',n,n1-n,zero,zero,u(1,n+1),ldu)
1311 CALL slaset(
'A',m-n,n1-n,zero,one,
1316 CALL slacpy(
'U', nr, n, a, lda, u(nr+1,1), ldu )
1318 $
CALL slaset(
'L',nr-1,nr-1,zero,zero,u(nr+2,1),ldu)
1319 CALL sgelqf( nr, n, u(nr+1,1), ldu, work(n+1),
1320 $ work(n+nr+1), lwork-n-nr, ierr )
1321 CALL slacpy(
'L',nr,nr,u(nr+1,1),ldu,v,ldv)
1323 $
CALL slaset(
'U',nr-1,nr-1,zero,zero,v(1,2),ldv)
1324 CALL sgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1325 $ v, ldv, work(n+nr+1), lwork-n-nr, info )
1326 CALL slaset(
'A',n-nr,nr,zero,zero,v(nr+1,1),ldv)
1327 CALL slaset(
'A',nr,n-nr,zero,zero,v(1,nr+1),ldv)
1328 CALL slaset(
'A',n-nr,n-nr,zero,one,v(nr+1,nr+1),ldv)
1329 CALL sormlq(
'R',
'N',n,n,nr,u(nr+1,1),ldu,work(n+1),
1330 $ v, ldv, work(n+nr+1),lwork-n-nr,ierr)
1331 CALL slapmt( .false., n, n, v, ldv, iwork )
1334 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1335 CALL slaset(
'A',m-nr,nr,zero,zero,u(nr+1,1),ldu)
1336 IF ( nr .LT. n1 )
THEN
1337 CALL slaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1338 CALL slaset(
'A',m-nr,n1-nr,zero,one,
1339 $ u(nr+1,nr+1), ldu )
1351 $
CALL sormqr(
'L',
'N', m, n1, n, a, lda, work, u,
1352 $ ldu, work(n+1), lwork-n, ierr )
1353 IF ( rowprm .AND. .NOT.wntuf )
1354 $
CALL slaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1362 DO 4001 q = p, 1, -1
1363 IF ( s(q) .GT. zero )
GO TO 4002
1370 IF ( nr .LT. n )
CALL slaset(
'G', n-nr,1, zero,zero, s(nr+1), n )
1374 $
CALL slascl(
'G',0,0, one,sqrt(real(m)), nr,1, s, n, ierr )
1375 IF ( conda ) rwork(1) = sconda
subroutine xerbla(srname, info)
subroutine sgelqf(m, n, a, lda, tau, work, lwork, info)
SGELQF
subroutine sgeqp3(m, n, a, lda, jpvt, tau, work, lwork, info)
SGEQP3
subroutine sgeqrf(m, n, a, lda, tau, work, lwork, info)
SGEQRF
subroutine sgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, info)
SGESVD computes the singular value decomposition (SVD) for GE matrices
subroutine sgesvdq(joba, jobp, jobr, jobu, jobv, m, n, a, lda, s, u, ldu, v, ldv, numrank, iwork, liwork, work, lwork, rwork, lrwork, info)
SGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE...
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
subroutine slapmt(forwrd, m, n, x, ldx, k)
SLAPMT performs a forward or backward permutation of the columns of a matrix.
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine slaswp(n, a, lda, k1, k2, ipiv, incx)
SLASWP performs a series of row interchanges on a general rectangular matrix.
subroutine spocon(uplo, n, a, lda, anorm, rcond, work, iwork, info)
SPOCON
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sormlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMLQ
subroutine sormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
SORMQR