gsvd
Generalized singular value decomposition of a pair of matrices.
Category: Mathematics > Linear Algebra
Syntax
sigma = gsvd(A, B)
Returns the generalized singular values of A and B.
[U, V, X, C, S] = gsvd(A, B)
Returns the factors with A = U*C*X' and B = V*S*X', where C'*C + S'*S = I.
Description
The GSVD factors two matrices at once with a shared right factor X. It underlies constrained least-squares problems and the comparison of two data sets: a large generalized singular value means a direction in which A dominates B.
It reduces to the ordinary SVD when B is the identity. The ordering of the generalized singular values follows the shape conventions of MATLAB.
Input arguments
A, B- Matrices with the same number of columns.
Output arguments
sigma- Column vector of generalized singular values
sqrt(diag(C'*C)) ./ sqrt(diag(S'*S)). U, V- Unitary matrices.
X- Nonsingular matrix shared by both factorizations.
C, S- Diagonal-like matrices whose squares add up to the identity.
Example
Generalized singular values and a check
A = [1 0; 0 2; 1 1];
B = [1 1; 0 1];
sigma = gsvd(A, B)
[U, V, X, C, S] = gsvd(A, B);
disp(round(C'*C + S'*S))
Output
sigma = 2×1
1.3028
2.3028
1 0
0 1