Trouble with passing arguments to KrylovKit.eigsolve

I am trying to follow the instructions for the eigenvalue solver in the KrylovKit package but even the simplest of instructions they have provided throw an error. I am confounded that instructions to even the simplest of tasks do not work.

I first create a symmetric 100X100 array

a = rand(100,100); a.+=a';

I get the following errors for various attempts to make the eigenvalue sovler run. For example, I cannot even specify the number of eigenvalues needed.

res = KrylovKit.eigsolve(a; howmany = 4)
ERROR: MethodError: no method matching eigselector(::Array{Float64,2}, ::Type{Float64}; howmany=4)
Closest candidates are:
  eigselector(::AbstractArray{T,2} where T, ::Type; issymmetric, ishermitian, krylovdim, maxiter, tol, orth, verbosity) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:181 got unsupported keyword argument "howmany"
  eigselector(::Any, ::Type; issymmetric, ishermitian, krylovdim, maxiter, tol, orth, verbosity) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:166 got unsupported keyword argument "howmany"
Stacktrace:
 [1] kwerr(::NamedTuple{(:howmany,),Tuple{Int64}}, ::Function, ::Array{Float64,2}, ::Type{T} where T) at .\error.jl:157
 [2] #eigsolve#41 at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:149 [inlined]
 [3] #eigsolve#39 at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:144 [inlined]
 [4] top-level scope at REPL[29]:100: 

I cannot set the ordering of the eigenvalues

res = KrylovKit.eigsolve(a, which=LM)
ERROR: UndefVarError: LM not defined
Stacktrace:
 [1] top-level scope at REPL[42]:1

Neither can I sue the EigSorter option.

res = KrylovKit.eigsolve(a, EigSorter(abs; rev = false))
ERROR: MethodError: no method matching iterate(::EigSorter{typeof(abs)})
Closest candidates are:
  iterate(::Cmd) at process.jl:638
  iterate(::Cmd, ::Any) at process.jl:642
  iterate(::Base.MethodList, ::Any...) at reflection.jl:874
  ...
Stacktrace:
 [1] isempty(::EigSorter{typeof(abs)}) at .\essentials.jl:737
 [2] norm(::EigSorter{typeof(abs)}, ::Int64) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\LinearAlgebra\src\generic.jl:605 (repeats 2 times)
 [3] initialize(::LanczosIterator{Array{Float64,2},EigSorter{typeof(abs)},ModifiedGramSchmidt2}; verbosity::Int64) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\krylov\lanczos.jl:68
 [4] eigsolve(::Array{Float64,2}, ::EigSorter{typeof(abs)}, ::Int64, ::Symbol, ::Lanczos{ModifiedGramSchmidt2,Float64}) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\lanczos.jl:10
 [5] eigsolve(::Array{Float64,2}, ::EigSorter{typeof(abs)}, ::Int64, ::Symbol; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:163
 [6] eigsolve(::Array{Float64,2}, ::EigSorter{typeof(abs)}, ::Int64, ::Symbol) at C:\Users\iamsu\.julia\packages\KrylovKit\oJ59b\src\eigsolve\eigsolve.jl:149 (repeats 2 times)
 [7] top-level scope at REPL[43]:1

You made several mistakes

  • before the ; these are not keywork argument
  • which must supply a Symbol

KrylovKit.eigsolve(a, 4, :LM)

2 Likes