410 SUBROUTINE cgesvdq( 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 A( LDA, * ), U( LDU, * ), V( LDV, * ), CWORK( * )
421 REAL S( * ), RWORK( * )
428 PARAMETER ( ZERO = 0.0e0, one = 1.0e0 )
430 parameter( czero = ( 0.0e0, 0.0e0 ), cone = ( 1.0e0, 0.0e0 ) )
433 INTEGER IERR, NR, N1, OPTRATIO, p, q
434 INTEGER LWCON, LWQP3, LWRK_CGELQF, LWRK_CGESVD, LWRK_CGESVD2,
435 $ lwrk_cgeqp3, lwrk_cgeqrf, lwrk_cunmlq, lwrk_cunmqr,
436 $ lwrk_cunmqr2, 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 REAL BIG, EPSLN, RTMP, SCONDA, SFMIN
457 REAL CLANGE, SCNRM2, SLAMCH
458 EXTERNAL clange, lsame, isamax, scnrm2, slamch
461 INTRINSIC abs, conjg, max, min, real, 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
538 IF ( wntus .OR. wntur )
THEN
540 ELSE IF ( wntua )
THEN
546 lwsvd = max( 3 * n, 1 )
548 CALL cgeqp3( m, n, a, lda, iwork, cdummy, cdummy, -1,
550 lwrk_cgeqp3 = int( cdummy(1) )
551 IF ( wntus .OR. wntur )
THEN
552 CALL cunmqr(
'L',
'N', m, n, n, a, lda, cdummy, u,
553 $ ldu, cdummy, -1, ierr )
554 lwrk_cunmqr = int( cdummy(1) )
555 ELSE IF ( wntua )
THEN
556 CALL cunmqr(
'L',
'N', m, m, n, a, lda, cdummy, u,
557 $ ldu, cdummy, -1, ierr )
558 lwrk_cunmqr = int( cdummy(1) )
565 IF ( .NOT. (lsvec .OR. rsvec ))
THEN
569 minwrk = max( n+lwqp3, lwcon, lwsvd )
571 minwrk = max( n+lwqp3, lwsvd )
574 CALL cgesvd(
'N',
'N', n, n, a, lda, s, u, ldu,
575 $ v, ldv, cdummy, -1, rdummy, ierr )
576 lwrk_cgesvd = int( cdummy(1) )
578 optwrk = max( n+lwrk_cgeqp3, n+lwcon, lwrk_cgesvd )
580 optwrk = max( n+lwrk_cgeqp3, lwrk_cgesvd )
583 ELSE IF ( lsvec .AND. (.NOT.rsvec) )
THEN
587 minwrk = n + max( lwqp3, lwcon, lwsvd, lwunq )
589 minwrk = n + max( lwqp3, lwsvd, lwunq )
593 CALL cgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
594 $ v, ldv, cdummy, -1, rdummy, ierr )
596 CALL cgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
597 $ v, ldv, cdummy, -1, rdummy, ierr )
599 lwrk_cgesvd = int( cdummy(1) )
601 optwrk = n + max( lwrk_cgeqp3, lwcon, lwrk_cgesvd,
604 optwrk = n + max( lwrk_cgeqp3, lwrk_cgesvd,
608 ELSE IF ( rsvec .AND. (.NOT.lsvec) )
THEN
612 minwrk = n + max( lwqp3, lwcon, lwsvd )
614 minwrk = n + max( lwqp3, lwsvd )
618 CALL cgesvd(
'O',
'N', n, n, a, lda, s, u, ldu,
619 $ v, ldv, cdummy, -1, rdummy, ierr )
621 CALL cgesvd(
'N',
'O', n, n, a, lda, s, u, ldu,
622 $ v, ldv, cdummy, -1, rdummy, ierr )
624 lwrk_cgesvd = int( cdummy(1) )
626 optwrk = n + max( lwrk_cgeqp3, lwcon, lwrk_cgesvd )
628 optwrk = n + max( lwrk_cgeqp3, lwrk_cgesvd )
635 minwrk = max( lwqp3, lwsvd, lwunq )
636 IF ( conda ) minwrk = max( minwrk, lwcon )
640 lwqrf = max( n/2, 1 )
642 lwsvd2 = max( 3 * (n/2), 1 )
644 minwrk2 = max( lwqp3, n/2+lwqrf, n/2+lwsvd2,
645 $ n/2+lwunq2, lwunq )
646 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
647 minwrk2 = n + minwrk2
648 minwrk = max( minwrk, minwrk2 )
651 minwrk = max( lwqp3, lwsvd, lwunq )
652 IF ( conda ) minwrk = max( minwrk, lwcon )
656 lwlqf = max( n/2, 1 )
657 lwsvd2 = max( 3 * (n/2), 1 )
658 lwunlq = max( n , 1 )
659 minwrk2 = max( lwqp3, n/2+lwlqf, n/2+lwsvd2,
660 $ n/2+lwunlq, lwunq )
661 IF ( conda ) minwrk2 = max( minwrk2, lwcon )
662 minwrk2 = n + minwrk2
663 minwrk = max( minwrk, minwrk2 )
668 CALL cgesvd(
'O',
'A', n, n, a, lda, s, u, ldu,
669 $ v, ldv, cdummy, -1, rdummy, ierr )
670 lwrk_cgesvd = int( cdummy(1) )
671 optwrk = max(lwrk_cgeqp3,lwrk_cgesvd,lwrk_cunmqr)
672 IF ( conda ) optwrk = max( optwrk, lwcon )
675 CALL cgeqrf(n,n/2,u,ldu,cdummy,cdummy,-1,ierr)
676 lwrk_cgeqrf = int( cdummy(1) )
677 CALL cgesvd(
'S',
'O', n/2,n/2, v,ldv, s, u,ldu,
678 $ v, ldv, cdummy, -1, rdummy, ierr )
679 lwrk_cgesvd2 = int( cdummy(1) )
680 CALL cunmqr(
'R',
'C', n, n, n/2, u, ldu, cdummy,
681 $ v, ldv, cdummy, -1, ierr )
682 lwrk_cunmqr2 = int( cdummy(1) )
683 optwrk2 = max( lwrk_cgeqp3, n/2+lwrk_cgeqrf,
684 $ n/2+lwrk_cgesvd2, n/2+lwrk_cunmqr2 )
685 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
686 optwrk2 = n + optwrk2
687 optwrk = max( optwrk, optwrk2 )
690 CALL cgesvd(
'S',
'O', n, n, a, lda, s, u, ldu,
691 $ v, ldv, cdummy, -1, rdummy, ierr )
692 lwrk_cgesvd = int( cdummy(1) )
693 optwrk = max(lwrk_cgeqp3,lwrk_cgesvd,lwrk_cunmqr)
694 IF ( conda ) optwrk = max( optwrk, lwcon )
697 CALL cgelqf(n/2,n,u,ldu,cdummy,cdummy,-1,ierr)
698 lwrk_cgelqf = int( cdummy(1) )
699 CALL cgesvd(
'S',
'O', n/2,n/2, v, ldv, s, u, ldu,
700 $ v, ldv, cdummy, -1, rdummy, ierr )
701 lwrk_cgesvd2 = int( cdummy(1) )
702 CALL cunmlq(
'R',
'N', n, n, n/2, u, ldu, cdummy,
703 $ v, ldv, cdummy,-1,ierr )
704 lwrk_cunmlq = int( cdummy(1) )
705 optwrk2 = max( lwrk_cgeqp3, n/2+lwrk_cgelqf,
706 $ n/2+lwrk_cgesvd2, n/2+lwrk_cunmlq )
707 IF ( conda ) optwrk2 = max( optwrk2, lwcon )
708 optwrk2 = n + optwrk2
709 optwrk = max( optwrk, optwrk2 )
715 minwrk = max( 2, minwrk )
716 optwrk = max( 2, optwrk )
717 IF ( lcwork .LT. minwrk .AND. (.NOT.lquery) ) info = -19
721 IF (info .EQ. 0 .AND. lrwork .LT. rminwrk .AND. .NOT. lquery)
THEN
725 CALL xerbla(
'CGESVDQ', -info )
727 ELSE IF ( lquery )
THEN
740 IF( ( m.EQ.0 ) .OR. ( n.EQ.0 ) )
THEN
754 rwork(p) = clange(
'M', 1, n, a(p,1), lda, rdummy )
756 IF ( ( rwork(p) .NE. rwork(p) ) .OR.
757 $ ( (rwork(p)*zero) .NE. zero ) )
THEN
759 CALL xerbla(
'CGESVDQ', -info )
764 q = isamax( m-p+1, rwork(p), 1 ) + p - 1
773 IF ( rwork(1) .EQ. zero )
THEN
776 CALL slaset(
'G', n, 1, zero, zero, s, n )
777 IF ( wntus )
CALL claset(
'G', m, n, czero, cone, u, ldu)
778 IF ( wntua )
CALL claset(
'G', m, m, czero, cone, u, ldu)
779 IF ( wntva )
CALL claset(
'G', n, n, czero, cone, v, ldv)
781 CALL claset(
'G', n, 1, czero, czero, cwork, n )
782 CALL claset(
'G', m, n, czero, cone, u, ldu )
788 DO 5002 p = n + 1, n + m - 1
792 IF ( conda ) rwork(1) = -1
797 IF ( rwork(1) .GT. big / sqrt(real(m)) )
THEN
800 CALL clascl(
'G',0,0,sqrt(real(m)),one, m,n, a,lda, ierr)
803 CALL claswp( n, a, lda, 1, m-1, iwork(n+1), 1 )
811 IF ( .NOT.rowprm )
THEN
812 rtmp = clange(
'M', m, n, a, lda, rwork )
813 IF ( ( rtmp .NE. rtmp ) .OR.
814 $ ( (rtmp*zero) .NE. zero ) )
THEN
816 CALL xerbla(
'CGESVDQ', -info )
819 IF ( rtmp .GT. big / sqrt(real(m)) )
THEN
822 CALL clascl(
'G',0,0, sqrt(real(m)),one, m,n, a,lda, ierr)
836 CALL cgeqp3( m, n, a, lda, iwork, cwork, cwork(n+1), lcwork-n,
855 rtmp = sqrt(real(n))*epsln
857 IF ( abs(a(p,p)) .LT. (rtmp*abs(a(1,1))) )
GO TO 3002
862 ELSEIF ( acclm )
THEN
871 IF ( ( abs(a(p,p)) .LT. (epsln*abs(a(p-1,p-1))) ) .OR.
872 $ ( abs(a(p,p)) .LT. sfmin ) )
GO TO 3402
884 IF ( abs(a(p,p)) .EQ. zero )
GO TO 3502
893 CALL clacpy(
'U', n, n, a, lda, v, ldv )
900 rtmp = scnrm2( p, v(1,p), 1 )
901 CALL csscal( p, one/rtmp, v(1,p), 1 )
903 IF ( .NOT. ( lsvec .OR. rsvec ) )
THEN
904 CALL cpocon(
'U', nr, v, ldv, one, rtmp,
905 $ cwork, rwork, ierr )
907 CALL cpocon(
'U', nr, v, ldv, one, rtmp,
908 $ cwork(n+1), rwork, ierr )
910 sconda = one / sqrt(rtmp)
920 ELSE IF ( wntus .OR. wntuf)
THEN
922 ELSE IF ( wntua )
THEN
926 IF ( .NOT. ( rsvec .OR. lsvec ) )
THEN
935 DO 1146 p = 1, min( n, nr )
936 a(p,p) = conjg(a(p,p))
938 a(q,p) = conjg(a(p,q))
939 IF ( q .LE. nr ) a(p,q) = czero
943 CALL cgesvd(
'N',
'N', n, nr, a, lda, s, u, ldu,
944 $ v, ldv, cwork, lcwork, rwork, info )
951 $
CALL claset(
'L', nr-1,nr-1, czero,czero, a(2,1), lda )
952 CALL cgesvd(
'N',
'N', nr, n, a, lda, s, u, ldu,
953 $ v, ldv, cwork, lcwork, rwork, info )
957 ELSE IF ( lsvec .AND. ( .NOT. rsvec) )
THEN
967 u(q,p) = conjg(a(p,q))
971 $
CALL claset(
'U', nr-1,nr-1, czero,czero, u(1,2), ldu )
975 CALL cgesvd(
'N',
'O', n, nr, u, ldu, s, u, ldu,
976 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
979 u(p,p) = conjg(u(p,p))
980 DO 1120 q = p + 1, nr
982 u(q,p) = conjg(u(p,q))
990 CALL clacpy(
'U', nr, n, a, lda, u, ldu )
992 $
CALL claset(
'L', nr-1, nr-1, czero, czero, u(2,1), ldu )
995 CALL cgesvd(
'O',
'N', nr, n, u, ldu, s, u, ldu,
996 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1004 IF ( ( nr .LT. m ) .AND. ( .NOT.wntuf ) )
THEN
1005 CALL claset(
'A', m-nr, nr, czero, czero, u(nr+1,1), ldu)
1006 IF ( nr .LT. n1 )
THEN
1007 CALL claset(
'A',nr,n1-nr,czero,czero,u(1,nr+1), ldu )
1008 CALL claset(
'A',m-nr,n1-nr,czero,cone,
1009 $ u(nr+1,nr+1), ldu )
1017 $
CALL cunmqr(
'L',
'N', m, n1, n, a, lda, cwork, u,
1018 $ ldu, cwork(n+1), lcwork-n, ierr )
1019 IF ( rowprm .AND. .NOT.wntuf )
1020 $
CALL claswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1022 ELSE IF ( rsvec .AND. ( .NOT. lsvec ) )
THEN
1031 v(q,p) = conjg(a(p,q))
1035 $
CALL claset(
'U', nr-1,nr-1, czero,czero, v(1,2), ldv )
1038 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1039 CALL cgesvd(
'O',
'N', n, nr, v, ldv, s, u, ldu,
1040 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1043 v(p,p) = conjg(v(p,p))
1044 DO 1122 q = p + 1, nr
1045 ctmp = conjg(v(q,p))
1046 v(q,p) = conjg(v(p,q))
1051 IF ( nr .LT. n )
THEN
1053 DO 1104 q = nr + 1, n
1054 v(p,q) = conjg(v(q,p))
1058 CALL clapmt( .false., nr, n, v, ldv, iwork )
1065 CALL claset(
'G', n, n-nr, czero, czero, v(1,nr+1), ldv)
1066 CALL cgesvd(
'O',
'N', n, n, v, ldv, s, u, ldu,
1067 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1070 v(p,p) = conjg(v(p,p))
1071 DO 1124 q = p + 1, n
1072 ctmp = conjg(v(q,p))
1073 v(q,p) = conjg(v(p,q))
1077 CALL clapmt( .false., n, n, v, ldv, iwork )
1083 CALL clacpy(
'U', nr, n, a, lda, v, ldv )
1085 $
CALL claset(
'L', nr-1, nr-1, czero, czero, v(2,1), ldv )
1088 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1089 CALL cgesvd(
'N',
'O', nr, n, v, ldv, s, u, ldu,
1090 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1091 CALL clapmt( .false., nr, n, v, ldv, iwork )
1099 CALL claset(
'G', n-nr, n, czero,czero, v(nr+1,1), ldv)
1100 CALL cgesvd(
'N',
'O', n, n, v, ldv, s, u, ldu,
1101 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1102 CALL clapmt( .false., n, n, v, ldv, iwork )
1116 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1121 v(q,p) = conjg(a(p,q))
1125 $
CALL claset(
'U', nr-1,nr-1, czero,czero, v(1,2), ldv )
1130 CALL cgesvd(
'O',
'A', n, nr, v, ldv, s, v, ldv,
1131 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1134 v(p,p) = conjg(v(p,p))
1135 DO 1116 q = p + 1, nr
1136 ctmp = conjg(v(q,p))
1137 v(q,p) = conjg(v(p,q))
1141 IF ( nr .LT. n )
THEN
1144 v(p,q) = conjg(v(q,p))
1148 CALL clapmt( .false., nr, n, v, ldv, iwork )
1151 u(p,p) = conjg(u(p,p))
1152 DO 1118 q = p + 1, nr
1153 ctmp = conjg(u(q,p))
1154 u(q,p) = conjg(u(p,q))
1159 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1160 CALL claset(
'A', m-nr,nr, czero,czero, u(nr+1,1), ldu)
1161 IF ( nr .LT. n1 )
THEN
1162 CALL claset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1163 CALL claset(
'A',m-nr,n1-nr,czero,cone,
1164 $ u(nr+1,nr+1), ldu )
1178 IF ( optratio*nr .GT. n )
THEN
1181 v(q,p) = conjg(a(p,q))
1185 $
CALL claset(
'U',nr-1,nr-1, czero,czero, v(1,2),ldv)
1187 CALL claset(
'A',n,n-nr,czero,czero,v(1,nr+1),ldv)
1188 CALL cgesvd(
'O',
'A', n, n, v, ldv, s, v, ldv,
1189 $ u, ldu, cwork(n+1), lcwork-n, rwork, info )
1192 v(p,p) = conjg(v(p,p))
1193 DO 1114 q = p + 1, n
1194 ctmp = conjg(v(q,p))
1195 v(q,p) = conjg(v(p,q))
1199 CALL clapmt( .false., n, n, v, ldv, iwork )
1204 u(p,p) = conjg(u(p,p))
1205 DO 1112 q = p + 1, n
1206 ctmp = conjg(u(q,p))
1207 u(q,p) = conjg(u(p,q))
1212 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1213 CALL claset(
'A',m-n,n,czero,czero,u(n+1,1),ldu)
1214 IF ( n .LT. n1 )
THEN
1215 CALL claset(
'A',n,n1-n,czero,czero,u(1,n+1),ldu)
1216 CALL claset(
'A',m-n,n1-n,czero,cone,
1225 u(q,nr+p) = conjg(a(p,q))
1229 $
CALL claset(
'U',nr-1,nr-1,czero,czero,u(1,nr+2),ldu)
1230 CALL cgeqrf( n, nr, u(1,nr+1), ldu, cwork(n+1),
1231 $ cwork(n+nr+1), lcwork-n-nr, ierr )
1234 v(q,p) = conjg(u(p,nr+q))
1237 CALL claset(
'U',nr-1,nr-1,czero,czero,v(1,2),ldv)
1238 CALL cgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1239 $ v,ldv, cwork(n+nr+1),lcwork-n-nr,rwork, info )
1240 CALL claset(
'A',n-nr,nr,czero,czero,v(nr+1,1),ldv)
1241 CALL claset(
'A',nr,n-nr,czero,czero,v(1,nr+1),ldv)
1242 CALL claset(
'A',n-nr,n-nr,czero,cone,v(nr+1,nr+1),ldv)
1243 CALL cunmqr(
'R',
'C', n, n, nr, u(1,nr+1), ldu,
1244 $ cwork(n+1),v,ldv,cwork(n+nr+1),lcwork-n-nr,ierr)
1245 CALL clapmt( .false., n, n, v, ldv, iwork )
1248 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1249 CALL claset(
'A',m-nr,nr,czero,czero,u(nr+1,1),ldu)
1250 IF ( nr .LT. n1 )
THEN
1251 CALL claset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1252 CALL claset(
'A',m-nr,n1-nr,czero,cone,
1263 IF ( wntvr .OR. ( nr .EQ. n ) )
THEN
1265 CALL clacpy(
'U', nr, n, a, lda, v, ldv )
1267 $
CALL claset(
'L', nr-1,nr-1, czero,czero, v(2,1), ldv )
1270 CALL cgesvd(
'S',
'O', nr, n, v, ldv, s, u, ldu,
1271 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1272 CALL clapmt( .false., nr, n, v, ldv, iwork )
1276 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1277 CALL claset(
'A', m-nr,nr, czero,czero, u(nr+1,1), ldu)
1278 IF ( nr .LT. n1 )
THEN
1279 CALL claset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1280 CALL claset(
'A',m-nr,n1-nr,czero,cone,
1281 $ u(nr+1,nr+1), ldu )
1295 IF ( optratio * nr .GT. n )
THEN
1296 CALL clacpy(
'U', nr, n, a, lda, v, ldv )
1298 $
CALL claset(
'L', nr-1,nr-1, czero,czero, v(2,1),ldv)
1301 CALL claset(
'A', n-nr,n, czero,czero, v(nr+1,1),ldv)
1302 CALL cgesvd(
'S',
'O', n, n, v, ldv, s, u, ldu,
1303 $ v, ldv, cwork(n+1), lcwork-n, rwork, info )
1304 CALL clapmt( .false., n, n, v, ldv, iwork )
1310 IF ( ( n .LT. m ) .AND. .NOT.(wntuf))
THEN
1311 CALL claset(
'A',m-n,n,czero,czero,u(n+1,1),ldu)
1312 IF ( n .LT. n1 )
THEN
1313 CALL claset(
'A',n,n1-n,czero,czero,u(1,n+1),ldu)
1314 CALL claset(
'A',m-n,n1-n,czero,cone,
1319 CALL clacpy(
'U', nr, n, a, lda, u(nr+1,1), ldu )
1321 $
CALL claset(
'L',nr-1,nr-1,czero,czero,u(nr+2,1),ldu)
1322 CALL cgelqf( nr, n, u(nr+1,1), ldu, cwork(n+1),
1323 $ cwork(n+nr+1), lcwork-n-nr, ierr )
1324 CALL clacpy(
'L',nr,nr,u(nr+1,1),ldu,v,ldv)
1326 $
CALL claset(
'U',nr-1,nr-1,czero,czero,v(1,2),ldv)
1327 CALL cgesvd(
'S',
'O', nr, nr, v, ldv, s, u, ldu,
1328 $ v, ldv, cwork(n+nr+1), lcwork-n-nr, rwork, info )
1329 CALL claset(
'A',n-nr,nr,czero,czero,v(nr+1,1),ldv)
1330 CALL claset(
'A',nr,n-nr,czero,czero,v(1,nr+1),ldv)
1331 CALL claset(
'A',n-nr,n-nr,czero,cone,v(nr+1,nr+1),ldv)
1332 CALL cunmlq(
'R',
'N',n,n,nr,u(nr+1,1),ldu,cwork(n+1),
1333 $ v, ldv, cwork(n+nr+1),lcwork-n-nr,ierr)
1334 CALL clapmt( .false., n, n, v, ldv, iwork )
1337 IF ( ( nr .LT. m ) .AND. .NOT.(wntuf))
THEN
1338 CALL claset(
'A',m-nr,nr,czero,czero,u(nr+1,1),ldu)
1339 IF ( nr .LT. n1 )
THEN
1340 CALL claset(
'A',nr,n1-nr,czero,czero,u(1,nr+1),ldu)
1341 CALL claset(
'A',m-nr,n1-nr,czero,cone,
1342 $ u(nr+1,nr+1), ldu )
1354 $
CALL cunmqr(
'L',
'N', m, n1, n, a, lda, cwork, u,
1355 $ ldu, cwork(n+1), lcwork-n, ierr )
1356 IF ( rowprm .AND. .NOT.wntuf )
1357 $
CALL claswp( n1, u, ldu, 1, m-1, iwork(n+1), -1 )
1365 DO 4001 q = p, 1, -1
1366 IF ( s(q) .GT. zero )
GO TO 4002
1373 IF ( nr .LT. n )
CALL slaset(
'G', n-nr,1, zero,zero, s(nr+1), n )
1377 $
CALL slascl(
'G',0,0, one,sqrt(real(m)), nr,1, s, n, ierr )
1378 IF ( conda ) rwork(1) = sconda
subroutine xerbla(srname, info)
subroutine cgelqf(m, n, a, lda, tau, work, lwork, info)
CGELQF
subroutine cgeqp3(m, n, a, lda, jpvt, tau, work, lwork, rwork, info)
CGEQP3
subroutine cgeqrf(m, n, a, lda, tau, work, lwork, info)
CGEQRF
subroutine cgesvd(jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, rwork, info)
CGESVD computes the singular value decomposition (SVD) for GE matrices
subroutine cgesvdq(joba, jobp, jobr, jobu, jobv, m, n, a, lda, s, u, ldu, v, ldv, numrank, iwork, liwork, cwork, lcwork, rwork, lrwork, info)
CGESVDQ computes the singular value decomposition (SVD) with a QR-Preconditioned QR SVD Method for GE...
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clapmt(forwrd, m, n, x, ldx, k)
CLAPMT performs a forward or backward permutation of the columns of a matrix.
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
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 claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine claswp(n, a, lda, k1, k2, ipiv, incx)
CLASWP performs a series of row interchanges on a general rectangular matrix.
subroutine cpocon(uplo, n, a, lda, anorm, rcond, work, rwork, info)
CPOCON
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cunmlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMLQ
subroutine cunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
CUNMQR