259 SUBROUTINE cggsvp( JOBU, JOBV, JOBQ, M, P, N, A, LDA, B, LDB,
260 $ TOLA, TOLB, K, L, U, LDU, V, LDV, Q, LDQ,
261 $ IWORK, RWORK, TAU, WORK, INFO )
268 CHARACTER jobq, jobu, jobv
269 INTEGER info, k, l, lda, ldb, ldq, ldu, ldv, m, n, p
275 COMPLEX a( lda, * ), b( ldb, * ), q( ldq, * ),
276 $ tau( * ), u( ldu, * ), v( ldv, * ), work( * )
283 parameter( czero = ( 0.0e+0, 0.0e+0 ),
284 $ cone = ( 1.0e+0, 0.0e+0 ) )
287 LOGICAL forwrd, wantq, wantu, wantv
300 INTRINSIC abs, aimag, max, min, real
306 cabs1( t ) = abs(
REAL( T ) ) + abs( aimag( t ) )
312 wantu =
lsame( jobu,
'U' )
313 wantv =
lsame( jobv,
'V' )
314 wantq =
lsame( jobq,
'Q' )
318 IF( .NOT.( wantu .OR.
lsame( jobu,
'N' ) ) )
THEN 320 ELSE IF( .NOT.( wantv .OR.
lsame( jobv,
'N' ) ) )
THEN 322 ELSE IF( .NOT.( wantq .OR.
lsame( jobq,
'N' ) ) )
THEN 324 ELSE IF( m.LT.0 )
THEN 326 ELSE IF( p.LT.0 )
THEN 328 ELSE IF( n.LT.0 )
THEN 330 ELSE IF( lda.LT.max( 1, m ) )
THEN 332 ELSE IF( ldb.LT.max( 1, p ) )
THEN 334 ELSE IF( ldu.LT.1 .OR. ( wantu .AND. ldu.LT.m ) )
THEN 336 ELSE IF( ldv.LT.1 .OR. ( wantv .AND. ldv.LT.p ) )
THEN 338 ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.n ) )
THEN 342 CALL xerbla(
'CGGSVP', -info )
352 CALL cgeqpf( p, n, b, ldb, iwork, tau, work, rwork, info )
356 CALL clapmt( forwrd, m, n, a, lda, iwork )
361 DO 20 i = 1, min( p, n )
362 IF( cabs1( b( i, i ) ).GT.tolb )
370 CALL claset(
'Full', p, p, czero, czero, v, ldv )
372 $
CALL clacpy(
'Lower', p-1, n, b( 2, 1 ), ldb, v( 2, 1 ),
374 CALL cung2r( p, p, min( p, n ), v, ldv, tau, work, info )
385 $
CALL claset(
'Full', p-l, n, czero, czero, b( l+1, 1 ), ldb )
391 CALL claset(
'Full', n, n, czero, cone, q, ldq )
392 CALL clapmt( forwrd, n, n, q, ldq, iwork )
395 IF( p.GE.l .AND. n.NE.l )
THEN 399 CALL cgerq2( l, n, b, ldb, tau, work, info )
403 CALL cunmr2(
'Right',
'Conjugate transpose', m, n, l, b, ldb,
404 $ tau, a, lda, work, info )
409 CALL cunmr2(
'Right',
'Conjugate transpose', n, n, l, b,
410 $ ldb, tau, q, ldq, work, info )
415 CALL claset(
'Full', l, n-l, czero, czero, b, ldb )
416 DO 60 j = n - l + 1, n
417 DO 50 i = j - n + l + 1, l
435 CALL cgeqpf( m, n-l, a, lda, iwork, tau, work, rwork, info )
440 DO 80 i = 1, min( m, n-l )
441 IF( cabs1( a( i, i ) ).GT.tola )
447 CALL cunm2r(
'Left',
'Conjugate transpose', m, l, min( m, n-l ),
448 $ a, lda, tau, a( 1, n-l+1 ), lda, work, info )
454 CALL claset(
'Full', m, m, czero, czero, u, ldu )
456 $
CALL clacpy(
'Lower', m-1, n-l, a( 2, 1 ), lda, u( 2, 1 ),
458 CALL cung2r( m, m, min( m, n-l ), u, ldu, tau, work, info )
465 CALL clapmt( forwrd, n, n-l, q, ldq, iwork )
477 $
CALL claset(
'Full', m-k, n-l, czero, czero, a( k+1, 1 ), lda )
483 CALL cgerq2( k, n-l, a, lda, tau, work, info )
489 CALL cunmr2(
'Right',
'Conjugate transpose', n, n-l, k, a,
490 $ lda, tau, q, ldq, work, info )
495 CALL claset(
'Full', k, n-l-k, czero, czero, a, lda )
496 DO 120 j = n - l - k + 1, n - l
497 DO 110 i = j - n + l + k + 1, k
508 CALL cgeqr2( m-k, l, a( k+1, n-l+1 ), lda, tau, work, info )
514 CALL cunm2r(
'Right',
'No transpose', m, m-k, min( m-k, l ),
515 $ a( k+1, n-l+1 ), lda, tau, u( 1, k+1 ), ldu,
521 DO 140 j = n - l + 1, n
522 DO 130 i = j - n + k + l + 1, m
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
logical function lsame(CA, CB)
LSAME
subroutine cgeqr2(M, N, A, LDA, TAU, WORK, INFO)
CGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm...
subroutine cunmr2(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, INFO)
CUNMR2 multiplies a general matrix by the unitary matrix from a RQ factorization determined by cgerqf...
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine cung2r(M, N, K, A, LDA, TAU, WORK, INFO)
CUNG2R
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 cgerq2(M, N, A, LDA, TAU, WORK, INFO)
CGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm...
subroutine cunm2r(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, INFO)
CUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...
subroutine clapmt(FORWRD, M, N, X, LDX, K)
CLAPMT performs a forward or backward permutation of the columns of a matrix.