-
Notifications
You must be signed in to change notification settings - Fork 47
clarify Krylov.jl scope #95
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
Conversation
|
I guess the any Datatype is meant with respect to the operator, and not so much the vectors, which still have to be AbstractVector, or am I wrong in this? (Not that I think it matters too much, but that would be the main difference between these packages I think?) |
|
Yes, you are right @lkdvos. The workspace of each Krylov method is still composed of abstract vectors ( The operator If the user wants a specific type in the workspace, they need to wrap it in a custom wrapper and define a few routines for this type: struct FakeVector{T, V} <: AbstractVector{T}
field::V
end
Krylov.knorm(n::Integer, x::FakeVector{T, V}) where {T, V} = ...
Krylov.kdot(n::Integer, x::FakeVector{T, V}, y::FakeVector{T, V}) where {T, V} = ...
Krylov.kscal!(n::Integer, s::T, x::FakeVector{T, V}) where {T, V} = ...
Krylov.kaxpy!(n::Integer, s::T, x::FakeVector{T, V}, y::FakeVector{T, V}) where {T, V} = ...
Krylov.kaxpby!(n::Integer, s::T, x::FakeVector{T, V}, t::T, y::FakeVector{T, V}) where {T, V} = ...
Krylov.kcopy!(n::Integer, y::FakeVector{T, V}, x::FakeVector{T, V}) where {T, V} = ...
Krylov.kfill!(x::FakeVector{T, V}, val::T) where {T, V} = ...It's the best compromise I've found so far between flexibility and performance. |
|
This seems very similar (at least in terms of functionality) to the (mutating) interface imposed by VectorInterface.jl, on which also KrylovKit.jl is built and which is a very light-weight dependency. So shamelessly self-promoting, would you not be willing to consider using that interface instead? That would make it easy for users to just implement just one interface, and then gives them the flexibility to try out both Krylov.jl and KrylovKit.jl Some questions also emerge from your comment:
|
Very interesting package! I was not aware of it. Initially, I designed this interface with routines
The argument
Yes,
For non-block Krylov methods, you can't use BLAS level 2 operations in many solvers (except for the operator-vector products). The only methods where we could use them are GMRES, FOM, FGMRES, and GPMR. However, the gain is limited because we need to rely on views for other operations, which don’t work well on GPUs. Furthermore, storing the Krylov vectors as a vector of vectors allows us to easily extend the basis if we don’t restart GMRES and similar methods, whereas using a matrix would require |
No description provided.