Registered Member
|
I need to get the eigenvectors of a sparse matrix. This is leading me to two issues/questions:
1) Is there a way to do eigen-decomposition for sparse matrices? Or do you always have to use dense matrices? It would be AWESOME to have a Lanczos method available. 2) Do DiagonalMatrix and SparseMatrix play nicely? I am getting errors when trying to add/subtract the two More details: I have a sparse matrix which is formed from three matrices, two of which are Eigen::DiagonalMatrix and one which is Eigen::SparseMatrix as such:
That line is giving me fits saying that you cannot add/subtract diag2 and sparse_mat, which seems surprising to me. My ultimate goal is to obtain k eigenvectors of sparse_mat2 corresponding to the k smallest eigenvalues. Is the only way to do this to convert all matrices to the dense form? |
Moderator
|
Check this project: https://github.com/yixuan/spectra
For sparse and diagonal interaction, such operations are not allowed because they are inherently inefficient unless we create a temporary, whereas in most cases the user can avoid this temporary by doing, e.g. (with 3.3-alpha1):
|
Registered Member
|
Wow thanks so much for your response. These were exactly the two things that I needed!!
|
Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar