user3086871
user3086871

Reputation: 721

What is the fastest way to calculate most dominant eigenvalue/singular value?

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

Upvotes: 1

Views: 406

Answers (1)

Laleh
Laleh

Reputation: 508

I checked 'svd' command of matlab with a 100*100 randomly generated matrix. It is almost 5 times faster than your code.

s = svd(A);
n3 = s(1);

Upvotes: 1

Related Questions