Re: Diagonalizing large sparse matrices

*To*: mathgroup at smc.vnet.net*Subject*: [mg116614] Re: Diagonalizing large sparse matrices*From*: Mikhail Lemeshko <mikhail.lemeshko at gmail.com>*Date*: Mon, 21 Feb 2011 19:29:44 -0500 (EST)*References*: <ijgdcr$btr$1@smc.vnet.net>

On Feb 16, 12:45 pm, Oliver Ruebenkoenig <ruebe... at wolfram.com> wrote: > Hello Mikhail, > > > > On Wed, 16 Feb 2011, MikhailLemeshkowrote: > > Dear friends, > > > Are there any ways to speed up the Eigenvalues[] problem for large > > sparse matrices (those I have are about 15000x15000)? > > > I need only the first eigenvalue (which is usually negative), here is > > the code fragment: > > > e0=Parallelize[-Eigenvalues[N[matr], 1, Method -> {Arnoldi, Criteria - > >> RealPart}]] > > > (I have a 2 core processor) > > > Many thanks in advance! > > > Misha > > Parallelize will be of no use here - the parallelization happens inside the > Eigenvalues. Try something like > > m = 15000; > s = SparseArray[{{i_, i_} -> -2., {i_, j_} /; Abs[i - j] == 1 -> > 1.}, {m, m}]; > > (*s=SparseArray[N[matr]]*) > > Eigenvalues[s, 1, Method -> {Arnoldi}] > > Oliver Thank you a lot. If I do s=SparseArray[N[matr]], the diagonalization becomes much faster indeed. However there is another problem: I have an analytical matrix in a loop, diagonalizing it for different values of parameters. And substitution of parameters' values there, and then making a sparse array out of it takes a lot of time, since the matrix is huge. Making an analytical sparse array and then substituting the parameters there doesn't seem to work, and the Mathematica 8 documentation on the SparseArray[] functions is kind of scarce... Thank you again. Misha