How to generate random matrices that are rank-deficient by generating their SVD first?

조회 수: 4 (최근 30일)
How to generate random matrices that are rank-deficient by generating their SVD first?

채택된 답변

John D'Errico
John D'Errico 2019년 4월 29일
편집: John D'Errico 2019년 4월 30일
You do it by understanding what a rank deficient matrix is, and what the svd means. The svd of a matrix is a decomposition of the form:
A = U*S*V'
Here U and V are arbitrary ("random") orthogonal matrices, and S is diagonal, containing the singular values. U,S, and V need to be the correct size.
So, to pick a set of singular values. As long as at least one of them is zero, that is all you need. This is true because a diagonal matrix with at least one zero will always be singular. And the product of any pair of matrices cannot have higher rank than either of the members of that product.
The problem is, only you know what "random" means to you. The idea of generating a "random" number, without specifying the distribution of that number is something that has no meaning. So you need to choose those things that will be called random.
You can easily generate an arbitrary orthogonal matrix of size nxn as
Q = orth(randn(n,n));
Of course, that this call to orth actually uses the svd itself seems a bit incestuous. But you could also just use a QR, and avoid the svd.
[Q,R] = qr(randn(n,n));
Pick the singular values as a vector. Remember, one of them must be zero. Create the matrix S using diag. Then form the product as I show above.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by