Prev: clearing denominators and eliminating square roots in *huge*
Next: Possible bug? Changing fonts of greek letters
From: Matin Inck on 4 Mar 2010 05:32 Hi guys My system is currently described by a dense 2500x2500 matrix, which contains many zero entries. Diagonalizing this matrix using Eigensystem takes about 2 minutes, which seems like a long time, and I assume it has got something to do with the fact that the eigenvalues are degenerate. In order to investigate my system further, I need to generate a larger matrix (say 3600x3600), but my computer runs out of memory when I try to diagonalize it in this case (Mathematica complaints about no memory). I have two questions. 1) If I want the full spectrum of the matrix, what options do I have? 2) It might be possible that I can do with only a small part of the spectrum of my matrix. In this case what I would use is following piece of code, where =E2=80=9CHamiltonian=E2=80=9D is the name of the matrix: Eigensystem[SparseArray[Hamiltonian], 50, Method=EF=82=AE{"Arnoldi", "Shift"=EF=82=AE0.25}] Just to be absolutely sure: Does this give me the 50 eigenvalues (and corresponding eigenvectors) closest to 0.25? Also, I believe I read somewhere that for each time an eigenvector/value is found using this method, there is a loss of precision. Can you confirm this? Any help would be much appreciated. Best, Matin.
From: David Bailey on 7 Mar 2010 04:04 Matin Inck wrote: > Hi guys > > My system is currently described by a dense 2500x2500 matrix, which > contains many zero entries. Diagonalizing this matrix using > Eigensystem takes about 2 minutes, which seems like a long time, and I > assume it has got something to do with the fact that the eigenvalues > are degenerate. In order to investigate my system further, I need to > generate a larger matrix (say 3600x3600), but my computer runs out of > memory when I try to diagonalize it in this case (Mathematica > complaints about no memory). > > I have two questions. > > 1) If I want the full spectrum of the matrix, what options do I have? > > 2) It might be possible that I can do with only a small part of the > spectrum of my matrix. In this case what I would use is following > piece of code, where =E2=80=9CHamiltonian=E2=80=9D is the name of the matrix: > > Eigensystem[SparseArray[Hamiltonian], 50, Method=EF=82=AE{"Arnoldi", > "Shift"=EF=82=AE0.25}] > > Just to be absolutely sure: Does this give me the 50 eigenvalues (and > corresponding eigenvectors) closest to 0.25? Also, I believe I read > somewhere that for each time an eigenvector/value is found using this > method, there is a loss of precision. Can you confirm this? > > Any help would be much appreciated. > > Best, > Matin. > Numeric vectors and (non-sparse) matrices in Mathematica can be stored in two distinct formats. The function Developer`PackedArrayQ can be used to test which format an array is using. The packed array format is preferable if possible because it is more compact - requiring only 8-bytes per Real element - and much faster to process. Since your array doesn't sound that big, it may well be that it is not packed. The function Developer`ToPackedArray will pack an array if possible, but if you have mixed integer/real entries, this will not work (packed arrays must be uniform), code such as: arr=Developer`ToPackedArray[N[arr]] will do the job in this case, by producing a uniform real array. You may find this solves your problem, or you may find that some sort of algorithm change will do the trick, as you suggest. However, if you do decide you need more memory get a 64-bit machine, and load a 64-bit operating system (e.g. 64-bit Windows XP). The Windows version of Mathematica comes with an installer that will install the 64-bit version of the code on a 64-bit operating system. After all this work, you will be able to use a much larger amount of memory - depending on how much you have on your machine. David Bailey http://www.dbaileyconsultancy.co.uk
From: Jim Lambaugh on 14 Mar 2010 07:01
On 4 Mar., 11:32, Matin Inck <matin.i...(a)gmail.com> wrote: > Hi guys > > My system is currently described by a dense 2500x2500 matrix, which > contains many zero entries. Diagonalizing this matrix using > Eigensystem takes about 2 minutes, which seems like a long time, and I > assume it has got something to do with the fact that the eigenvalues > are degenerate. In order to investigate my system further, I need to > generate a larger matrix (say 3600x3600), but my computer runs out of > memory when I try to diagonalize it in this case (Mathematica > complaints about no memory). > > I have two questions. > > 1) If I want the full spectrum of the matrix, what options do I have? > > 2) It might be possible that I can do with only a small part of the > spectrum of my matrix. In this case what I would use is following > piece of code, where =E2=80=9CHamiltonian=E2=80=9D is the name of the matrix: > > Eigensystem[SparseArray[Hamiltonian], 50, Method=EF=82=AE{"Arnoldi", > "Shift"=EF=82=AE0.25}] > > Just to be absolutely sure: Does this give me the 50 eigenvalues (and > corresponding eigenvectors) closest to 0.25? Also, I believe I read > somewhere that for each time an eigenvector/value is found using this > method, there is a loss of precision. Can you confirm this? > > Any help would be much appreciated. > > Best, > Matin. Yes, that code finds the eigenvalues closest to 0.25. Regarding the precision, I can't be of much help, but I also need to find out what precision Mathematica finds eigenvalues with when using Arnoldi- methods.What I found in the user guide is "The numerical accuracy of the computed eigenvalues and vectors is user specified", but I can't find any options in Mathematica specifying this. I will let you know if I find out more. Hope this helps. |