|
|
Re: Eigenvalues works very slow
Posted:
Oct 25, 2012 1:41 AM
|
|
Does the other system use infinite precision?
You can get an approximation of the eigenvalues by converting to machine precision:
(Debug) In[1]:= d = 25; q = Table[ Table[1/2*Sqrt[i + j + 1]*KroneckerDelta[Abs[i - j], 1], {j, 0, d - 1}], {i, 0, d - 1}]; h0 = Table[ Table[(i + 1/2)*KroneckerDelta[i, j], {j, 0, d - 1}], {i, 0, d - 1}]; lambda = 1/2; q4 = lambda*q.q.q.q; Timing[N[Eigenvalues[q4 + h0]]][[1]] Timing[Eigenvalues[N[q4 + h0]]][[1]] (Debug) Out[6]= 18.6794 (Debug) Out[7]= 0.00085
On Oct 24, 2012, at 3:30 AM, jure lapajne wrote:
> Hello, > I'm trying to calculate eigenvalues of different sized matrices (from 10x10 to 1000x1000) using mathematica's built-in function - Eigenvalues. For smaller matrices it works ok, but for larger matrices it's just too slow. I tried writing the code in another system and it finds eigenvalues very quickly (in a second or two at most) even for big matrices. I'm not sure whether am I doing something wrong or is the speed difference really this big. > My code (you only need to change d to change the size of matrix): > d = 25; > q = Table[Table[1/2*Sqrt[i + j + 1]*KroneckerDelta[Abs[i - j], 1], {j, 0, d-1}],{i, 0, d - 1}]; > h0 = Table[Table[(i + 1/2)*KroneckerDelta[i, j], {j, 0, d - 1}], {i, 0,d-1}]; > lambda = 1/2; > q4 = lambda*q.q.q.q; > N[Eigenvalues[q4 + h0]] > > Thanks for help. >
|
|