几天前我问了一个如何找到大稀疏矩阵的特征值的问题 . 我没有答案,所以我决定描述一个潜在的解决方案 .

One question remains: 
Can I use the python implementation of ARPACK 
to compute the eigenvalues of a asymmetric sparse matrix.

首先,我想说,根本不需要使用FOTRAN驱动程序直接调用ARPACK的子程序 . 这很困难,我从来没有这样做过 . 但是可以做到以下几点:

选项1:Python

可以安装numpy和scipy并运行以下代码:

import numpy as np
from scipy.linalg import eigh
from scipy.sparse.linalg import eigsh
from scipy.sparse import *
from scipy import * 

# coordinate format storage of the matrix

# rows
ii = array([0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4])
# cols.
jj = array([0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4])
# and the data
data=array([1.,-1.,-1., 2.,-2.,-2., 1., 1., 1., 1., 1.])
# now put this into sparse storage (CSR-format)
m=csr_matrix( (data,(ii,jj)), shape=(5,5) )
# you can check what you did 
matrix([[ 1, -1,  0,  0,  0],
        [-1,  2, -2,  0,  0],
        [ 0, -2,  1,  1,  0],
        [ 0,  0,  1,  1,  0],
        [ 0,  0,  0,  0,  1]])

# the real part starts here
evals_large, evecs_large = eigsh(m, 4, which='LM')
# print the largest 4 eigenvalues
print evals_all
# and the values are
[-1.04948118  1.          1.48792836  3.90570354]

嗯,这一切都非常好,特别是因为它让我们很高兴阅读ARPACK的“写得很好”的手册 .

我有一个问题,我认为它不适用于非对称矩阵 . 至少将结果与matlab进行比较并不是很有说服力 .

选项2:MATLAB

% put your data in a file "matrix.dat"
       % row col. data
       % note that indexing starts at "1"
       1 1 1.
       1 2 -1.
       ......

       load matrix.dat
       M = spconvert(matrix)

       [v,d] = eig(M)

       % v - contains the eigenvectors
       % d - contains the eigenvalues

我认为使用matlab更简单,适用于非对称矩阵 . 好吧,我有一个500000x500000稀疏矩阵,所以这是否适用于matlab ....是另一杯茶!我必须注意使用python我能够加载这个大小的矩阵并计算它的特征值而没有太多的麻烦 .

干杯,