BifurcationKit.jl
BifurcationKit.jl copied to clipboard
Joint function for Evaluation and Jacobian ?
Hi, I am thinking about using your package. My first try would be to join this with my package VoronoiFVM.jl. I understand that for the problem call back one can either pass F(x,p) or F(x,p) and J(x,p) together.
As in my code I am calculating F and (sparse) J at the same time using ForwardDiff and DiffResults I wonder if it would be possible to have another option which allows to pass something like F_and_J(x,p) ?
Hi,
I am not sure I can do what you are asking for because it would impair the use of iterative methods (for example). However, I think you can minimize the wastes by using a struct which caches the jacobian and Fvalue and "your" functions would return those values to my package.
I already thought about the caching option, wouldn't mind to do it this way. However I need to know when to "re-cache".
Can I assume that for given x, both F and J are called exactly once, respectively ? Or are there cases when F is called and there is no call to J or vice versa ?
I would like to use two flags storing if F resp. J has been called, and I would re-cache and reset the flags on the next invocation.
Can I assume that for given x, both F and J are called exactly once, respectively
Pretty much I guess, everything is in newton
or newtonPALC
. J is called an extra time for eigenvalue detection in Utils.jl
but coming after newtonPALC
, it should be the same x
.
Had a look into the code - in newtonPALC we also need to take into account the parameters. Just relying on the call pattern appears to be quite brittle... Thinking about storing hashes of x and p now . This should be O(N) and little work compared to the rest.
julia> myhash(X)=sum((x)->hash(x),X)
myhash (generic function with 1 method)
julia> Y=collect(1:0.0001:100);
julia> @time myhash(Y)
0.037302 seconds (119.07 k allocations: 5.307 MiB)
0xe408239bb83608ce
julia> @time myhash(Y)
0.004938 seconds (1 allocation: 16 bytes)
0xe408239bb83608ce
julia> Y[1000]+=1.0e-8
1.09990001
julia> @time myhash(Y)
0.003233 seconds (1 allocation: 16 bytes)
0xb9204860d37e4879
julia>
So this might do (Julia hash() would give a collision here).
Le 29 juillet 2020 17:14:40 j-fu [email protected] a écrit :
Had a look into the code - in newtonPALC we also need to take into account the parameters. Just relying on the call pattern appears to be quite brittle... Thinking about storing hashes of x and p now .
you should think of x and p as a whole in this context. if i were to ask for dpF would it simplify your work ( i would remove the FD approx in newtonPALC)?
This should be O(N) and little work compared to the rest.
julia> myhash(X)=sum((x)->hash(x),X) myhash (generic function with 1 method)
julia> Y=collect(1:0.0001:100);
julia> @time myhash(Y) 0.037302 seconds (119.07 k allocations: 5.307 MiB) 0xe408239bb83608ce
julia> @time myhash(Y) 0.004938 seconds (1 allocation: 16 bytes) 0xe408239bb83608ce
julia> Y[1000]+=1.0e-8 1.09990001
julia> @time myhash(Y) 0.003233 seconds (1 allocation: 16 bytes) 0xb9204860d37e4879
julia> So this might do (Julia hash() would give a collision here).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Envoyé avec AquaMail pour Android https://www.mobisystems.com/aqua-mail
I was thinking to ask about this. From a robustness POV, asking for dpF IMHO would be a better choice. I don't have this functionality in Julia yet (in our C++ path following code we do it this way, but we have not many resources to maintain and develop it, especially for all the bifurcation detection stuff you already did, and then our nonlinearities are becoming nightmares...).
I have plans to add the dpF creation resulting in a vector via autodiff.
BTW currently I am just investigating these things for setting up my mind, I hope to find time to work on it in September.
BTW currently I am just investigating these things for setting up my mind, I hope to find time to work on it in September.
Me too, I cannot do it right now. BTW, did you try my package in conjonction with yours?
Not yet - with this discussion I tried to clarify what I need to do, now it is pretty clear. I plan this for September...