arpack

Computing eigenvectors of a sparse matrix in R

我与影子孤独终老i 提交于 2019-12-21 05:21:15
问题 I am trying to compute the m first eigenvectors of a large sparse matrix in R. Using eigen() is not realistic because large means N > 10 6 here. So far I figured out that I should use ARPACK from the igraph package, which can deal with sparse matrices. However I can't get it to work on a very simple (3x3) matrix: library(Matrix) library(igraph) TestDiag <- Diagonal(3, 3:1) TestMatrix <- t(sparseMatrix(i = c(1, 1, 2, 2, 3), j = c(1, 2, 1, 2, 3), x = c(3/5, 4/5, -4/5, 3/5, 1)))

Finding eigenvectors and eigenvalues of a sparse matrix with ARPACK ( called form PYTHON, MATLAB or as a FORTRAN subroutine)

主宰稳场 提交于 2019-12-12 10:17:26
问题 Few days ago I asked a question how to find the eigenvalues of a large sparse matrix. I got no answers, so I decided to describe a potential solution. One question remains: Can I use the python implementation of ARPACK to compute the eigenvalues of a asymmetric sparse matrix. At the beginning I would like to say that it is not at all necessary to call the subroutines of ARPACK directly using FOTRAN driver program. That is quite difficult and I never got it going. But one can do the following:

Using ARPACK solving eigenvalueproblem, but getting inconsistent results with Matlab

一曲冷凌霜 提交于 2019-12-11 07:43:23
问题 I'm new to ARPACK, I downloaded a script like the following import time import numpy as np from scipy.linalg import eigh from scipy.sparse.linalg import eigs np.set_printoptions(suppress=True) n=30 rstart=0 rend=n A=np.zeros(shape=(n,n)) # first row if rstart == 0: A[0, :2] = [2, -1] rstart += 1 # last row if rend == n: A[n-1, -2:] = [-1, 2] rend -= 1 # other rows for i in range(rstart, rend): A[i, i-1:i+2] = [-1, 2, -1] A[0,8]=30 start_time = time.time() evals_large, evecs_large = eigs(A, 10