1
$\begingroup$

I only know of the following power iteration. But it needs to create a huge matrix A'*A when both of rows and columns are pretty large. And A is a dense matrix as well. Is there any alternative to power iteration method below? I have heard of krylov subspace method, but I am not familiar with it. In anycase I am looking for any faster method than the one mentioned below:

B = A'*A; % or B = A*A' if it is smaller
x = B(:,1); % example of starting point, x will have the largest eigenvector 
x = x/norm(x); 
for i = 1:200 
  y = B*x; 
  y = y/norm(y);
  % norm(x - y); % <- residual, you can try to use it to stop iteration
  x = y; 
end; 
n3 = sqrt(mean(B*x./x)) % translate eigenvalue of B to singular value of A
$\endgroup$
6
  • $\begingroup$ yes I am looking for existing solutions. My matrix is roughly 8 million by 150000. so taking the smaller dimension 150k, it will be 150k by 150k taking roughly 146GB of space. $\endgroup$ Commented May 23, 2017 at 18:30
  • $\begingroup$ It is dense I am afraid. $\endgroup$ Commented May 23, 2017 at 18:35
  • 1
    $\begingroup$ The answer is to use a package, because mostly anything you try by hand will be woefully inefficient in python. For example check out: scicomp.stackexchange.com/questions/7566/… $\endgroup$
    – Alex R.
    Commented May 23, 2017 at 19:05
  • $\begingroup$ See stats.stackexchange.com/questions/2806 and stats.stackexchange.com/questions/41259. $\endgroup$
    – amoeba
    Commented May 23, 2017 at 19:15
  • 1
    $\begingroup$ @amoeba are you sure that is a duplicate as the OP said it was a dense matrix? $\endgroup$
    – mdewey
    Commented May 24, 2017 at 8:20

1 Answer 1

3
$\begingroup$

There are two approaches that require only small number of multiplications of vectors by $A$ or $A'$, and so have computational complexity $O(MNk)$ for small fixed $k$. Their performance is empirically similar, too.

You absolutely do not want to implement a Lanczos-type algorithm yourself -- the rounding error is subtle and quick to anger -- but implementations are available in many packages.

You actually can implement Stochastic SVD yourself; there's a very short Matlab implementation at that link.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.