sggsvd.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 360 行 · 第 1/2 页
HTML
360 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sggsvd.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="SGGSVD.1"></a><a href="sggsvd.f.html#SGGSVD.1">SGGSVD</a>( JOBU, JOBV, JOBQ, M, N, P, K, L, A, LDA, B,
$ LDB, ALPHA, BETA, U, LDU, V, LDV, Q, LDQ, WORK,
$ IWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK driver routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER JOBQ, JOBU, JOBV
INTEGER INFO, K, L, LDA, LDB, LDQ, LDU, LDV, M, N, P
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IWORK( * )
REAL A( LDA, * ), ALPHA( * ), B( LDB, * ),
$ BETA( * ), Q( LDQ, * ), U( LDU, * ),
$ V( LDV, * ), WORK( * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SGGSVD.23"></a><a href="sggsvd.f.html#SGGSVD.1">SGGSVD</a> computes the generalized singular value decomposition (GSVD)
</span><span class="comment">*</span><span class="comment"> of an M-by-N real matrix A and P-by-N real matrix B:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> U'*A*Q = D1*( 0 R ), V'*B*Q = D2*( 0 R )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where U, V and Q are orthogonal matrices, and Z' is the transpose
</span><span class="comment">*</span><span class="comment"> of Z. Let K+L = the effective numerical rank of the matrix (A',B')',
</span><span class="comment">*</span><span class="comment"> then R is a K+L-by-K+L nonsingular upper triangular matrix, D1 and
</span><span class="comment">*</span><span class="comment"> D2 are M-by-(K+L) and P-by-(K+L) "diagonal" matrices and of the
</span><span class="comment">*</span><span class="comment"> following structures, respectively:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If M-K-L >= 0,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K L
</span><span class="comment">*</span><span class="comment"> D1 = K ( I 0 )
</span><span class="comment">*</span><span class="comment"> L ( 0 C )
</span><span class="comment">*</span><span class="comment"> M-K-L ( 0 0 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K L
</span><span class="comment">*</span><span class="comment"> D2 = L ( 0 S )
</span><span class="comment">*</span><span class="comment"> P-L ( 0 0 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N-K-L K L
</span><span class="comment">*</span><span class="comment"> ( 0 R ) = K ( 0 R11 R12 )
</span><span class="comment">*</span><span class="comment"> L ( 0 0 R22 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C = diag( ALPHA(K+1), ... , ALPHA(K+L) ),
</span><span class="comment">*</span><span class="comment"> S = diag( BETA(K+1), ... , BETA(K+L) ),
</span><span class="comment">*</span><span class="comment"> C**2 + S**2 = I.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> R is stored in A(1:K+L,N-K-L+1:N) on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If M-K-L < 0,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K M-K K+L-M
</span><span class="comment">*</span><span class="comment"> D1 = K ( I 0 0 )
</span><span class="comment">*</span><span class="comment"> M-K ( 0 C 0 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K M-K K+L-M
</span><span class="comment">*</span><span class="comment"> D2 = M-K ( 0 S 0 )
</span><span class="comment">*</span><span class="comment"> K+L-M ( 0 0 I )
</span><span class="comment">*</span><span class="comment"> P-L ( 0 0 0 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N-K-L K M-K K+L-M
</span><span class="comment">*</span><span class="comment"> ( 0 R ) = K ( 0 R11 R12 R13 )
</span><span class="comment">*</span><span class="comment"> M-K ( 0 0 R22 R23 )
</span><span class="comment">*</span><span class="comment"> K+L-M ( 0 0 0 R33 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C = diag( ALPHA(K+1), ... , ALPHA(M) ),
</span><span class="comment">*</span><span class="comment"> S = diag( BETA(K+1), ... , BETA(M) ),
</span><span class="comment">*</span><span class="comment"> C**2 + S**2 = I.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), and R33 is stored
</span><span class="comment">*</span><span class="comment"> ( 0 R22 R23 )
</span><span class="comment">*</span><span class="comment"> in B(M-K+1:L,N+M-K-L+1:N) on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The routine computes C, S, R, and optionally the orthogonal
</span><span class="comment">*</span><span class="comment"> transformation matrices U, V and Q.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> In particular, if B is an N-by-N nonsingular matrix, then the GSVD of
</span><span class="comment">*</span><span class="comment"> A and B implicitly gives the SVD of A*inv(B):
</span><span class="comment">*</span><span class="comment"> A*inv(B) = U*(D1*inv(D2))*V'.
</span><span class="comment">*</span><span class="comment"> If ( A',B')' has orthonormal columns, then the GSVD of A and B is
</span><span class="comment">*</span><span class="comment"> also equal to the CS decomposition of A and B. Furthermore, the GSVD
</span><span class="comment">*</span><span class="comment"> can be used to derive the solution of the eigenvalue problem:
</span><span class="comment">*</span><span class="comment"> A'*A x = lambda* B'*B x.
</span><span class="comment">*</span><span class="comment"> In some literature, the GSVD of A and B is presented in the form
</span><span class="comment">*</span><span class="comment"> U'*A*X = ( 0 D1 ), V'*B*X = ( 0 D2 )
</span><span class="comment">*</span><span class="comment"> where U and V are orthogonal and X is nonsingular, D1 and D2 are
</span><span class="comment">*</span><span class="comment"> ``diagonal''. The former GSVD form can be converted to the latter
</span><span class="comment">*</span><span class="comment"> form by taking the nonsingular matrix X as
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> X = Q*( I 0 )
</span><span class="comment">*</span><span class="comment"> ( 0 inv(R) ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> JOBU (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'U': Orthogonal matrix U is computed;
</span><span class="comment">*</span><span class="comment"> = 'N': U is not computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> JOBV (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'V': Orthogonal matrix V is computed;
</span><span class="comment">*</span><span class="comment"> = 'N': V is not computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> JOBQ (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'Q': Orthogonal matrix Q is computed;
</span><span class="comment">*</span><span class="comment"> = 'N': Q is not computed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> M (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix A. M >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of columns of the matrices A and B. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix B. P >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> K (output) INTEGER
</span><span class="comment">*</span><span class="comment"> L (output) INTEGER
</span><span class="comment">*</span><span class="comment"> On exit, K and L specify the dimension of the subblocks
</span><span class="comment">*</span><span class="comment"> described in the Purpose section.
</span><span class="comment">*</span><span class="comment"> K + L = effective numerical rank of (A',B')'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) REAL array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> On entry, the M-by-N matrix A.
</span><span class="comment">*</span><span class="comment"> On exit, A contains the triangular matrix R, or part of R.
</span><span class="comment">*</span><span class="comment"> See Purpose for details.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array A. LDA >= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input/output) REAL array, dimension (LDB,N)
</span><span class="comment">*</span><span class="comment"> On entry, the P-by-N matrix B.
</span><span class="comment">*</span><span class="comment"> On exit, B contains the triangular matrix R if M-K-L < 0.
</span><span class="comment">*</span><span class="comment"> See Purpose for details.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array B. LDB >= max(1,P).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ALPHA (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> BETA (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> On exit, ALPHA and BETA contain the generalized singular
</span><span class="comment">*</span><span class="comment"> value pairs of A and B;
</span><span class="comment">*</span><span class="comment"> ALPHA(1:K) = 1,
</span><span class="comment">*</span><span class="comment"> BETA(1:K) = 0,
</span><span class="comment">*</span><span class="comment"> and if M-K-L >= 0,
</span><span class="comment">*</span><span class="comment"> ALPHA(K+1:K+L) = C,
</span><span class="comment">*</span><span class="comment"> BETA(K+1:K+L) = S,
</span><span class="comment">*</span><span class="comment"> or if M-K-L < 0,
</span><span class="comment">*</span><span class="comment"> ALPHA(K+1:M)=C, ALPHA(M+1:K+L)=0
</span><span class="comment">*</span><span class="comment"> BETA(K+1:M) =S, BETA(M+1:K+L) =1
</span><span class="comment">*</span><span class="comment"> and
</span><span class="comment">*</span><span class="comment"> ALPHA(K+L+1:N) = 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?