Generalized singular value decomposition

`[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`

, `X`

is `p`

-by-`q`

, `C`

is `m`

-by-`q`

and `S`

is `n`

-by-`q`

,
where `q = min(m+n,p)`

.

The nonzero elements of `S`

are always on its
main diagonal. The nonzero elements of `C`

are on
the diagonal `diag(C,max(0,q-m))`

. If ```
m
>= q
```

, this is the main diagonal of `C`

.

`[U,V,X,C,S] = gsvd(A,B,0)`

, where `A`

is `m`

-by-`p`

and `B`

is `n`

-by-`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)`

so
long as `m >= p`

and `n >= p`

.

If `A`

is `m`

-by-`p`

and `B`

is `n`

-by-`p`

,
then `U`

is `m`

-by-`min(q,m)`

, `V`

is `n`

-by-`min(q,n)`

, `X`

is `p`

-by-`q`

, `C`

is `min(q,m)`

-by-`q`

and `S`

is `min(q,n)`

-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))`

.
When `B`

is square and nonsingular, the generalized
singular values, `gsvd(A,B)`

, correspond to the ordinary
singular values, `svd(A/B)`

, but they are sorted
in the opposite order. Their reciprocals are `gsvd(B,A)`

.

The vector `sigma`

has length `q`

and
is in non-decreasing order.

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 2

The 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.7256

and

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.1957

Since `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.5700 -0.6457 -0.4279 -0.7455 -0.3296 -0.4375 -0.1702 -0.0135 -0.4470 0.2966 0.3026 -0.4566 0.0490 0.6187 -0.4661 C = 0.0000 0 0 0 0.3155 0 0 0 0.9807

The 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.0123

These values are a reordering of the ordinary singular values

svd(A/B) ans = 5.0123 0.3325 0.0000

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 9

The 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.6690

In 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.1109

Reversing the roles of `A`

and `B`

reciprocates
these values, producing two infinities.

gsvd(B,A) ans = 1.0e+16 * 0.0000 0.0000 8.8252 Inf Inf

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 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.

The 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 local function in the `gsvd`

program
file.

[1] Golub, Gene H. and Charles Van Loan, *Matrix
Computations*, Third Edition, Johns Hopkins University
Press, Baltimore, 1996