how i can use Singular value decomposition function with big size matrix?

8 vues (au cours des 30 derniers jours)
Yasser N.Bakir
Yasser N.Bakir le 19 Mai 2017
I need to extract the matrices U,S,V from the given matrix A. the size of A is 271250*225.
but when i run svd function in matlab, i have error " Requested 271250x271250 (548.2GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information".

Réponses (3)

Steven Lord
Steven Lord le 19 Mai 2017
Compute the economy sized svd by passing the 'econ' flag into svd. Or get a machine with at least a terabyte of RAM (one and a half or two would be even better) and be prepared to wait.

John D'Errico
John D'Errico le 19 Mai 2017
As Steve says, buy some memory, LOTS of it. Have some coffee. Read a good book while you wait. Or better yet, read a bad book, as it may take you longer to wade through something you hate.
Often people think they need to do something computationally intensive, when they really don't. I can think of at least one other person I answered today who surely did not in fact need to do what they were trying to do. But if you don't know differently, then you can only follow the formula you have taken rom some book.
So look at your problem. If the economy SVD is not an option, then look at what you are doing. There may well be other ways to solve it, other factorizations that will do nearly as well for your problem. Since we don't know the problem you are trying to solve, that is impossible to know.

Anubhav  Dwivedi
Anubhav Dwivedi le 1 Oct 2021
For an economy svd, the solution is straight forward. Using the relation between eigen decomposition and SVD we can do something like this:
At = A'; % get the smaller dimension matrix
[v,d] = eig(At*A);
[s,I] = sqrt(sort(diag(d),'descend')); % compute the singular vectors
v = v(:,I); %compute right singular vectors
u = zeros(size(A));
for i = 1:size(v,1)
u(:,i) = (A*v(:,i))/s(i); %compute left singular vectors
end
  1 commentaire
Christine Tobler
Christine Tobler le 4 Oct 2021
It's a better idea to directly use the svd command with the "econ" option:
[U, S, V] = svd(A, "econ");
The code above will work in most cases, but breaks down if one of the singular values of A is zero, for example. This also has better accuracy, in particular for a matrix A that is ill-conditioned.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Linear Algebra dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by