在Julia中,大型稀疏矩阵的eigs()函数出错 [英] In Julia, The eigs() function for large sparse matrix went wrong

查看:323
本文介绍了在Julia中,大型稀疏矩阵的eigs()函数出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Julia,我用spzeros()函数创建了一个稀疏矩阵,用一些句子初始化了该矩阵,并尝试计算其特征值.但是,该函数仅适用于较小的稀疏矩阵(n< 800),而对于较大的矩阵,则出现了一些错误.

With Julia, I created a sparse matrix with the spzeros() function, initialized the matrix with some sentences, and tried to calculate the eigenvalue of it. However, the function works well only for small sparse matrix(n<800), for a little bit larger matrix, i got some error.

代码:

ns = 400 # 800
H = spzeros(Complex128, ns, ns)
#... initialization 
E, x = eigs(H)

最后一句之后的错误消息:

The error message after the last sentence:

LoadError:Base.LinAlg.ARPACKException(未指定的ARPACK错误:1") 加载In [7]时,表达式从第1行开始

LoadError: Base.LinAlg.ARPACKException("unspecified ARPACK error: 1") while loading In[7], in expression starting on line 1

在aupd_wrapper(:: Type {T},:: Base.LinAlg.#matvecA!#69 {SparseMatrixCSC {Complex {Float64},Int64}}},:: Base.LinAlg.## 63#70,:: Base.LinAlg.## 64#71,:: Int64,:: Bool,:: Bool,:: String,:: Int64,:: Int64,:: String,:: Float64,:: Int64,:: Int64, :: Array {Complex {Float64},1})在.\ linalg \ arpack.jl:53 在#_eigs#62(:: Int64,:: Int64,:: Symbol,:: Float64,:: Int64,:: Void,:: Array {Complex {Float64},1},:: Bool,:: Base中. LinAlg.#_ eigs,::.paralg \ arnoldi.jl:268处的:: SparseMatrixCSC {Complex {Float64},Int64},:: UniformScaling {Int64}). 在(:: Base.LinAlg.#kw ## _ eigs)(:: Array {Any,1},:: Base.LinAlg.#_ eigs,:: SparseMatrixCSC {Complex {Float64},Int64},:: UniformScaling {Int64 })在.\:0 在.\ linalg \ arnoldi.jl:78处的#eigs#55(:: Array {Any,1},:: Function,:: SparseMatrixCSC {Complex {Float64},Int64},:: UniformScaling {Int64})中 在(:: Base.LinAlg.#kw ## eigs)(:: Array {Any,1},:: Base.LinAlg.#eigs,:: SparseMatrixCSC {Complex {Float64},Int64},:: UniformScaling {Int64 })在.\:0 在.\ linalg \ arnoldi.jl:85处的#eigs#59(:: Array {Any,1},:: Function,:: SparseMatrixCSC {Complex,Int64},:: UniformScaling {Int64})中 在(:: Base.LinAlg.#kw ## eigs)(:: Array {Any,1},:: Base.LinAlg.#eigs,:: SparseMatrixCSC {Complex,Int64},:: UniformScaling {Int64})中.\:0 在.\ linalg \ arnoldi.jl:77的#eigs#54(:: Array {Any,1},:: Function,:: SparseMatrixCSC {Complex,Int64})中 在(:: Base.LinAlg.#kw ## eigs)(:: Array {Any,1},:: Base.LinAlg.#eigs,:: SparseMatrixCSC {Complex,Int64})中.\:0

in aupd_wrapper(::Type{T}, ::Base.LinAlg.#matvecA!#69{SparseMatrixCSC{Complex{Float64},Int64}}, ::Base.LinAlg.##63#70, ::Base.LinAlg.##64#71, ::Int64, ::Bool, ::Bool, ::String, ::Int64, ::Int64, ::String, ::Float64, ::Int64, ::Int64, ::Array{Complex{Float64},1}) at .\linalg\arpack.jl:53 in #_eigs#62(::Int64, ::Int64, ::Symbol, ::Float64, ::Int64, ::Void, ::Array{Complex{Float64},1}, ::Bool, ::Base.LinAlg.#_eigs, ::SparseMatrixCSC{Complex{Float64},Int64}, ::UniformScaling{Int64}) at .\linalg\arnoldi.jl:268 in (::Base.LinAlg.#kw##_eigs)(::Array{Any,1}, ::Base.LinAlg.#_eigs, ::SparseMatrixCSC{Complex{Float64},Int64}, ::UniformScaling{Int64}) at .\:0 in #eigs#55(::Array{Any,1}, ::Function, ::SparseMatrixCSC{Complex{Float64},Int64}, ::UniformScaling{Int64}) at .\linalg\arnoldi.jl:78 in (::Base.LinAlg.#kw##eigs)(::Array{Any,1}, ::Base.LinAlg.#eigs, ::SparseMatrixCSC{Complex{Float64},Int64}, ::UniformScaling{Int64}) at .\:0 in #eigs#59(::Array{Any,1}, ::Function, ::SparseMatrixCSC{Complex,Int64}, ::UniformScaling{Int64}) at .\linalg\arnoldi.jl:85 in (::Base.LinAlg.#kw##eigs)(::Array{Any,1}, ::Base.LinAlg.#eigs, ::SparseMatrixCSC{Complex,Int64}, ::UniformScaling{Int64}) at .\:0 in #eigs#54(::Array{Any,1}, ::Function, ::SparseMatrixCSC{Complex,Int64}) at .\linalg\arnoldi.jl:77 in (::Base.LinAlg.#kw##eigs)(::Array{Any,1}, ::Base.LinAlg.#eigs, ::SparseMatrixCSC{Complex,Int64}) at .\:0

从Google的快速搜索中,

推荐答案

ARPACK错误1似乎是进行的最大迭代次数".因此,您的矩阵必须使得ARPACK的算法无法找到特征值.

ARPACK error 1, from a quick Google search, seems to be "Maximum number of iterations taken." Hence, your matrix must be such that ARPACK's algorithms cannot find the eigenvalues.

在其他地方进行讨论,看来可以通过删除顶点来解决该问题.零度(或通常为零行),或将矩阵拆分为相连的分量(即块),并分别为每个块查找特征值.

From discussions elsewhere, it seems that the issue can be resolved by deleting vertices with degree zero (or, in general, zero rows), or by splitting the matrix into connected components (i.e. blocks) and finding eigenvalues for each block separately.

这篇关于在Julia中,大型稀疏矩阵的eigs()函数出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