I am trying to speedup the calculation of eigenvalues, given that I have good guesses for the eigenvectors. From what I know of Arnoldi/Lanczos, my good guesses should be helpful. Unfortunately, I am unable to see any speedup when I give these guesses to Mathematica.
Here is a simple and very artificial example.
I first create a random vector:
testvec = SparseArray[Table[RandomInteger[2000] -> Random[], {500}],{2000}]
I then create a matrix for which this is an eigenvector:
testmat = KroneckerProduct[testvec, testvec]
By construction the eigenvalue is
ev=(testvec.testmat.testvec)/(testvec.testvec)
On my computer (a macbook air running Mathematica 10), the following takes about 0.24 seconds:
AbsoluteTiming[Eigenvalues[testmat, 1, Method -> "Arnoldi"]]
Indeed it finds the right eigenvalue. I now feed it information about the eigenvector:
AbsoluteTiming[Eigenvalues[testmat, 1,Method -> {"Arnoldi", "StartingVector" -> testvec}]]
This once again takes 0.24 seconds.
- Why does this not give me a speedup?
- What can I do differently to get a speedup?
Note: I realize that I can get about a factor of 4 speedup by using the "Shift" option -- but it seems I should be able to get a couple orders of magnitude better by using a good starting vector.