MATLAB Function Reference |

Generalized singular value decomposition

**Syntax**

**Description**

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

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

**Examples**

**Example 1.** The matrices have at least as many rows as columns.

produces a 5-by-5 orthogonal `U`

, a 3-by-3 orthogonal `V`

, a 3-by-3 nonsingular `X`

,

Since `A`

is rank deficient, the first diagonal element of `C`

is zero.

The economy sized decomposition,

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`

.

These values are a reordering of the ordinary singular values

**Example 2.** The matrices have at least as many columns as rows.

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.

Reversing the roles of `A`

and `B`

reciprocates these values, producing two infinities.

**Algorithm**

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 subfunction in the `gsvd`

M-file.

**Diagnostics**

The only warning or error message produced by `gsvd`

itself occurs when the two input arguments do not have the same number of columns.

**See Also**

**References**

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

griddatan | gt |

© 1994-2005 The MathWorks, Inc.