Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow an initial start-vector #91

Closed
simonschoelly opened this issue Oct 10, 2018 · 11 comments · Fixed by #141
Closed

Feature request: Allow an initial start-vector #91

simonschoelly opened this issue Oct 10, 2018 · 11 comments · Fixed by #141
Labels

Comments

@simonschoelly
Copy link

Right now, the initial vector for the iteration seems to be chosen at random. I think Arpack had the option to select an initial vector. This would allow two things:

  1. If one had an idea what the end result should look like, they could give this as an initial vector which would lead to fewer iterations.
  2. Determinism in regression tests. For example GraphPlots.jl compares the output image with previously generated images. Right now, it does not do that for spectral graph layouts and without an initial starting value, the output might look slightly different every time.
@haampie
Copy link
Member

haampie commented Oct 10, 2018

Yes, that seems very reasonable, will add it soon!

@jarlebring
Copy link

Two options or combinations thereof as I see it:

  1. add initial vector as arg to partialschur():
function _partialschur(A, ::Type{T}, mindim::Int, maxdim::Int, nev::Int, tol::Ttol, restarts::Int, which::Target, history_level::Type{Thist},v0::AbstractVector{T}=randn(n)) where {T,Ttol<:Real,Thist<:History}
  1. add initial Arnoldi-object as kwarg/arg to partialschur(). Starting with a given vector would require the creation of an Arnoldi-object.
function _partialschur(A, ::Type{T}, mindim::Int, maxdim::Int, nev::Int, tol::Ttol, restarts::Int, which::Target, history_level::Type{Thist},A0::Arnoldi=Arnoldi{T}(n,maxdim)) where {T,Ttol<:Real,Thist<:History}

Initializing with an Arnoldi-factorization would be more general, but not very common usecase. A starting vector would be more user friendly for the common usecase.

Which option would you prefer @haampie?

@nrontsis
Copy link

Suppose we choose option 2 and partialschur is modified to also return the Arnoldi decomposition. Then, am I correct to think that this would allow for warm-starting cases where the user has already calculated n eigenvalues/vectors for an eigen-problem and then decides that he wants a few more?

Warm starting cases like this is very desirable for me and I can provide a minimal example use-case, if you think that's useful.

@jarlebring
Copy link

Yes. I think it could be made to allow warm-starting. One would need to create an Arnoldi object from the returned PartialSchur.

@nrontsis
Copy link

Perfect! I am happy to do a PR for (2) then if it is up for grabs.

@jarlebring
Copy link

👍 In this type of project all PRs are usually appreciated. :-)

@haampie
Copy link
Member

haampie commented Jan 19, 2019

Yes, I would be very happy to see (2), also pinging @jagot about this issue.

It should be very convenient for the user to pre-allocate the chunk of memory for the Krylov basis so that it's reusable when solving multiple times. And it should be easy to setup an initial partial Schur decomposition and continue expanding it. Providing an initial guess is just a special case of this.

So a PR that decouples the allocations from the algorithm is a step in the right direction! :)

@jagot
Copy link

jagot commented Jan 20, 2019

Yes, I would be very interested in this. At the moment, I need to solve integro-differential equations on the form 𝓛u + F(u) = λu, where 𝓛 is a differential operator and F contains an integral of u. To this end, I solve an eigenvalue repeatedly, updating F after each iteration, until u and λ converges. Therefore, I'd like to specify an initial u and reuse the memory allocations as much as possible.

@MasonProtter
Copy link
Member

MasonProtter commented Apr 13, 2019

Does anyone working on this think this feature would be available soon? It’s the only thing that’s keeping me using Arpack.

@pablosanjose
Copy link

I believe KrylovKit.jl has this already, check it out.

@haampie
Copy link
Member

haampie commented Feb 18, 2024

I think ArnoldiMethod.jl is now the most stable and fastest option among ARPACK and KrylovKit (at least on the CPU).

Now that most work is done w.r.t. stability of the algorithm, it would be good to fix the API.

  • Allow users to pass v1
  • Allow users to pass an initial partial Schur decomposition (i.e. v1, v2, ..., vn)
  • Simpler helper partialeigen (i.e. matlab's eigs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants