LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zggsvp()

subroutine zggsvp ( character jobu,
character jobv,
character jobq,
integer m,
integer p,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
complex*16, dimension( ldb, * ) b,
integer ldb,
double precision tola,
double precision tolb,
integer k,
integer l,
complex*16, dimension( ldu, * ) u,
integer ldu,
complex*16, dimension( ldv, * ) v,
integer ldv,
complex*16, dimension( ldq, * ) q,
integer ldq,
integer, dimension( * ) iwork,
double precision, dimension( * ) rwork,
complex*16, dimension( * ) tau,
complex*16, dimension( * ) work,
integer info )

ZGGSVP

Download ZGGSVP + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> This routine is deprecated and has been replaced by routine ZGGSVP3.
!>
!> ZGGSVP computes unitary matrices U, V and Q such that
!>
!>                    N-K-L  K    L
!>  U**H*A*Q =     K ( 0    A12  A13 )  if M-K-L >= 0;
!>                 L ( 0     0   A23 )
!>             M-K-L ( 0     0    0  )
!>
!>                  N-K-L  K    L
!>         =     K ( 0    A12  A13 )  if M-K-L < 0;
!>             M-K ( 0     0   A23 )
!>
!>                  N-K-L  K    L
!>  V**H*B*Q =   L ( 0     0   B13 )
!>             P-L ( 0     0    0  )
!>
!> where the K-by-K matrix A12 and L-by-L matrix B13 are nonsingular
!> upper triangular; A23 is L-by-L upper triangular if M-K-L >= 0,
!> otherwise A23 is (M-K)-by-L upper trapezoidal.  K+L = the effective
!> numerical rank of the (M+P)-by-N matrix (A**H,B**H)**H.
!>
!> This decomposition is the preprocessing step for computing the
!> Generalized Singular Value Decomposition (GSVD), see subroutine
!> ZGGSVD.
!> 
Parameters
[in]JOBU
!>          JOBU is CHARACTER*1
!>          = 'U':  Unitary matrix U is computed;
!>          = 'N':  U is not computed.
!> 
[in]JOBV
!>          JOBV is CHARACTER*1
!>          = 'V':  Unitary matrix V is computed;
!>          = 'N':  V is not computed.
!> 
[in]JOBQ
!>          JOBQ is CHARACTER*1
!>          = 'Q':  Unitary matrix Q is computed;
!>          = 'N':  Q is not computed.
!> 
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]P
!>          P is INTEGER
!>          The number of rows of the matrix B.  P >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrices A and B.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the M-by-N matrix A.
!>          On exit, A contains the triangular (or trapezoidal) matrix
!>          described in the Purpose section.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A. LDA >= max(1,M).
!> 
[in,out]B
!>          B is COMPLEX*16 array, dimension (LDB,N)
!>          On entry, the P-by-N matrix B.
!>          On exit, B contains the triangular matrix described in
!>          the Purpose section.
!> 
[in]LDB
!>          LDB is INTEGER
!>          The leading dimension of the array B. LDB >= max(1,P).
!> 
[in]TOLA
!>          TOLA is DOUBLE PRECISION
!> 
[in]TOLB
!>          TOLB is DOUBLE PRECISION
!>
!>          TOLA and TOLB are the thresholds to determine the effective
!>          numerical rank of matrix B and a subblock of A. Generally,
!>          they are set to
!>             TOLA = MAX(M,N)*norm(A)*MAZHEPS,
!>             TOLB = MAX(P,N)*norm(B)*MAZHEPS.
!>          The size of TOLA and TOLB may affect the size of backward
!>          errors of the decomposition.
!> 
[out]K
!>          K is INTEGER
!> 
[out]L
!>          L is INTEGER
!>
!>          On exit, K and L specify the dimension of the subblocks
!>          described in Purpose section.
!>          K + L = effective numerical rank of (A**H,B**H)**H.
!> 
[out]U
!>          U is COMPLEX*16 array, dimension (LDU,M)
!>          If JOBU = 'U', U contains the unitary matrix U.
!>          If JOBU = 'N', U is not referenced.
!> 
[in]LDU
!>          LDU is INTEGER
!>          The leading dimension of the array U. LDU >= max(1,M) if
!>          JOBU = 'U'; LDU >= 1 otherwise.
!> 
[out]V
!>          V is COMPLEX*16 array, dimension (LDV,P)
!>          If JOBV = 'V', V contains the unitary matrix V.
!>          If JOBV = 'N', V is not referenced.
!> 
[in]LDV
!>          LDV is INTEGER
!>          The leading dimension of the array V. LDV >= max(1,P) if
!>          JOBV = 'V'; LDV >= 1 otherwise.
!> 
[out]Q
!>          Q is COMPLEX*16 array, dimension (LDQ,N)
!>          If JOBQ = 'Q', Q contains the unitary matrix Q.
!>          If JOBQ = 'N', Q is not referenced.
!> 
[in]LDQ
!>          LDQ is INTEGER
!>          The leading dimension of the array Q. LDQ >= max(1,N) if
!>          JOBQ = 'Q'; LDQ >= 1 otherwise.
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N)
!> 
[out]RWORK
!>          RWORK is DOUBLE PRECISION array, dimension (2*N)
!> 
[out]TAU
!>          TAU is COMPLEX*16 array, dimension (N)
!> 
[out]WORK
!>          WORK is COMPLEX*16 array, dimension (max(3*N,M,P))
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  The subroutine uses LAPACK subroutine ZGEQPF for the QR factorization
!>  with column pivoting to detect the effective numerical rank of the
!>  a matrix. It may be replaced by a better rank determination strategy.
!> 

