pagesvd
Singular value decomposition of every page of a 3-D array.
Category: Mathematics > Linear Algebra
Syntax
S = pagesvd(A)
Returns the singular values of each page A(:,:,k), in descending order.
[U, S, V] = pagesvd(A)
Returns the factors of each page, so that every page satisfies A(:,:,k) = U(:,:,k)*S(:,:,k)*V(:,:,k)'.
[U, S, V] = pagesvd(A, 'econ')
Computes the economy-size factors of each page.
Description
pagesvd applies svd independently to each m-by-n page of an m-by-n-by-p array. It avoids writing a loop over the third dimension and returns the results stacked in the same page order.
With one output the result is a stack of column vectors, which is convenient for comparing the spectra of many matrices at once.
Input arguments
A- Numeric array whose pages (the first two dimensions) are the matrices to decompose.
'econ'- Optional flag that drops the singular vectors that do not correspond to a singular value.
Output arguments
S- With one output, an array of size
min(m,n)-by-1-by-pholding the singular values of each page. With three outputs, the diagonal matrices of singular values, one per page. U, V- Orthogonal (unitary) factors of each page.
Example
Singular values of two pages
A = cat(3, [1 2; 3 4], [2 0; 0 1]);
S = pagesvd(A);
disp(S(:,:,1)')
disp(S(:,:,2)')
Output
5.4650 0.3660
2 1