MATLAB Function Reference | Search  Help Desk |
gsvd | Examples See Also |
Generalized singular value decomposition
[U,V,X,C,S] = gsvd(A,B) [U,V,X,C,S] = gsvd(A,B,0) sigma = gsvd(A,B)
[U,V,X,C,S] = gsvd(A,B)
returns unitary matrices U
and V
, a (usually) square matrix X
, and nonnegative diagonal matrices C
and S
so that
A = U*C*X' B = V*S*X' C'*C + S'*S = I
A
and B
must have the same number of columns, but may have different numbers of rows. If A
is m
-by-p
and B
is n
-by-p
, then U
is m
-by-m
, V
is n
-by-n
and X
is p
-by-q
where q = min(m+n,p)
.
sigma = gsvd(A,B)
returns the vector of generalized singular values, sqrt(diag(C'*C)./diag(S'*S))
.
The nonzero elements of S
are always on its main diagonal. If m >= p
the nonzero elements of C
are also on its main diagonal. But if m < p
, the nonzero diagonal of C
is diag(C,p-m)
. This allows the diagonal elements to be ordered so that the generalized singular values are nondecreasing.
gsvd(A,B,0)
, with three input arguments and either m
or n >= p
, produces the "economy-sized" decomposition where the resulting U
and V
have at most p
columns, and C
and S
have at most p
rows. The generalized singular values are diag(C)./diag(S)
.
When B
is square and nonsingular, the generalized singular values, gsvd(A,B)
, are equal to the ordinary singular values, svd(A/B)
, but they are sorted in the opposite order. Their reciprocals are gsvd(B,A)
.
In this formulation of the gsvd
, no assumptions are made about the individual ranks of A
or B
. The matrix X
has full rank if and only if the matrix [A;B]
has full rank. In fact, svd(X)
and cond(X)
are are equal to svd([A;B])
and cond([A;B])
. Other formulations, eg. G. Golub and C. Van Loan [1], require that null(A)
and null(B)
do not overlap and replace X
by inv(X)
or inv(X')
.
Note, however, that when null(A)
and null(B)
do overlap, the nonzero elements of C
and S
are not uniquely determined.
In the first example, the matrices have at least as many rows as columns.
A = reshape(1:15,5,3) B = magic(3) A = 1 6 11 2 7 12 3 8 13 4 9 14 5 10 15 B = 8 1 6 3 5 7 4 9 2The statement
[U,V,X,C,S] = gsvd(A,B)produces a 5-by-5 orthogonal
U
, a 3-by-3 orthogonal V
, a 3-by-3 nonsingular X
,
X = -2.8284 9.3761 -6.9346 5.6569 8.3071 -18.3301 -2.8284 7.2381 -29.7256and
C = 0.0000 0 0 0 0.3155 0 0 0 0.9807 0 0 0 0 0 0 S = 1.0000 0 0 0 0.9489 0 0 0 0.1957Since
A
is rank deficient, the first diagonal element of C
is zero.
The economy sized decomposition,
[U,V,X,C,S] = gsvd(A,B,0)produces a 5-by-3 matrix
U
and a 3-by-3 matrix C
.
U = -0.3736 -0.6457 -0.4279 -0.0076 -0.3296 -0.4375 0.8617 -0.0135 -0.4470 -0.2063 0.3026 -0.4566 -0.2743 0.6187 -0.4661 C = 0.0000 0 0 0 0.3155 0 0 0 0.9807The other three matrices,
V
, X
, and S
are the same as those obtained with the full decomposition.
The generalized singular values are the ratios of the diagonal elements of C
and S
.
sigma = gsvd(A,B) sigma = 0.0000 0.3325 5.0123These values are a reordering of the ordinary singular values
svd(A/B) ans = 5.0123 0.3325 0.0000In the second example, the matrices have at least as many columns as rows.
A = reshape(1:15,3,5) B = magic(5) A = 1 4 7 10 13 2 5 8 11 14 3 6 9 12 15 B =
17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9The statement
[U,V,X,C,S] = gsvd(A,B)produces a 3-by-3 orthogonal
U
, a 5-by-5 orthogonal V
, a 5-by-5 nonsingular X
and
C = 0 0 0.0000 0 0 0 0 0 0.0439 0 0 0 0 0 0.7432 S = 1.0000 0 0 0 0 0 1.0000 0 0 0 0 0 1.0000 0 0 0 0 0 0.9990 0 0 0 0 0 0.6690In this situation, the nonzero diagonal of
C
is diag(C,2)
. The generalized singular values include three zeros.
sigma = gsvd(A,B) sigma = 0 0 0.0000 0.0439 1.1109Reversing the roles of
A
and B
reciprocates these values, producing three infinities.
gsvd(B,A) ans = 0.9001 22.7610 Inf Inf InfThe generalized singular value decomposition uses the C-S decomposition described in [1], as well as the built-in
svd
and qr
functions. The C-S decomposition is implemented in a subfunction in the gsvd
M-file.
The only warning or error message produced by gsvd
itself occurs when the two input arguments do not have the same number of columns.
[1] Golub, Gene H. and Charles Van Loan, Matrix Computations, Third Edition, Johns Hopkins University Press, Baltimore, 1996
svd
Singular value decomposition