Definition at line 260 of file zggsvp.f.

263*
264* -- LAPACK computational routine --
265* -- LAPACK is a software package provided by Univ. of Tennessee, --
266* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
267*
268* .. Scalar Arguments ..
269 CHARACTER JOBQ, JOBU, JOBV
270 INTEGER INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P
271 DOUBLE PRECISION TOLA, TOLB
272* ..
273* .. Array Arguments ..
274 INTEGER IWORK( * )
275 DOUBLE PRECISION RWORK( * )
276 COMPLEX*16 A( LDA, * ), B( LDB, * ), Q( LDQ, * ),
277 $ TAU( * ), U( LDU, * ), V( LDV, * ), WORK( * )
278* ..
279*
280* =====================================================================
281*
282* .. Parameters ..
283 COMPLEX*16 CZERO, CONE
284 parameter( czero = ( 0.0d+0, 0.0d+0 ),
285 $ cone = ( 1.0d+0, 0.0d+0 ) )
286* ..
287* .. Local Scalars ..
288 LOGICAL FORWRD, WANTQ, WANTU, WANTV
289 INTEGER I, J
290 COMPLEX*16 T
291* ..
292* .. External Functions ..
293 LOGICAL LSAME
294 EXTERNAL lsame
295* ..
296* .. External Subroutines ..
297 EXTERNAL xerbla, zgeqpf, zgeqr2, zgerq2, zlacpy, zlapmt,
299* ..
300* .. Intrinsic Functions ..
301 INTRINSIC abs, dble, dimag, max, min
302* ..
303* .. Statement Functions ..
304 DOUBLE PRECISION CABS1
305* ..
306* .. Statement Function definitions ..
307 cabs1( t ) = abs( dble( t ) ) + abs( dimag( t ) )
308* ..
309* .. Executable Statements ..
310*
311* Test the input parameters
312*
313 wantu = lsame( jobu, 'U' )
314 wantv = lsame( jobv, 'V' )
315 wantq = lsame( jobq, 'Q' )
316 forwrd = .true.
317*
318 info = 0
319 IF( .NOT.( wantu .OR. lsame( jobu, 'N' ) ) ) THEN
320 info = -1
321 ELSE IF( .NOT.( wantv .OR. lsame( jobv, 'N' ) ) ) THEN
322 info = -2
323 ELSE IF( .NOT.( wantq .OR. lsame( jobq, 'N' ) ) ) THEN
324 info = -3
325 ELSE IF( m.LT.0 ) THEN
326 info = -4
327 ELSE IF( p.LT.0 ) THEN
328 info = -5
329 ELSE IF( n.LT.0 ) THEN
330 info = -6
331 ELSE IF( lda.LT.max( 1, m ) ) THEN
332 info = -8
333 ELSE IF( ldb.LT.max( 1, p ) ) THEN
334 info = -10
335 ELSE IF( ldu.LT.1 .OR. ( wantu .AND. ldu.LT.m ) ) THEN
336 info = -16
337 ELSE IF( ldv.LT.1 .OR. ( wantv .AND. ldv.LT.p ) ) THEN
338 info = -18
339 ELSE IF( ldq.LT.1 .OR. ( wantq .AND. ldq.LT.n ) ) THEN
340 info = -20
341 END IF
342 IF( info.NE.0 ) THEN
343 CALL xerbla( 'ZGGSVP', -info )
344 RETURN
345 END IF
346*
347* QR with column pivoting of B: B*P = V*( S11 S12 )
348* ( 0 0 )
349*
350 DO 10 i = 1, n
351 iwork( i ) = 0
352 10 CONTINUE
353 CALL zgeqpf( p, n, b, ldb, iwork, tau, work, rwork, info )
354*
355* Update A := A*P
356*
357 CALL zlapmt( forwrd, m, n, a, lda, iwork )
358*
359* Determine the effective rank of matrix B.
360*
361 l = 0
362 DO 20 i = 1, min( p, n )
363 IF( cabs1( b( i, i ) ).GT.tolb )
364 $ l = l + 1
365 20 CONTINUE
366*
367 IF( wantv ) THEN
368*
369* Copy the details of V, and form V.
370*
371 CALL zlaset( 'Full', p, p, czero, czero, v, ldv )
372 IF( p.GT.1 )
373 $ CALL zlacpy( 'Lower', p-1, n, b( 2, 1 ), ldb, v( 2, 1 ),
374 $ ldv )
375 CALL zung2r( p, p, min( p, n ), v, ldv, tau, work, info )
376 END IF
377*
378* Clean up B
379*
380 DO 40 j = 1, l - 1
381 DO 30 i = j + 1, l
382 b( i, j ) = czero
383 30 CONTINUE
384 40 CONTINUE
385 IF( p.GT.l )
386 $ CALL zlaset( 'Full', p-l, n, czero, czero, b( l+1, 1 ),
387 $ ldb )
388*
389 IF( wantq ) THEN
390*
391* Set Q = I and Update Q := Q*P
392*
393 CALL zlaset( 'Full', n, n, czero, cone, q, ldq )
394 CALL zlapmt( forwrd, n, n, q, ldq, iwork )
395 END IF
396*
397 IF( p.GE.l .AND. n.NE.l ) THEN
398*
399* RQ factorization of ( S11 S12 ) = ( 0 S12 )*Z
400*
401 CALL zgerq2( l, n, b, ldb, tau, work, info )
402*
403* Update A := A*Z**H
404*
405 CALL zunmr2( 'Right', 'Conjugate transpose', m, n, l, b,
406 $ ldb, tau, a, lda, work, info )
407 IF( wantq ) THEN
408*
409* Update Q := Q*Z**H
410*
411 CALL zunmr2( 'Right', 'Conjugate transpose', n, n, l, b,
412 $ ldb, tau, q, ldq, work, info )
413 END IF
414*
415* Clean up B
416*
417 CALL zlaset( 'Full', l, n-l, czero, czero, b, ldb )
418 DO 60 j = n - l + 1, n
419 DO 50 i = j - n + l + 1, l
420 b( i, j ) = czero
421 50 CONTINUE
422 60 CONTINUE
423*
424 END IF
425*
426* Let N-L L
427* A = ( A11 A12 ) M,
428*
429* then the following does the complete QR decomposition of A11:
430*
431* A11 = U*( 0 T12 )*P1**H
432* ( 0 0 )
433*
434 DO 70 i = 1, n - l
435 iwork( i ) = 0
436 70 CONTINUE
437 CALL zgeqpf( m, n-l, a, lda, iwork, tau, work, rwork, info )
438*
439* Determine the effective rank of A11
440*
441 k = 0
442 DO 80 i = 1, min( m, n-l )
443 IF( cabs1( a( i, i ) ).GT.tola )
444 $ k = k + 1
445 80 CONTINUE
446*
447* Update A12 := U**H*A12, where A12 = A( 1:M, N-L+1:N )
448*
449 CALL zunm2r( 'Left', 'Conjugate transpose', m, l,
450 $ min( m, n-l ), a, lda, tau, a( 1, n-l+1 ), lda,
451 $ work, info )
452*
453 IF( wantu ) THEN
454*
455* Copy the details of U, and form U
456*
457 CALL zlaset( 'Full', m, m, czero, czero, u, ldu )
458 IF( m.GT.1 )
459 $ CALL zlacpy( 'Lower', m-1, n-l, a( 2, 1 ), lda,
460 $ u( 2, 1 ), ldu )
461 CALL zung2r( m, m, min( m, n-l ), u, ldu, tau, work,
462 $ info )
463 END IF
464*
465 IF( wantq ) THEN
466*
467* Update Q( 1:N, 1:N-L ) = Q( 1:N, 1:N-L )*P1
468*
469 CALL zlapmt( forwrd, n, n-l, q, ldq, iwork )
470 END IF
471*
472* Clean up A: set the strictly lower triangular part of
473* A(1:K, 1:K) = 0, and A( K+1:M, 1:N-L ) = 0.
474*
475 DO 100 j = 1, k - 1
476 DO 90 i = j + 1, k
477 a( i, j ) = czero
478 90 CONTINUE
479 100 CONTINUE
480 IF( m.GT.k )
481 $ CALL zlaset( 'Full', m-k, n-l, czero, czero, a( k+1, 1 ),
482 $ lda )
483*
484 IF( n-l.GT.k ) THEN
485*
486* RQ factorization of ( T11 T12 ) = ( 0 T12 )*Z1
487*
488 CALL zgerq2( k, n-l, a, lda, tau, work, info )
489*
490 IF( wantq ) THEN
491*
492* Update Q( 1:N,1:N-L ) = Q( 1:N,1:N-L )*Z1**H
493*
494 CALL zunmr2( 'Right', 'Conjugate transpose', n, n-l, k,
495 $ a, lda, tau, q, ldq, work, info )
496 END IF
497*
498* Clean up A
499*
500 CALL zlaset( 'Full', k, n-l-k, czero, czero, a, lda )
501 DO 120 j = n - l - k + 1, n - l
502 DO 110 i = j - n + l + k + 1, k
503 a( i, j ) = czero
504 110 CONTINUE
505 120 CONTINUE
506*
507 END IF
508*
509 IF( m.GT.k ) THEN
510*
511* QR factorization of A( K+1:M,N-L+1:N )
512*
513 CALL zgeqr2( m-k, l, a( k+1, n-l+1 ), lda, tau, work, info )
514*
515 IF( wantu ) THEN
516*
517* Update U(:,K+1:M) := U(:,K+1:M)*U1
518*
519 CALL zunm2r( 'Right', 'No transpose', m, m-k,
520 $ min( m-k, l ), a( k+1, n-l+1 ), lda, tau,
521 $ u( 1, k+1 ), ldu, work, info )
522 END IF
523*
524* Clean up
525*
526 DO 140 j = n - l + 1, n
527 DO 130 i = j - n + k + l + 1, m
528 a( i, j ) = czero
529 130 CONTINUE
530 140 CONTINUE
531*
532 END IF
533*
534 RETURN
535*
536* End of ZGGSVP
537*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgeqr2(m, n, a, lda, tau, work, info)
ZGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
Definition zgeqr2.f:128
subroutine zgerq2(m, n, a, lda, tau, work, info)
ZGERQ2 computes the RQ factorization of a general rectangular matrix using an unblocked algorithm.
Definition zgerq2.f:121
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
Definition zlacpy.f:101
subroutine zlapmt(forwrd, m, n, x, ldx, k)
ZLAPMT performs a forward or backward permutation of the columns of a matrix.
Definition zlapmt.f:102
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.
Definition zlaset.f:104
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine zung2r(m, n, k, a, lda, tau, work, info)
ZUNG2R
Definition zung2r.f:112
subroutine zunm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...
Definition zunm2r.f:157
subroutine zunmr2(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNMR2 multiplies a general matrix by the unitary matrix from a RQ factorization determined by cgerqf...
Definition zunmr2.f:157
subroutine zgeqpf(m, n, a, lda, jpvt, tau, work, rwork, info)
ZGEQPF
Definition zgeqpf.f:146
Here is the call graph for this function:
Here is the caller graph for this function: