Skip to content

Instantly share code, notes, and snippets.

@denis-bz
Last active June 20, 2020 16:20
Show Gist options
  • Save denis-bz/cc521e8112f5fa53a492d0b22da875e9 to your computer and use it in GitHub Desktop.
Save denis-bz/cc521e8112f5fa53a492d0b22da875e9 to your computer and use it in GitHub Desktop.
Plots of some eigenvalues and eigenvectors 20 Jun 2020

Plots of some eigenvalues and eigenvectors

Keywords: eigenvalues, eigenvectors, test-matrix, scipy, python

Eigenvectors of Suitesparse Norris/fv1

27feb2020-Suitesparse-Norris-fv1-evecs

See SuiteSparse Matrix Collection / Norris, "Finite element modelling of human body parts, Laplace equation on a 2D mesh".

What does this plot tell us ? Without knowing the 2d structure, not a lot -- just a pretty picture. (The top 10 eigenvectors are for the smallest eigenvalues, the bottom 10 for the biggest. The closely-spaced big eigenvalues are tough for Arpack.)

Fwiw, numpy.linalg.eigh took ~ 2 minutes realtime to compute all 9604 eigenvalues and eigenvectors, on my old 4-core iMac.

Eigenvalues of a random sparse matrix

feb2019-eigvals-randommatrix-4000

Sparse random matrices like this make tough test cases for scipy.sparse solvers of Ax = b. Shifting the eigenvalues away from 0 -- A + 1e-4 I, A + 1 I, A + 1.2 I -- changes the runtimes and accuracy |b - Ax| of *GMRES by large factors.

WIBNI, Wouldn't it be nice if: a wiki of test matrices

A wiki of test matrices, with plots of their spectra and/or eigenvectors, would be useful. It could help people to find "a problem roughly like mine", and collect suggestions on How-to-find-eigenmodes of several different kinds of problems.

See also

Circular law
"Shift-invert-in-pictures" under my gists

cheers
-- denis 20 June 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment