412 SUBROUTINE dgesvdq( 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 DOUBLE PRECISION A( LDA, * ), U( LDU, * ), V( LDV, * ), WORK( * )
423 DOUBLE PRECISION S( * ), RWORK( * )
429 DOUBLE PRECISION ZERO, ONE
430 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
432 INTEGER IERR, IWOFF, NR, N1, OPTRATIO, p, q
433 INTEGER LWCON, LWQP3, LWRK_DGELQF, LWRK_DGESVD, LWRK_DGESVD2,
434 $ lwrk_dgeqp3, lwrk_dgeqrf, lwrk_dormlq, lwrk_dormqr,
435 $ lwrk_dormqr2, lwlqf, lwqrf, lwsvd, lwsvd2, lworq,
436 $ lworq2, lworlq, minwrk, minwrk2, optwrk, optwrk2,
438 LOGICAL ACCLA, ACCLM, ACCLH, ASCALED, CONDA, DNTWU, DNTWV,
439 $ LQUERY, LSVC0, LSVEC, ROWPRM, RSVEC, RTRANS, WNTUA,
440 $ wntuf, wntur, wntus, wntva, wntvr
441 DOUBLE PRECISION BIG, EPSLN, RTMP, SCONDA, SFMIN
443 DOUBLE PRECISION RDUMMY(1)
453 DOUBLE PRECISION DLANGE, DNRM2, DLAMCH
454 EXTERNAL dlange, lsame, idamax, dnrm2, dlamch
458 INTRINSIC abs, max, min, dble, sqrt
462 wntus = lsame( jobu,
'S' ) .OR. lsame( jobu,
'U' )
463 wntur = lsame( jobu,
'R' )
464 wntua = lsame( jobu,
'A' )
465 wntuf = lsame( jobu,
'F' )
466 lsvc0 = wntus .OR. wntur .OR. wntua
467 lsvec = lsvc0 .OR. wntuf
468 dntwu = lsame( jobu,
'N' )
470 wntvr = lsame( jobv,
'R' )
471 wntva = lsame( jobv,
'A' ) .OR. lsame( jobv,
'V' )
472 rsvec = wntvr .OR. wntva
473 dntwv = lsame( jobv,
'N' )
475 accla = lsame( joba,
'A' )
476 acclm = lsame( joba,
'M' )
477 conda = lsame( joba,
'E' )
478 acclh = lsame( joba,
'H' ) .OR. conda
480 rowprm = lsame( jobp,
'P' )
481 rtrans = lsame( jobr,
'T' )
485 iminwrk = max( 1, n + m - 1 + n )
487 iminwrk = max( 1, n + m - 1 )
489 rminwrk = max( 2, m )
492 iminwrk = max( 1, n + n )
494 iminwrk = max( 1, n )
498 lquery = (liwork .EQ. -1 .OR. lwork .EQ. -1 .OR. lrwork .EQ. -1)
500 IF ( .NOT. ( accla .OR. acclm .OR. acclh ) )
THEN
502 ELSE IF ( .NOT.( rowprm .OR. lsame( jobp,
'N' ) ) )
THEN
504 ELSE IF ( .NOT.( rtrans .OR. lsame( jobr,
'N' ) ) )
THEN
506 ELSE IF ( .NOT.( lsvec .OR. dntwu ) )
THEN
508 ELSE IF ( wntur .AND. wntva )
THEN
510 ELSE IF ( .NOT.( rsvec .OR. dntwv ))
THEN
512 ELSE IF ( m.LT.0 )
THEN
514 ELSE IF ( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
516 ELSE IF ( lda.LT.max( 1, m ) )
THEN
518 ELSE IF ( ldu.LT.1 .OR. ( lsvc0 .AND. ldu.LT.m ) .OR.
519 $ ( wntuf .AND. ldu.LT.n ) )
THEN
521 ELSE IF ( ldv.LT.1 .OR. ( rsvec .AND. ldv.LT.n ) .OR.
522 $ ( conda .AND. ldv.LT.n ) )
THEN
524 ELSE IF ( liwork .LT. iminwrk .AND. .NOT. lquery )
THEN
529 IF ( info .EQ. 0 )
THEN
539 IF ( wntus .OR. wntur )
THEN
541 ELSE IF ( wntua )
THEN
547 lwsvd = max( 5 * n, 1 )
549 CALL dgeqp3( m, n, a, lda, iwork, rdummy, rdummy, -1,
551 lwrk_dgeqp3 = int( rdummy(1) )
552 IF ( wntus .OR. wntur )
THEN
553 CALL dormqr(
'L',
'N', m, n, n, a, lda, rdummy, u,
554 $ ldu, rdummy, -1, ierr )
555 lwrk_dormqr = int( rdummy(1) )
556 ELSE IF ( wntua )
THEN
557 CALL dormqr(
'L',
'N', m, m, n, a, lda, rdummy, u,
558 $ ldu, rdummy, -1, ierr )
559 lwrk_dormqr = int( rdummy(1) )
566 IF ( .NOT. (lsvec .OR. rsvec ))
THEN
570 minwrk = max( n+lwqp3, lwcon, lwsvd )
572 minwrk = max( n+lwqp3, lwsvd )
575 CALL dgesvd(
'N',
'N', n, n, a, lda, s, u, ldu,
576 $ v, ldv, rdummy, -1, ierr )
577 lwrk_dgesvd = int( rdummy(1) )
579 optwrk = max( n+lwrk_dgeqp3, n+lwcon, lwrk_dgesvd )
581 optwrk = max( n+lwrk_dgeqp3, lwrk_dgesvd )
584 ELSE IF ( lsvec .AND. (.NOT.rsvec) )
THEN
588 minwrk = n + max( lwqp3, lwcon, lwsvd, lworq )
590 minwrk = n + max( lwqp3, lwsvd, lworq )
594 CALL dgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
595 $ v, ldv, rdummy, -1, ierr )
597 CALL dgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
598 $ v, ldv, rdummy, -1, ierr )
600 lwrk_dgesvd = int( rdummy(1) )
602 optwrk = n + max( lwrk_dgeqp3, lwcon, lwrk_dgesvd,
605 optwrk = n + max( lwrk_dgeqp3, lwrk_dgesvd,
609 ELSE IF ( rsvec .AND. (.NOT.lsvec) )
THEN
613 minwrk = n + max( lwqp3, lwcon, lwsvd )
615 minwrk = n + max( lwqp3, lwsvd )
619 CALL dgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
620 $ v, ldv, rdummy, -1, ierr )
622 CALL dgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
623 $ v, ldv, rdummy, -1, ierr )
625 lwrk_dgesvd = int( rdummy(1) )
627 optwrk = n + max( lwrk_dgeqp3, lwcon, lwrk_dgesvd )
629 optwrk = n + max( lwrk_dgeqp3, lwrk_dgesvd )
636 minwrk = max( lwqp3, lwsvd, lworq )
637 IF ( conda ) minwrk = max( minwrk, lwcon )
641 lwqrf = max( n/2, 1 )
643 lwsvd2 = max( 5 * (n/2), 1 )
645 minwrk2 = max( lwqp3, n/2+lwqrf, n/2+lwsvd2,
646 $ n/2+lworq2, lworq )
647 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
648 minwrk2 = n + minwrk2
649 minwrk = max( minwrk, minwrk2 )
652 minwrk = max( lwqp3, lwsvd, lworq )
653 IF ( conda ) minwrk = max( minwrk, lwcon )
657 lwlqf = max( n/2, 1 )
658 lwsvd2 = max( 5 * (n/2), 1 )
659 lworlq = max( n , 1 )
660 minwrk2 = max( lwqp3, n/2+lwlqf, n/2+lwsvd2,
661 $ n/2+lworlq, lworq )
662 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
663 minwrk2 = n + minwrk2
664 minwrk = max( minwrk, minwrk2 )
669 CALL dgesvd(
'O',
'A', n, n, a, lda, s, u, ldu,
670 $ v, ldv, rdummy, -1, ierr )
671 lwrk_dgesvd = int( rdummy(1) )
672 optwrk = max(lwrk_dgeqp3,lwrk_dgesvd,lwrk_dormqr)
673 IF ( conda ) optwrk = max( optwrk, lwcon )
676 CALL dgeqrf(n,n/2,u,ldu,rdummy,rdummy,-1,ierr)
677 lwrk_dgeqrf = int( rdummy(1) )
678 CALL dgesvd(
'S',
'O', n/2,n/2, v,ldv, s, u,ldu,
679 $ v, ldv, rdummy, -1, ierr )
680 lwrk_dgesvd2 = int( rdummy(1) )
681 CALL dormqr(
'R',
'C', n, n, n/2, u, ldu, rdummy,
682 $ v, ldv, rdummy, -1, ierr )
683 lwrk_dormqr2 = int( rdummy(1) )
684 optwrk2 = max( lwrk_dgeqp3, n/2+lwrk_dgeqrf,
685 $ n/2+lwrk_dgesvd2, n/2+lwrk_dormqr2 )
686 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
687 optwrk2 = n + optwrk2
688 optwrk = max( optwrk, optwrk2 )
691 CALL dgesvd(
'S',
'O', n, n, a, lda, s, u, ldu,
692 $ v, ldv, rdummy, -1, ierr )
693 lwrk_dgesvd = int( rdummy(1) )
694 optwrk = max(lwrk_dgeqp3,lwrk_dgesvd,lwrk_dormqr)
695 IF ( conda ) optwrk = max( optwrk, lwcon )
698 CALL dgelqf(n/2,n,u,ldu,rdummy,rdummy,-1,ierr)
699 lwrk_dgelqf = int( rdummy(1) )
700 CALL dgesvd(
'S',
'O', n/2,n/2, v, ldv, s, u, ldu,
701 $ v, ldv, rdummy, -1, ierr )
702 lwrk_dgesvd2 = int( rdummy(1) )
703 CALL dormlq(
'R',
'N', n, n, n/2, u, ldu, rdummy,
704 $ v, ldv, rdummy,-1,ierr )
705 lwrk_dormlq = int( rdummy(1) )
706 optwrk2 = max( lwrk_dgeqp3, n/2+lwrk_dgelqf,
707 $ n/2+lwrk_dgesvd2, n/2+lwrk_dormlq )
708 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
709 optwrk2 = n + optwrk2
710 optwrk = max( optwrk, optwrk2 )
716 minwrk = max( 2, minwrk )
717 optwrk = max( 2, optwrk )
718 IF ( lwork .LT. minwrk .AND. (.NOT.lquery) ) info = -19
722 IF (info .EQ. 0 .AND. lrwork .LT. rminwrk .AND. .NOT. lquery)
THEN
726 CALL xerbla(
'DGESVDQ', -info )
728 ELSE IF ( lquery )
THEN
741 IF( ( m.EQ.0 ) .OR. ( n.EQ.0 ) )
THEN
757 rwork(p) = dlange(
'M', 1, n, a(p,1), lda, rdummy )
759 IF ( ( rwork(p) .NE. rwork(p) ) .OR.
760 $ ( (rwork(p)*zero) .NE. zero ) )
THEN
762 CALL xerbla(
'DGESVDQ', -info )
767 q = idamax( m-p+1, rwork(p), 1 ) + p - 1
776 IF ( rwork(1) .EQ. zero )
THEN
779 CALL dlaset(
'G', n, 1, zero, zero, s, n )
780 IF ( wntus )
CALL dlaset(
'G', m, n, zero, one, u, ldu)
781 IF ( wntua )
CALL dlaset(
'G', m, m, zero, one, u, ldu)
782 IF ( wntva )
CALL dlaset(
'G', n, n, zero, one, v, ldv)
784 CALL dlaset(
'G', n, 1, zero, zero, work, n )
785 CALL dlaset(
'G', m, n, zero, one, u, ldu )
791 DO 5002 p = n + 1, n + m - 1
795 IF ( conda ) rwork(1) = -1
800 IF ( rwork(1) .GT. big / sqrt(dble(m)) )
THEN
803 CALL dlascl(
'G',0,0,sqrt(dble(m)),one, m,n, a,lda, ierr)
806 CALL dlaswp( n, a, lda, 1, m-1, iwork(n+1), 1 )
814 IF ( .NOT.rowprm )
THEN
815 rtmp = dlange(
'M', m, n, a, lda, rdummy )
816 IF ( ( rtmp .NE. rtmp ) .OR.
817 $ ( (rtmp*zero) .NE. zero ) )
THEN
819 CALL xerbla(
'DGESVDQ', -info )
822 IF ( rtmp .GT. big / sqrt(dble(m)) )
THEN
825 CALL dlascl(
'G',0,0, sqrt(dble(m)),one, m,n, a,lda, ierr)
839 CALL dgeqp3( m, n, a, lda, iwork, work, work(n+1), lwork-n,
858 rtmp = sqrt(dble(n))*epsln
860 IF ( abs(a(p,p)) .LT. (rtmp*abs(a(1,1))) )
GO TO 3002
865 ELSEIF ( acclm )
THEN
874 IF ( ( abs(a(p,p)) .LT. (epsln*abs(a(p-1,p-1))) ) .OR.
875 $ ( abs(a(p,p)) .LT. sfmin ) )
GO TO 3402
887 IF ( abs(a(p,p)) .EQ. zero )
GO TO 3502
896 CALL dlacpy(
'U', n, n, a, lda, v, ldv )
903 rtmp = dnrm2( p, v(1,p), 1 )
904 CALL dscal( p, one/rtmp, v(1,p), 1 )
906 IF ( .NOT. ( lsvec .OR. rsvec ) )
THEN
907 CALL dpocon(
'U', nr, v, ldv, one, rtmp,
908 $ work, iwork(n+iwoff), ierr )
910 CALL dpocon(
'U', nr, v, ldv, one, rtmp,
911 $ work(n+1), iwork(n+iwoff), ierr )
913 sconda = one / sqrt(rtmp)
923 ELSE IF ( wntus .OR. wntuf)
THEN
925 ELSE IF ( wntua )
THEN
929 IF ( .NOT. ( rsvec .OR. lsvec ) )
THEN
938 DO 1146 p = 1, min( n, nr )
941 IF ( q .LE. nr ) a(p,q) = zero
945 CALL dgesvd(
'N',
'N', n, nr, a, lda, s, u, ldu,
946 $ v, ldv, work, lwork, info )
953 $
CALL dlaset(
'L', nr-1,nr-1, zero,zero, a(2,1), lda )
954 CALL dgesvd(
'N',
'N', nr, n, a, lda, s, u, ldu,
955 $ v, ldv, work, lwork, info )
959 ELSE IF ( lsvec .AND. ( .NOT. rsvec) )
THEN
973 $
CALL dlaset(
'U', nr-1,nr-1, zero,zero, u(1,2), ldu )
977 CALL dgesvd(
'N',
'O', n, nr, u, ldu, s, u, ldu,
978 $ u, ldu, work(n+1), lwork-n, info )
981 DO 1120 q = p + 1, nr
991 CALL dlacpy(
'U', nr, n, a, lda, u, ldu )
993 $
CALL dlaset(
'L', nr-1, nr-1, zero, zero, u(2,1), ldu )
996 CALL dgesvd(
'O',
'N', nr, n, u, ldu, s, u, ldu,
997 $ v, ldv, work(n+1), lwork-n, info )
1005 IF ( ( nr .LT. m ) .AND. ( .NOT.wntuf ) )
THEN
1006 CALL dlaset(
'A', m-nr, nr, zero, zero, u(nr+1,1), ldu)
1007 IF ( nr .LT. n1 )
THEN
1008 CALL dlaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1), ldu )
1009 CALL dlaset(
'A',m-nr,n1-nr,zero,one,
1010 $ u(nr+1,nr+1), ldu )
1018 $
CALL dormqr(
'L',
'N', m, n1, n, a, lda, work, u,
1019 $ ldu, work(n+1), lwork-n, ierr )
1020 IF ( rowprm .AND. .NOT.wntuf )
1021 $
CALL dlaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1023 ELSE IF ( rsvec .AND. ( .NOT. lsvec ) )
THEN
1036 $
CALL dlaset(
'U', nr-1,nr-1, zero,zero, v(1,2), ldv )
1039 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1040 CALL dgesvd(
'O',
'N', n, nr, v, ldv, s, u, ldu,
1041 $ u, ldu, work(n+1), lwork-n, info )
1044 DO 1122 q = p + 1, nr
1051 IF ( nr .LT. n )
THEN
1053 DO 1104 q = nr + 1, n
1058 CALL dlapmt( .false., nr, n, v, ldv, iwork )
1065 CALL dlaset(
'G', n, n-nr, zero, zero, v(1,nr+1), ldv)
1066 CALL dgesvd(
'O',
'N', n, n, v, ldv, s, u, ldu,
1067 $ u, ldu, work(n+1), lwork-n, info )
1070 DO 1124 q = p + 1, n
1076 CALL dlapmt( .false., n, n, v, ldv, iwork )
1082 CALL dlacpy(
'U', nr, n, a, lda, v, ldv )
1084 $
CALL dlaset(
'L', nr-1, nr-1, zero, zero, v(2,1), ldv )
1087 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1088 CALL dgesvd(
'N',
'O', nr, n, v, ldv, s, u, ldu,
1089 $ v, ldv, work(n+1), lwork-n, info )
1090 CALL dlapmt( .false., nr, n, v, ldv, iwork )
1098 CALL dlaset(
'G', n-nr, n, zero,zero, v(nr+1,1), ldv)
1099 CALL dgesvd(
'N',
'O', n, n, v, ldv, s, u, ldu,
1100 $ v, ldv, work(n+1), lwork-n, info )
1101 CALL dlapmt( .false., n, n, v, ldv, iwork )
1115 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1124 $
CALL dlaset(
'U', nr-1,nr-1, zero,zero, v(1,2), ldv )
1128 CALL dgesvd(
'O',
'A', n, nr, v, ldv, s, v, ldv,
1129 $ u, ldu, work(n+1), lwork-n, info )
1132 DO 1116 q = p + 1, nr
1138 IF ( nr .LT. n )
THEN
1145 CALL dlapmt( .false., nr, n, v, ldv, iwork )
1148 DO 1118 q = p + 1, nr
1155 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1156 CALL dlaset(
'A', m-nr,nr, zero,zero, u(nr+1,1), ldu)
1157 IF ( nr .LT. n1 )
THEN
1158 CALL dlaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1159 CALL dlaset(
'A',m-nr,n1-nr,zero,one,
1160 $ u(nr+1,nr+1), ldu )
1174 IF ( optratio*nr .GT. n )
THEN
1181 $
CALL dlaset(
'U',nr-1,nr-1, zero,zero, v(1,2),ldv)
1183 CALL dlaset(
'A',n,n-nr,zero,zero,v(1,nr+1),ldv)
1184 CALL dgesvd(
'O',
'A', n, n, v, ldv, s, v, ldv,
1185 $ u, ldu, work(n+1), lwork-n, info )
1188 DO 1114 q = p + 1, n
1194 CALL dlapmt( .false., n, n, v, ldv, iwork )
1199 DO 1112 q = p + 1, n
1206 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1207 CALL dlaset(
'A',m-n,n,zero,zero,u(n+1,1),ldu)
1208 IF ( n .LT. n1 )
THEN
1209 CALL dlaset(
'A',n,n1-n,zero,zero,u(1,n+1),ldu)
1210 CALL dlaset(
'A',m-n,n1-n,zero,one,
1223 $
CALL dlaset(
'U',nr-1,nr-1,zero,zero,u(1,nr+2),ldu)
1224 CALL dgeqrf( n, nr, u(1,nr+1), ldu, work(n+1),
1225 $ work(n+nr+1), lwork-n-nr, ierr )
1231 CALL dlaset(
'U',nr-1,nr-1,zero,zero,v(1,2),ldv)
1232 CALL dgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1233 $ v,ldv, work(n+nr+1),lwork-n-nr, info )
1234 CALL dlaset(
'A',n-nr,nr,zero,zero,v(nr+1,1),ldv)
1235 CALL dlaset(
'A',nr,n-nr,zero,zero,v(1,nr+1),ldv)
1236 CALL dlaset(
'A',n-nr,n-nr,zero,one,v(nr+1,nr+1),ldv)
1237 CALL dormqr(
'R',
'C', n, n, nr, u(1,nr+1), ldu,
1238 $ work(n+1),v,ldv,work(n+nr+1),lwork-n-nr,ierr)
1239 CALL dlapmt( .false., n, n, v, ldv, iwork )
1242 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1243 CALL dlaset(
'A',m-nr,nr,zero,zero,u(nr+1,1),ldu)
1244 IF ( nr .LT. n1 )
THEN
1245 CALL dlaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1246 CALL dlaset(
'A',m-nr,n1-nr,zero,one,
1257 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1259 CALL dlacpy(
'U', nr, n, a, lda, v, ldv )
1261 $
CALL dlaset(
'L', nr-1,nr-1, zero,zero, v(2,1), ldv )
1264 CALL dgesvd(
'S',
'O', nr, n, v, ldv, s, u, ldu,
1265 $ v, ldv, work(n+1), lwork-n, info )
1266 CALL dlapmt( .false., nr, n, v, ldv, iwork )
1270 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1271 CALL dlaset(
'A', m-nr,nr, zero,zero, u(nr+1,1), ldu)
1272 IF ( nr .LT. n1 )
THEN
1273 CALL dlaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1274 CALL dlaset(
'A',m-nr,n1-nr,zero,one,
1275 $ u(nr+1,nr+1), ldu )
1289 IF ( optratio * nr .GT. n )
THEN
1290 CALL dlacpy(
'U', nr, n, a, lda, v, ldv )
1292 $
CALL dlaset(
'L', nr-1,nr-1, zero,zero, v(2,1),ldv)
1295 CALL dlaset(
'A', n-nr,n, zero,zero, v(nr+1,1),ldv)
1296 CALL dgesvd(
'S',
'O', n, n, v, ldv, s, u, ldu,
1297 $ v, ldv, work(n+1), lwork-n, info )
1298 CALL dlapmt( .false., n, n, v, ldv, iwork )
1304 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1305 CALL dlaset(
'A',m-n,n,zero,zero,u(n+1,1),ldu)
1306 IF ( n .LT. n1 )
THEN
1307 CALL dlaset(
'A',n,n1-n,zero,zero,u(1,n+1),ldu)
1308 CALL dlaset(
'A',m-n,n1-n,zero,one,
1313 CALL dlacpy(
'U', nr, n, a, lda, u(nr+1,1), ldu )
1315 $
CALL dlaset(
'L',nr-1,nr-1,zero,zero,u(nr+2,1),ldu)
1316 CALL dgelqf( nr, n, u(nr+1,1), ldu, work(n+1),
1317 $ work(n+nr+1), lwork-n-nr, ierr )
1318 CALL dlacpy(
'L',nr,nr,u(nr+1,1),ldu,v,ldv)
1320 $
CALL dlaset(
'U',nr-1,nr-1,zero,zero,v(1,2),ldv)
1321 CALL dgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1322 $ v, ldv, work(n+nr+1), lwork-n-nr, info )
1323 CALL dlaset(
'A',n-nr,nr,zero,zero,v(nr+1,1),ldv)
1324 CALL dlaset(
'A',nr,n-nr,zero,zero,v(1,nr+1),ldv)
1325 CALL dlaset(
'A',n-nr,n-nr,zero,one,v(nr+1,nr+1),ldv)
1326 CALL dormlq(
'R',
'N',n,n,nr,u(nr+1,1),ldu,work(n+1),
1327 $ v, ldv, work(n+nr+1),lwork-n-nr,ierr)
1328 CALL dlapmt( .false., n, n, v, ldv, iwork )
1331 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1332 CALL dlaset(
'A',m-nr,nr,zero,zero,u(nr+1,1),ldu)
1333 IF ( nr .LT. n1 )
THEN
1334 CALL dlaset(
'A',nr,n1-nr,zero,zero,u(1,nr+1),ldu)
1335 CALL dlaset(
'A',m-nr,n1-nr,zero,one,
1336 $ u(nr+1,nr+1), ldu )
1348 $
CALL dormqr(
'L',
'N', m, n1, n, a, lda, work, u,
1349 $ ldu, work(n+1), lwork-n, ierr )
1350 IF ( rowprm .AND. .NOT.wntuf )
1351 $
CALL dlaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1359 DO 4001 q = p, 1, -1
1360 IF ( s(q) .GT. zero )
GO TO 4002
1367 IF ( nr .LT. n )
CALL dlaset(
'G', n-nr,1, zero,zero, s(nr+1), n )
1371 $
CALL dlascl(
'G',0,0, one,sqrt(dble(m)), nr,1, s, n, ierr )
1372 IF ( conda ) rwork(1) = sconda
subroutine xerbla(srname, info)
subroutine dgelqf(m, n, a, lda, tau, work, lwork, info)
DGELQF
subroutine dgeqp3(m, n, a, lda, jpvt, tau, work, lwork, info)
DGEQP3
subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
DGEQRF
subroutine dgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, info)
DGESVD computes the singular value decomposition (SVD) for GE matrices
subroutine dgesvdq(joba, jobp, jobr, jobu, jobv, m, n, a, lda, s, u, ldu, v, ldv, numrank, iwork, liwork, work, lwork, rwork, lrwork, info)
DGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE...
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlapmt(forwrd, m, n, x, ldx, k)
DLAPMT performs a forward or backward permutation of the columns of a matrix.
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine dlaswp(n, a, lda, k1, k2, ipiv, incx)
DLASWP performs a series of row interchanges on a general rectangular matrix.
subroutine dpocon(uplo, n, a, lda, anorm, rcond, work, iwork, info)
DPOCON
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dormlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMLQ
subroutine dormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMQR