簡體   English   中英

計算 Julia 中復厄米特稀疏矩陣的特征值

[英]Compute eigenvalues of complex-hermitian sparsematrix in Julia

我正在使用大約100000x100000厄米特復雜稀疏矩陣,填充了大約 5% 的條目,並且想要計算特征值/特征向量。

到目前為止,我一直在使用Arpack.jl eigs(A) 但是,一旦我將大小調到高於 5000,這將無法正常工作。

對於基准測試,我一直在使用以下代碼生成一些 TestMatrices:

using Arpack
using SparseArrays
using ProgressMeter

pop = 0.05
n = 3000 # for example

A = spzeros(Complex{Float64}, n, n)

@showprogress for _ in 1:round(Int,pop * (n^2))
  A[rand(1:n), rand(1:n)] = rand(Complex{Float64})
end


# make A hermite
A = A + conj(A)

t = @elapsed eigs(A,maxiter=1500) # ends up being ~ 13 seconds

對於 n ~ 3000, eigs()調用在我的機器上已經花費了 13 秒,對於更大的 n,它不會在任何“合理”時間內完成或完全退出。

有專門的包/方法嗎?

任何幫助表示贊賞

https://github.com/JuliaLinearAlgebra/ArnoldiMethod.jl似乎是你想要的:

julia> let pop=0.05, n=3000
           A = sprand(Complex{Float64},n,n, 0.05)
           A = A + conj(A)
           @time eigs(A; maxiter=1500)
           @time decomp, history = partialschur(A, nev=10, tol=1e-6, which=LM());
       end;
 10.521786 seconds (50.73 k allocations: 3.458 MiB, 0.04% gc time)
  2.244129 seconds (19 allocations: 1.892 MiB)

完整性檢查:

julia> a,(b,c) = let pop=0.05, n=300
           A = sprand(Complex{Float64},n,n, 0.05)
           A = A + conj(A)
           eigs(A; maxiter=2500), partialschur(A, nev=6, tol=1e-6, which=LM());
       end;

julia> a[1]
6-element Vector{ComplexF64}:
    14.5707071003175 + 8.218901803015509e-16im
   4.493079744504954 - 0.8390429567118733im
   4.493079744504933 + 0.8390429567118641im
 -0.3415176925293196 + 4.254184281244591im
 -0.3415176925293088 - 4.25418428124452im
 0.49406553681541177 - 4.229680489599233im

julia> b
PartialSchur decomposition (ComplexF64) of dimension 6
eigenvalues:
6-element Vector{ComplexF64}:
   14.570707100307926 + 7.10698633463049e-12im
    4.493079906269516 + 0.8390429076809746im
    4.493079701528448 - 0.8390430155670777im
  -0.3415174262177961 + 4.254183175902487im
 -0.34151626930774975 - 4.25418321627979im
     0.49406543866702 + 4.229680079205066im

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM