libMesh / libmesh

libMesh github repository
http://libmesh.github.io
GNU Lesser General Public License v2.1
654 stars 287 forks source link

Make interface of DenseMatrix::evd similar as svd #1059

Closed YaqiWang closed 8 years ago

YaqiWang commented 8 years ago

We'd like to get eigenvalues of a small dense matrix instead of singular values, which are non-negative. Current interface does not return the eigenvectors which we also want. It will be great we can have similar interface like svd for evd. Thanks!

jwpeterson commented 8 years ago

This can probably be done, but note that DenseMatrix::evd() is implemented in terms of DGEEVX, which we assume is available through SLEPc (to avoid worrying about different ways of wrapping the Fortran function call) so you will need to have SLEPc available in order to use it...

dknez commented 8 years ago

A patch for this change would be welcome! It should be pretty straightforward to provide a second implementation of evd that returns the eigenvectors.

jwpeterson commented 8 years ago

After looking at it in a bit more detail, it looks like we can get what we need from dgeev, which is available via PETSc, rather than relying on the more complicated/sophisticated dgeevx as is done now... so the first part of the fix for this Issue should be using the simpler interface, and the second part would be making the eigenvectors available. @YaqiWang do you need left eigenvalues or right eigenvalues or both?

YaqiWang commented 8 years ago

In our case the matrix is symmetric, so left and right are the same. But in general we need both. Another thing: do we always have such a decomposition like svd?

jwpeterson commented 8 years ago

Another thing: do we always have such a decomposition like svd?

The eigen-decomposition A = VDV^{-1} exists if the eigen-vectors are linearly independent (hence V^{-1} makes sense), but this is not guaranteed for general matrices... It should be guaranteed for symmetric positive semi-definite matrices though, which is why SVD is guaranteed...

jwpeterson commented 8 years ago

Implemented in #1063.