I was trying to solve an eigenvalue problem of two Identical matrix computed in a different way? Surprisingly one solution is six to ten times faster than other (though the solutions are identical). A sample problem is as follows:
clear all;% CASE 1
rng default; A = rand(1000); M = A'*(eye(1000)*1.1)*A; tic; eig(M); toc;% CASE 2
clear all;rng default; A = rand(1000); M = (A'*(eye(1000))*A)*1.1; tic; eig(M); toc;
It shows the following result:
Elapsed time is 1.952121 seconds.Elapsed time is 0.255389 seconds.
Theoretically in both cases, the 'M' matrix is identical. I need to implement the CASE-1 in one of my algorithm. Is there any way to improve the efficiency??
Best Answer