410 SUBROUTINE zgesvdq( JOBA, JOBP, JOBR, JOBU, JOBV, M, N, A, LDA,
411 $ S, U, LDU, V, LDV, NUMRANK, IWORK, LIWORK,
412 $ CWORK, LCWORK, RWORK, LRWORK, INFO )
415 CHARACTER JOBA, JOBP, JOBR, JOBU, JOBV
416 INTEGER M, N, LDA, LDU, LDV, NUMRANK, LIWORK, LCWORK, LRWORK,
420 COMPLEX*16 A( LDA, * ), U( LDU, * ), V( LDV, * ), CWORK( * )
421 DOUBLE PRECISION S( * ), RWORK( * )
427 DOUBLE PRECISION ZERO, ONE
428 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
429 COMPLEX*16 CZERO, CONE
430 parameter( czero = (0.0d0,0.0d0), cone = (1.0d0,0.0d0) )
433 INTEGER IERR, NR, N1, OPTRATIO, p, q
434 INTEGER LWCON, LWQP3, LWRK_ZGELQF, LWRK_ZGESVD, LWRK_ZGESVD2,
435 $ lwrk_zgeqp3, lwrk_zgeqrf, lwrk_zunmlq, lwrk_zunmqr,
436 $ lwrk_zunmqr2, lwlqf, lwqrf, lwsvd, lwsvd2, lwunq,
437 $ lwunq2, 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 DOUBLE PRECISION BIG, EPSLN, RTMP, SCONDA, SFMIN
447 DOUBLE PRECISION RDUMMY(1)
457 DOUBLE PRECISION ZLANGE, DZNRM2, DLAMCH
458 EXTERNAL lsame, zlange, idamax, dznrm2, dlamch
461 INTRINSIC abs, conjg, max, min, dble, sqrt
467 wntus = lsame( jobu,
'S' ) .OR. lsame( jobu,
'U' )
468 wntur = lsame( jobu,
'R' )
469 wntua = lsame( jobu,
'A' )
470 wntuf = lsame( jobu,
'F' )
471 lsvc0 = wntus .OR. wntur .OR. wntua
472 lsvec = lsvc0 .OR. wntuf
473 dntwu = lsame( jobu,
'N' )
475 wntvr = lsame( jobv,
'R' )
476 wntva = lsame( jobv,
'A' ) .OR. lsame( jobv,
'V' )
477 rsvec = wntvr .OR. wntva
478 dntwv = lsame( jobv,
'N' )
480 accla = lsame( joba,
'A' )
481 acclm = lsame( joba,
'M' )
482 conda = lsame( joba,
'E' )
483 acclh = lsame( joba,
'H' ) .OR. conda
485 rowprm = lsame( jobp,
'P' )
486 rtrans = lsame( jobr,
'T' )
489 iminwrk = max( 1, n + m - 1 )
490 rminwrk = max( 2, m, 5*n )
492 iminwrk = max( 1, n )
493 rminwrk = max( 2, 5*n )
495 lquery = (liwork .EQ. -1 .OR. lcwork .EQ. -1 .OR. lrwork .EQ. -1)
497 IF ( .NOT. ( accla .OR. acclm .OR. acclh ) )
THEN
499 ELSE IF ( .NOT.( rowprm .OR. lsame( jobp,
'N' ) ) )
THEN
501 ELSE IF ( .NOT.( rtrans .OR. lsame( jobr,
'N' ) ) )
THEN
503 ELSE IF ( .NOT.( lsvec .OR. dntwu ) )
THEN
505 ELSE IF ( wntur .AND. wntva )
THEN
507 ELSE IF ( .NOT.( rsvec .OR. dntwv ))
THEN
509 ELSE IF ( m.LT.0 )
THEN
511 ELSE IF ( ( n.LT.0 ) .OR. ( n.GT.m ) )
THEN
513 ELSE IF ( lda.LT.max( 1, m ) )
THEN
515 ELSE IF ( ldu.LT.1 .OR. ( lsvc0 .AND. ldu.LT.m ) .OR.
516 $ ( wntuf .AND. ldu.LT.n ) )
THEN
518 ELSE IF ( ldv.LT.1 .OR. ( rsvec .AND. ldv.LT.n ) .OR.
519 $ ( conda .AND. ldv.LT.n ) )
THEN
521 ELSE IF ( liwork .LT. iminwrk .AND. .NOT. lquery )
THEN
526 IF ( info .EQ. 0 )
THEN
536 IF ( wntus .OR. wntur )
THEN
538 ELSE IF ( wntua )
THEN
544 lwsvd = max( 3 * n, 1 )
546 CALL zgeqp3( m, n, a, lda, iwork, cdummy, cdummy, -1,
548 lwrk_zgeqp3 = int( cdummy(1) )
549 IF ( wntus .OR. wntur )
THEN
550 CALL zunmqr(
'L',
'N', m, n, n, a, lda, cdummy, u,
551 $ ldu, cdummy, -1, ierr )
552 lwrk_zunmqr = int( cdummy(1) )
553 ELSE IF ( wntua )
THEN
554 CALL zunmqr(
'L',
'N', m, m, n, a, lda, cdummy, u,
555 $ ldu, cdummy, -1, ierr )
556 lwrk_zunmqr = int( cdummy(1) )
563 IF ( .NOT. (lsvec .OR. rsvec ) )
THEN
567 minwrk = max( n+lwqp3, lwcon, lwsvd )
569 minwrk = max( n+lwqp3, lwsvd )
572 CALL zgesvd(
'N',
'N', n, n, a, lda, s, u, ldu,
573 $ v, ldv, cdummy, -1, rdummy, ierr )
574 lwrk_zgesvd = int( cdummy(1) )
576 optwrk = max( n+lwrk_zgeqp3, n+lwcon, lwrk_zgesvd )
578 optwrk = max( n+lwrk_zgeqp3, lwrk_zgesvd )
581 ELSE IF ( lsvec .AND. (.NOT.rsvec) )
THEN
585 minwrk = n + max( lwqp3, lwcon, lwsvd, lwunq )
587 minwrk = n + max( lwqp3, lwsvd, lwunq )
591 CALL zgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
592 $ v, ldv, cdummy, -1, rdummy, ierr )
594 CALL zgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
595 $ v, ldv, cdummy, -1, rdummy, ierr )
597 lwrk_zgesvd = int( cdummy(1) )
599 optwrk = n + max( lwrk_zgeqp3, lwcon, lwrk_zgesvd,
602 optwrk = n + max( lwrk_zgeqp3, lwrk_zgesvd,
606 ELSE IF ( rsvec .AND. (.NOT.lsvec) )
THEN
610 minwrk = n + max( lwqp3, lwcon, lwsvd )
612 minwrk = n + max( lwqp3, lwsvd )
616 CALL zgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
617 $ v, ldv, cdummy, -1, rdummy, ierr )
619 CALL zgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
620 $ v, ldv, cdummy, -1, rdummy, ierr )
622 lwrk_zgesvd = int( cdummy(1) )
624 optwrk = n + max( lwrk_zgeqp3, lwcon, lwrk_zgesvd )
626 optwrk = n + max( lwrk_zgeqp3, lwrk_zgesvd )
633 minwrk = max( lwqp3, lwsvd, lwunq )
634 IF ( conda ) minwrk = max( minwrk, lwcon )
638 lwqrf = max( n/2, 1 )
640 lwsvd2 = max( 3 * (n/2), 1 )
642 minwrk2 = max( lwqp3, n/2+lwqrf, n/2+lwsvd2,
643 $ n/2+lwunq2, lwunq )
644 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
645 minwrk2 = n + minwrk2
646 minwrk = max( minwrk, minwrk2 )
649 minwrk = max( lwqp3, lwsvd, lwunq )
650 IF ( conda ) minwrk = max( minwrk, lwcon )
654 lwlqf = max( n/2, 1 )
655 lwsvd2 = max( 3 * (n/2), 1 )
656 lwunlq = max( n , 1 )
657 minwrk2 = max( lwqp3, n/2+lwlqf, n/2+lwsvd2,
658 $ n/2+lwunlq, lwunq )
659 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
660 minwrk2 = n + minwrk2
661 minwrk = max( minwrk, minwrk2 )
666 CALL zgesvd(
'O',
'A', n, n, a, lda, s, u, ldu,
667 $ v, ldv, cdummy, -1, rdummy, ierr )
668 lwrk_zgesvd = int( cdummy(1) )
669 optwrk = max(lwrk_zgeqp3,lwrk_zgesvd,lwrk_zunmqr)
670 IF ( conda ) optwrk = max( optwrk, lwcon )
673 CALL zgeqrf(n,n/2,u,ldu,cdummy,cdummy,-1,ierr)
674 lwrk_zgeqrf = int( cdummy(1) )
675 CALL zgesvd(
'S',
'O', n/2,n/2, v,ldv, s, u,ldu,
676 $ v, ldv, cdummy, -1, rdummy, ierr )
677 lwrk_zgesvd2 = int( cdummy(1) )
678 CALL zunmqr(
'R',
'C', n, n, n/2, u, ldu, cdummy,
679 $ v, ldv, cdummy, -1, ierr )
680 lwrk_zunmqr2 = int( cdummy(1) )
681 optwrk2 = max( lwrk_zgeqp3, n/2+lwrk_zgeqrf,
682 $ n/2+lwrk_zgesvd2, n/2+lwrk_zunmqr2 )
683 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
684 optwrk2 = n + optwrk2
685 optwrk = max( optwrk, optwrk2 )
688 CALL zgesvd(
'S',
'O', n, n, a, lda, s, u, ldu,
689 $ v, ldv, cdummy, -1, rdummy, ierr )
690 lwrk_zgesvd = int( cdummy(1) )
691 optwrk = max(lwrk_zgeqp3,lwrk_zgesvd,lwrk_zunmqr)
692 IF ( conda ) optwrk = max( optwrk, lwcon )
695 CALL zgelqf(n/2,n,u,ldu,cdummy,cdummy,-1,ierr)
696 lwrk_zgelqf = int( cdummy(1) )
697 CALL zgesvd(
'S',
'O', n/2,n/2, v, ldv, s, u, ldu,
698 $ v, ldv, cdummy, -1, rdummy, ierr )
699 lwrk_zgesvd2 = int( cdummy(1) )
700 CALL zunmlq(
'R',
'N', n, n, n/2, u, ldu, cdummy,
701 $ v, ldv, cdummy,-1,ierr )
702 lwrk_zunmlq = int( cdummy(1) )
703 optwrk2 = max( lwrk_zgeqp3, n/2+lwrk_zgelqf,
704 $ n/2+lwrk_zgesvd2, n/2+lwrk_zunmlq )
705 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
706 optwrk2 = n + optwrk2
707 optwrk = max( optwrk, optwrk2 )
713 minwrk = max( 2, minwrk )
714 optwrk = max( 2, optwrk )
715 IF ( lcwork .LT. minwrk .AND. (.NOT.lquery) ) info = -19
719 IF (info .EQ. 0 .AND. lrwork .LT. rminwrk .AND. .NOT. lquery)
THEN
723 CALL xerbla(
'ZGESVDQ', -info )
725 ELSE IF ( lquery )
THEN
738 IF( ( m.EQ.0 ) .OR. ( n.EQ.0 ) )
THEN
752 rwork(p) = zlange(
'M', 1, n, a(p,1), lda, rdummy )
754 IF ( ( rwork(p) .NE. rwork(p) ) .OR.
755 $ ( (rwork(p)*zero) .NE. zero ) )
THEN
757 CALL xerbla(
'ZGESVDQ', -info )
762 q = idamax( m-p+1, rwork(p), 1 ) + p - 1
771 IF ( rwork(1) .EQ. zero )
THEN
774 CALL dlaset(
'G', n, 1, zero, zero, s, n )
775 IF ( wntus )
CALL zlaset(
'G', m, n, czero, cone, u, ldu)
776 IF ( wntua )
CALL zlaset(
'G', m, m, czero, cone, u, ldu)
777 IF ( wntva )
CALL zlaset(
'G', n, n, czero, cone, v, ldv)
779 CALL zlaset(
'G', n, 1, czero, czero, cwork, n )
780 CALL zlaset(
'G', m, n, czero, cone, u, ldu )
786 DO 5002 p = n + 1, n + m - 1
790 IF ( conda ) rwork(1) = -1
795 IF ( rwork(1) .GT. big / sqrt(dble(m)) )
THEN
798 CALL zlascl(
'G',0,0,sqrt(dble(m)),one, m,n, a,lda, ierr)
801 CALL zlaswp( n, a, lda, 1, m-1, iwork(n+1), 1 )
809 IF ( .NOT.rowprm )
THEN
810 rtmp = zlange(
'M', m, n, a, lda, rwork )
811 IF ( ( rtmp .NE. rtmp ) .OR.
812 $ ( (rtmp*zero) .NE. zero ) )
THEN
814 CALL xerbla(
'ZGESVDQ', -info )
817 IF ( rtmp .GT. big / sqrt(dble(m)) )
THEN
820 CALL zlascl(
'G',0,0, sqrt(dble(m)),one, m,n, a,lda, ierr)
834 CALL zgeqp3( m, n, a, lda, iwork, cwork, cwork(n+1), lcwork-n,
853 rtmp = sqrt(dble(n))*epsln
855 IF ( abs(a(p,p)) .LT. (rtmp*abs(a(1,1))) )
GO TO 3002
860 ELSEIF ( acclm )
THEN
869 IF ( ( abs(a(p,p)) .LT. (epsln*abs(a(p-1,p-1))) ) .OR.
870 $ ( abs(a(p,p)) .LT. sfmin ) )
GO TO 3402
882 IF ( abs(a(p,p)) .EQ. zero )
GO TO 3502
891 CALL zlacpy(
'U', n, n, a, lda, v, ldv )
898 rtmp = dznrm2( p, v(1,p), 1 )
899 CALL zdscal( p, one/rtmp, v(1,p), 1 )
901 IF ( .NOT. ( lsvec .OR. rsvec ) )
THEN
902 CALL zpocon(
'U', nr, v, ldv, one, rtmp,
903 $ cwork, rwork, ierr )
905 CALL zpocon(
'U', nr, v, ldv, one, rtmp,
906 $ cwork(n+1), rwork, ierr )
908 sconda = one / sqrt(rtmp)
918 ELSE IF ( wntus .OR. wntuf)
THEN
920 ELSE IF ( wntua )
THEN
924 IF ( .NOT. ( rsvec .OR. lsvec ) )
THEN
933 DO 1146 p = 1, min( n, nr )
934 a(p,p) = conjg(a(p,p))
936 a(q,p) = conjg(a(p,q))
937 IF ( q .LE. nr ) a(p,q) = czero
941 CALL zgesvd(
'N',
'N', n, nr, a, lda, s, u, ldu,
942 $ v, ldv, cwork, lcwork, rwork, info )
949 $
CALL zlaset(
'L', nr-1,nr-1, czero,czero, a(2,1), lda )
950 CALL zgesvd(
'N',
'N', nr, n, a, lda, s, u, ldu,
951 $ v, ldv, cwork, lcwork, rwork, info )
955 ELSE IF ( lsvec .AND. ( .NOT. rsvec) )
THEN
965 u(q,p) = conjg(a(p,q))
969 $
CALL zlaset(
'U', nr-1,nr-1, czero,czero, u(1,2), ldu )
973 CALL zgesvd(
'N',
'O', n, nr, u, ldu, s, u, ldu,
974 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
977 u(p,p) = conjg(u(p,p))
978 DO 1120 q = p + 1, nr
980 u(q,p) = conjg(u(p,q))
988 CALL zlacpy(
'U', nr, n, a, lda, u, ldu )
990 $
CALL zlaset(
'L', nr-1, nr-1, czero, czero, u(2,1), ldu )
993 CALL zgesvd(
'O',
'N', nr, n, u, ldu, s, u, ldu,
994 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1002 IF ( ( nr .LT. m ) .AND. ( .NOT.wntuf ) )
THEN
1003 CALL zlaset(
'A', m-nr, nr, czero, czero, u(nr+1,1), ldu)
1004 IF ( nr .LT. n1 )
THEN
1005 CALL zlaset(
'A',nr,n1-nr,czero,czero,u(1,nr+1), ldu )
1006 CALL zlaset(
'A',m-nr,n1-nr,czero,cone,
1007 $ u(nr+1,nr+1), ldu )
1015 $
CALL zunmqr(
'L',
'N', m, n1, n, a, lda, cwork, u,
1016 $ ldu, cwork(n+1), lcwork-n, ierr )
1017 IF ( rowprm .AND. .NOT.wntuf )
1018 $
CALL zlaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1020 ELSE IF ( rsvec .AND. ( .NOT. lsvec ) )
THEN
1029 v(q,p) = conjg(a(p,q))
1033 $
CALL zlaset(
'U', nr-1,nr-1, czero,czero, v(1,2), ldv )
1036 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1037 CALL zgesvd(
'O',
'N', n, nr, v, ldv, s, u, ldu,
1038 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1041 v(p,p) = conjg(v(p,p))
1042 DO 1122 q = p + 1, nr
1043 ctmp = conjg(v(q,p))
1044 v(q,p) = conjg(v(p,q))
1049 IF ( nr .LT. n )
THEN
1051 DO 1104 q = nr + 1, n
1052 v(p,q) = conjg(v(q,p))
1056 CALL zlapmt( .false., nr, n, v, ldv, iwork )
1063 CALL zlaset(
'G', n, n-nr, czero, czero, v(1,nr+1), ldv)
1064 CALL zgesvd(
'O',
'N', n, n, v, ldv, s, u, ldu,
1065 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1068 v(p,p) = conjg(v(p,p))
1069 DO 1124 q = p + 1, n
1070 ctmp = conjg(v(q,p))
1071 v(q,p) = conjg(v(p,q))
1075 CALL zlapmt( .false., n, n, v, ldv, iwork )
1081 CALL zlacpy(
'U', nr, n, a, lda, v, ldv )
1083 $
CALL zlaset(
'L', nr-1, nr-1, czero, czero, v(2,1), ldv )
1086 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1087 CALL zgesvd(
'N',
'O', nr, n, v, ldv, s, u, ldu,
1088 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1089 CALL zlapmt( .false., nr, n, v, ldv, iwork )
1097 CALL zlaset(
'G', n-nr, n, czero,czero, v(nr+1,1), ldv)
1098 CALL zgesvd(
'N',
'O', n, n, v, ldv, s, u, ldu,
1099 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1100 CALL zlapmt( .false., n, n, v, ldv, iwork )
1114 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1119 v(q,p) = conjg(a(p,q))
1123 $
CALL zlaset(
'U', nr-1,nr-1, czero,czero, v(1,2), ldv )
1128 CALL zgesvd(
'O',
'A', n, nr, v, ldv, s, v, ldv,
1129 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1132 v(p,p) = conjg(v(p,p))
1133 DO 1116 q = p + 1, nr
1134 ctmp = conjg(v(q,p))
1135 v(q,p) = conjg(v(p,q))
1139 IF ( nr .LT. n )
THEN
1142 v(p,q) = conjg(v(q,p))
1146 CALL zlapmt( .false., nr, n, v, ldv, iwork )
1149 u(p,p) = conjg(u(p,p))
1150 DO 1118 q = p + 1, nr
1151 ctmp = conjg(u(q,p))
1152 u(q,p) = conjg(u(p,q))
1157 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1158 CALL zlaset(
'A', m-nr,nr, czero,czero, u(nr+1,1), ldu)
1159 IF ( nr .LT. n1 )
THEN
1160 CALL zlaset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1161 CALL zlaset(
'A',m-nr,n1-nr,czero,cone,
1162 $ u(nr+1,nr+1), ldu )
1176 IF ( optratio*nr .GT. n )
THEN
1179 v(q,p) = conjg(a(p,q))
1183 $
CALL zlaset(
'U',nr-1,nr-1, czero,czero, v(1,2),ldv)
1185 CALL zlaset(
'A',n,n-nr,czero,czero,v(1,nr+1),ldv)
1186 CALL zgesvd(
'O',
'A', n, n, v, ldv, s, v, ldv,
1187 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1190 v(p,p) = conjg(v(p,p))
1191 DO 1114 q = p + 1, n
1192 ctmp = conjg(v(q,p))
1193 v(q,p) = conjg(v(p,q))
1197 CALL zlapmt( .false., n, n, v, ldv, iwork )
1202 u(p,p) = conjg(u(p,p))
1203 DO 1112 q = p + 1, n
1204 ctmp = conjg(u(q,p))
1205 u(q,p) = conjg(u(p,q))
1210 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1211 CALL zlaset(
'A',m-n,n,czero,czero,u(n+1,1),ldu)
1212 IF ( n .LT. n1 )
THEN
1213 CALL zlaset(
'A',n,n1-n,czero,czero,u(1,n+1),ldu)
1214 CALL zlaset(
'A',m-n,n1-n,czero,cone,
1223 u(q,nr+p) = conjg(a(p,q))
1227 $
CALL zlaset(
'U',nr-1,nr-1,czero,czero,u(1,nr+2),ldu)
1228 CALL zgeqrf( n, nr, u(1,nr+1), ldu, cwork(n+1),
1229 $ cwork(n+nr+1), lcwork-n-nr, ierr )
1232 v(q,p) = conjg(u(p,nr+q))
1235 CALL zlaset(
'U',nr-1,nr-1,czero,czero,v(1,2),ldv)
1236 CALL zgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1237 $ v,ldv, cwork(n+nr+1),lcwork-n-nr,rwork, info )
1238 CALL zlaset(
'A',n-nr,nr,czero,czero,v(nr+1,1),ldv)
1239 CALL zlaset(
'A',nr,n-nr,czero,czero,v(1,nr+1),ldv)
1240 CALL zlaset(
'A',n-nr,n-nr,czero,cone,v(nr+1,nr+1),ldv)
1241 CALL zunmqr(
'R',
'C', n, n, nr, u(1,nr+1), ldu,
1242 $ cwork(n+1),v,ldv,cwork(n+nr+1),lcwork-n-nr,ierr)
1243 CALL zlapmt( .false., n, n, v, ldv, iwork )
1246 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1247 CALL zlaset(
'A',m-nr,nr,czero,czero,u(nr+1,1),ldu)
1248 IF ( nr .LT. n1 )
THEN
1249 CALL zlaset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1250 CALL zlaset(
'A',m-nr,n1-nr,czero,cone,
1261 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1263 CALL zlacpy(
'U', nr, n, a, lda, v, ldv )
1265 $
CALL zlaset(
'L', nr-1,nr-1, czero,czero, v(2,1), ldv )
1268 CALL zgesvd(
'S',
'O', nr, n, v, ldv, s, u, ldu,
1269 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1270 CALL zlapmt( .false., nr, n, v, ldv, iwork )
1274 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1275 CALL zlaset(
'A', m-nr,nr, czero,czero, u(nr+1,1), ldu)
1276 IF ( nr .LT. n1 )
THEN
1277 CALL zlaset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1278 CALL zlaset(
'A',m-nr,n1-nr,czero,cone,
1279 $ u(nr+1,nr+1), ldu )
1293 IF ( optratio * nr .GT. n )
THEN
1294 CALL zlacpy(
'U', nr, n, a, lda, v, ldv )
1296 $
CALL zlaset(
'L', nr-1,nr-1, czero,czero, v(2,1),ldv)
1299 CALL zlaset(
'A', n-nr,n, czero,czero, v(nr+1,1),ldv)
1300 CALL zgesvd(
'S',
'O', n, n, v, ldv, s, u, ldu,
1301 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1302 CALL zlapmt( .false., n, n, v, ldv, iwork )
1308 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1309 CALL zlaset(
'A',m-n,n,czero,czero,u(n+1,1),ldu)
1310 IF ( n .LT. n1 )
THEN
1311 CALL zlaset(
'A',n,n1-n,czero,czero,u(1,n+1),ldu)
1312 CALL zlaset(
'A',m-n,n1-n,czero,cone,
1317 CALL zlacpy(
'U', nr, n, a, lda, u(nr+1,1), ldu )
1319 $
CALL zlaset(
'L',nr-1,nr-1,czero,czero,u(nr+2,1),ldu)
1320 CALL zgelqf( nr, n, u(nr+1,1), ldu, cwork(n+1),
1321 $ cwork(n+nr+1), lcwork-n-nr, ierr )
1322 CALL zlacpy(
'L',nr,nr,u(nr+1,1),ldu,v,ldv)
1324 $
CALL zlaset(
'U',nr-1,nr-1,czero,czero,v(1,2),ldv)
1325 CALL zgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1326 $ v, ldv, cwork(n+nr+1), lcwork-n-nr, rwork, info )
1327 CALL zlaset(
'A',n-nr,nr,czero,czero,v(nr+1,1),ldv)
1328 CALL zlaset(
'A',nr,n-nr,czero,czero,v(1,nr+1),ldv)
1329 CALL zlaset(
'A',n-nr,n-nr,czero,cone,v(nr+1,nr+1),ldv)
1330 CALL zunmlq(
'R',
'N',n,n,nr,u(nr+1,1),ldu,cwork(n+1),
1331 $ v, ldv, cwork(n+nr+1),lcwork-n-nr,ierr)
1332 CALL zlapmt( .false., n, n, v, ldv, iwork )
1335 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1336 CALL zlaset(
'A',m-nr,nr,czero,czero,u(nr+1,1),ldu)
1337 IF ( nr .LT. n1 )
THEN
1338 CALL zlaset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1339 CALL zlaset(
'A',m-nr,n1-nr,czero,cone,
1340 $ u(nr+1,nr+1), ldu )
1352 $
CALL zunmqr(
'L',
'N', m, n1, n, a, lda, cwork, u,
1353 $ ldu, cwork(n+1), lcwork-n, ierr )
1354 IF ( rowprm .AND. .NOT.wntuf )
1355 $
CALL zlaswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1363 DO 4001 q = p, 1, -1
1364 IF ( s(q) .GT. zero )
GO TO 4002
1371 IF ( nr .LT. n )
CALL dlaset(
'G', n-nr,1, zero,zero, s(nr+1), n )
1375 $
CALL dlascl(
'G',0,0, one,sqrt(dble(m)), nr,1, s, n, ierr )
1376 IF ( conda ) rwork(1) = sconda
subroutine xerbla(srname, info)
subroutine zgelqf(m, n, a, lda, tau, work, lwork, info)
ZGELQF
subroutine zgeqp3(m, n, a, lda, jpvt, tau, work, lwork, rwork, info)
ZGEQP3
subroutine zgeqrf(m, n, a, lda, tau, work, lwork, info)
ZGEQRF
subroutine zgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, rwork, info)
ZGESVD computes the singular value decomposition (SVD) for GE matrices
subroutine zgesvdq(joba, jobp, jobr, jobu, jobv, m, n, a, lda, s, u, ldu, v, ldv, numrank, iwork, liwork, cwork, lcwork, rwork, lrwork, info)
ZGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE...
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlapmt(forwrd, m, n, x, ldx, k)
ZLAPMT performs a forward or backward permutation of the columns of a matrix.
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
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 zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zlaswp(n, a, lda, k1, k2, ipiv, incx)
ZLASWP performs a series of row interchanges on a general rectangular matrix.
subroutine zpocon(uplo, n, a, lda, anorm, rcond, work, rwork, info)
ZPOCON
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zunmlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMLQ
subroutine zunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMQR