# Trouble with passing arguments to KrylovKit.eigsolve

**URL:** <https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025>\
**Category:** General Usage\
**Created:** [February 10, 2021, 8:32pm UTC](https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025 "2021-02-10T20:32:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamsuddhasattwa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iamsuddhasattwa/32/7441_2.png) [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Post date:** [February 10, 2021, 8:32pm UTC](https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025/1 "2021-02-10T20:32:40Z")

</div>

I am trying to follow the [instructions](https://jutho.github.io/KrylovKit.jl/stable/man/eig/#KrylovKit.eigsolve) 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

```julia
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.

```julia
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

```julia
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.

```julia
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

```

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [February 10, 2021, 9:10pm UTC](https://discourse.julialang.org/t/trouble-with-passing-arguments-to-krylovkit-eigsolve/55025/2 "2021-02-10T21:10:15Z")

</div>

> [@iamsuddhasattwa](#):
>
> `KrylovKit.eigsolve(a; howmany = 4)`

You made several mistakes

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

` KrylovKit.eigsolve(a, 4, :LM)`
