-
Notifications
You must be signed in to change notification settings - Fork 39
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
re-export VectorInterface? #88
Comments
In principle, the required interface to be fully compatible with KrylovKit is the full interface specified by VectorInterface. I think for now though, there are still fallback methods available that will automatically dispatch to LinearAlgebra's I think the easiest is to indeed add An alternative solution is to make use of the fact that KrylovKit already depends on VectorInterface, and do something like: import KrylovKit: VectorInterface
function VectorInterface.add(x::MyType, y::MyType, a::Number, b::Number)
# my implementation
end At the very least in the REPL this seems to work, and does not require an explicit dependency. Note that I do not know which of these is considered best practice, but I hope to get people's opinion on this matter soon, see this discourse post |
Up till version 0.6, we required Since v0.7, we switched to depending on VectorInterface, by which we can support a much larger range of types (such as nested arrays, tuples, …) out of the box. In particular, from VectorInterface we use both the non-mutating functions ( As @lkdvos mentioned, VectorInterface is a dependency of KrylovKit. We did not reexport it in order not to pollute the namespace, but you can indeed import VectorInterface from KrylovKit as mentioned there. As for which methods to extend, it also depends a bit. For We might think about some way to automate generating these method definitions (since there are quite a few) for new types, e.g. using a macro where you just specify your type, whether the data can be mutated, and whether the implementation should be lowering to e.g. |
Thank you for your helpful comments. In the end I implemented the interface using |
Can you help me a bit with it please? It gives me NaN that were not there before and this block tagging a new version of BifurcationKit I am doing this
|
Just guessing, but if similar has nans in its unitialized memory, then 0 * … will preserve those. That’s a difference between Julia semantics and BLAS. Maybe use some version of fill! |
OK will try, thank you |
I think the cleanest way is something like: In principle you can use a similar approach for all other functions, by defining them recursively, as vectorinterface should work on most |
Ah interesting |
Did everything work out for you? |
Yeah, I agree, I should add VI to my project.toml which is not what I do at the moment |
Hi,
I rely on KK for BifurcationKit.jl. In particular, I implemented a type BorderedArray
It seems the only method I need to add is
add
. First, I thought havingaxpby!
defined would not require to implementadd
since I havesimilar
andcopy
. Can you confirm this ?In the case I really need to add the method
add
, I need toimport VectorInferface: add
which requires to addVectorInterface
as a dependency to BifurcationKit. Is this really necessary?The text was updated successfully, but these errors were encountered: