# Help with ArnoldiMethod.jl

**URL:** <https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026>\
**Category:** New to Julia\
**Tags:** eigenvalues\
**Created:** [April 26, 2021, 11:40am UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026 "2021-04-26T11:40:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Post date:** [April 26, 2021, 11:40am UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/1 "2021-04-26T11:40:49Z")

</div>

Hi everyone. I am trying to solve the general eigenvalue problem closed to a value by computing the eigenvalues of largest magnitude. Using Arpack the command is similar to:

dp,xp=eigs(A,B,nev=3,sigma=ω[o]/rspd);

But I found ArnoldiMethod.jl and someone mentioned it should be faster than the Arpack.jl.

I found this:

[https://haampie.github.io/ArnoldiMethod.jl/stable/usage/02\_spectral\_transformations.html](https://haampie.github.io/ArnoldiMethod.jl/stable/usage/02_spectral_transformations.html)

But I do not know how to set the “sigma” value.

Any help getting the LM eigenvalues and eigenfuncitons faster than Arpack. This is kind of bottlenecking my code.

---

<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:** [April 26, 2021, 11:49am UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/2 "2021-04-26T11:49:08Z")

</div>

you set it yourself, see here [https://github.com/rveltz/BifurcationKit.jl/blob/master/src/EigSolver.jl#L138](https://github.com/rveltz/BifurcationKit.jl/blob/master/src/EigSolver.jl#L138) for a regular eigenvalue problem.

I also do it in my most recent [tutorial](https://rveltz.github.io/BifurcationKit.jl/dev/tutorialsSH3d/#d-Swift-Hohenberg-equation-(advanced)-1)

You have also other algo:

- [Introduction · NEP-PACK](https://nep-pack.github.io/NonlinearEigenproblems.jl/)
- [Home · JacobiDavidson.jl](https://haampie.github.io/JacobiDavidson.jl/latest/)

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Post date:** [April 26, 2021, 1:14pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/3 "2021-04-26T13:14:47Z")

</div>

> [@rveltz](#):
>
> tutorial

EigSolver calls Arpack for sparse matrixes?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [April 26, 2021, 3:04pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/4 "2021-04-26T15:04:38Z")

</div>

Why would it be faster? It is Arnoldi (Lanczos, for symmetric matrices), same as Arpack.

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Post date:** [April 26, 2021, 3:06pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/5 "2021-04-26T15:06:30Z")

</div>

I don’t know is what I read.

I am not getting any of the given options to work properly.

Any idea to make Arpack run faster? I was thinking of editing “eigs” to remove a bunch of the “if” in there…

---

<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:** [April 26, 2021, 3:23pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/6 "2021-04-26T15:23:40Z")

</div>

There are 4 different eigen solvers in EigSolver.jl based on `eig, Arpack, ArnoldiMethod, KrylovKit`. They works for matrix-free or sparse linear operators.

---

<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:** [April 26, 2021, 3:24pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/7 "2021-04-26T15:24:57Z")

</div>

It difficult to tell without A and B.

---

<div class="post-metadata">

**Author:** ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Post date:** [April 26, 2021, 3:59pm UTC](https://discourse.julialang.org/t/help-with-arnoldimethod-jl/60026/8 "2021-04-26T15:59:38Z")

</div>

Dear @rveltz. They are quite sparse matrix…

I would very much appreciate if you can check them and tell me the best way to address my problem. I have uploaded my code here:

[https://github.com/marianoarnaiz/SWF](https://github.com/marianoarnaiz/SWF)

Running: [SWF\_light.jl](https://github.com/marianoarnaiz/SWF/blob/main/SWF%20copy%202/SWF_light.jl) (comment using GMT and the plot)

Will make all the computations. The for loop that calls the arpack is in function:

Rayleigh\_Forwardsp, between lines 463 and 467
