MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Diagonalizing large matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107456] Re: Diagonalizing large matrices
  • From: Mark McClure <mcmcclur at unca.edu>
  • Date: Sat, 13 Feb 2010 05:22:24 -0500 (EST)
  • References: <201002041125.GAA29739@smc.vnet.net> <hkgl1e$6s0$1@smc.vnet.net>

On Fri, Feb 12, 2010 at 2:18 PM, Jim Lambaugh <lambaugh at gmail.com> wrote:

> Thanks for that example - that illustrated it very well. My background is in
> physics (currently doing a B.S.). If I define my matrix (lets call it
> "lattice") as being dense, then I have made it sparse by using
> SparseArray[{lattice}], because - as you mentioned - I believe it is a
> little tricky using the rules of generation of a sparse array. What I need
> is the full spectrum of the matrix, i.e. all the eigenvectors - will a
> sparse matrix also be useful in this case, or is it not possible finding all
> the eigenvectors when using a sparse matrix?

No, probably not.  The Arnoldi technique is applied to find one
eigenvalue/eigenvector pair at a time.  The matrix is then deflated
and another can be found.  There is loss of precision with each
deflation step so this can only be done so many times.  In fact, if
you ask Mathematica to use the Arnoldi technique to find too many
eigenvalues of a sparse matrix, then it will complain.

> I am not sure this is enough information, but if you had a large matrix
> containing many zeroes and you had to find all the eigenvectors - then what
> would you do?

You've got to use dense techniques.  In Mathematica, this means
Eigenvalues[A].  I would assume that you almost certainly want
numerical approximations, i.e. 1.414, versus Sqrt[2].  So be sure that
your plugging in a numerical matrix in the first place.  For example,
here's the eigenvalue computation for a random zero-one matrix:
A = RandomInteger[{0, 1}, {100, 100}];
Eigenvalues[N[A]]; // Timing

Takes about 0.01 seconds on my machine.  Note the N[A].  If I replace
that with just A, it takes more like 20 seconds.  A 1000x1000 matrix
is easy with the N but infeasible without.

> I really appreciate your help. Currently, you are my only source of
> Mathematica-help, so any help is greatly appreciated.

I read mathgroup regularly and post when the questions touch on
something I feel reasonable competent about.  I think you'll find it
quite helpful, if a bit slow due the delay.

Hope that helps,
Mark


  • Prev by Date: Re: Upright \[Micro] in AxesLabel
  • Next by Date: Re: Re: Normality test
  • Previous by thread: Re: Diagonalizing large matrices
  • Next by thread: Bug? Analytical integration of cosines gets the sign wrong