-
Notifications
You must be signed in to change notification settings - Fork 23
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
Introducing TaylorSolution
#192
Conversation
I haven't begun reviewing this PR. Yet, from the comment motivating this PR, I think the evaluation |
Thanks for the comment! I agree this PR still has to be polished a bit. Currently there is already in place a mechanism to save the polynomial coefficients only when |
In an offline discussion with @LuEdRaMo, we discussed how easy can it be to adapt this proposal with the binary-tree structure involved in ADS; see #178. The crutial aspect are the fields The point I want to rise is, if Thoughs are welcome... |
Co-authored-by: Luis Benet <[email protected]>
LGTM! Thanks a lot! Have you had chance to look up the performance impact of this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just left 4 suggestions (remove @time
from some tests). Aside from that, I think we should simply bump the minor version, merge and register
Thanks, I added those to run some checks; I've removed them now.
Just as a way to help users, I would go actually for bumping the patch version with deprecations (I went ahead and added some in src/deprecated.jl as well as a |
Co-authored-by: Luis Benet <[email protected]>
As you prefer; I though about the minor version because it is a (quite) breaking release, which is not backward compatible (in the sense of the returned types/content of, say, |
I'm trying now to have some very naive benchmarks... |
I run (two) extremely naive benchmarks, based on the time reported by the tests for jet transport and taylorize (second run of |
I'm also running some naive timings on 3000 steps of the Kepler problem with 2nd-order jet transport: varorder = 2 #the order of the variational expansion
p = set_variables("ξ", numvars=4, order=varorder) #TaylorN setup
q0 = [0.2, 0.0, 0.0, 3.0]
q0TN = q0 + p # JT initial condition
t0 = 0.0
tf = (2π)*20
@taylorize function kepler1!(dq, q, p, t)
local μ = -1.0
r_p2 = ( (q[1]^2) + (q[2]^2) )
r_p3d2 = r_p2^1.5
dq[1] = q[3]
dq[2] = q[4]
newtonianCoeff = μ / r_p3d2
dq[3] = q[1] * newtonianCoeff
dq[4] = q[2] * newtonianCoeff
return nothing
end On v0.15.2: @time taylorinteg(kepler1!, q0TN, t0, tf, 25, 1e-20, Val(true), maxsteps=3000);
# 4.353918 seconds (18.52 M allocations: 1.403 GiB, 4.02% gc time) On @time taylorinteg(kepler1!, q0TN, t0, tf, 25, 1e-20, Val(true), maxsteps=3000);
# 4.295033 seconds (13.29 M allocations: 1013.443 MiB, 4.12% gc time) On @time taylorinteg(kepler1!, q0TN, t0, tf, 25, 1e-20, maxsteps=3000, dense=true);
# 2.970461 seconds (12.05 M allocations: 989.286 MiB, 8.68% gc time) Does this look more or less similar to what you're seeing? |
Yes, they seem consistent wrt to the elapsed time; I'm not checking allocations, but I can guess that they reproduce your results. So, aside from the depration message, I am in favor of merging and registering the new version! Thanks truly a lot! |
Ah, you're right, I've not managed to catch all the deprecations so indeed if we release a patch version like this dependant code will break. The clean way would be to catch all deprecated behavior, but this is something I overlooked at the beginning of this PR and to do it now would be a bit of a hassle. So indeed perhaps it'd be better to go straight for the minor version, without deprecations (and I'll add a breaking changes section to the release notes). |
So, let's go for the minor version patch then!! |
This PR introduces the
TaylorSolution
struct, a return type fortaylorinteg
output. In summary, whereas we now currently do:the
t
and thex
are now wrapped in aTaylorSolution
, such thatwhere
sol isa TaylorSolution
and we can retrieve the output time vector and solution array fromsol.t, sol.x
. Dense output is also now supported via thedense = true
keyword, such that a solutionsol
can be called at timet
assol(t)
to return the value of the solution att
. Here, "interpolation" occurs by simply evaluating the Taylor series polynomial at the appropriate time, thanks to time-step control ensuring the Taylor polynomial can be expanded at any time within the time-step size. In the proposed behavior, whendense = false
, simply no dense output is produced. Besides some reworking of the TaylorIntegration internals, the DiffEq interface has also been updated, such that dense output is now also supported (we get dense output almost for free in the common interface just by adding the appropriate dispatches).This PR depends on JuliaDiff/TaylorSeries.jl#355 to work properly.(UPDATE: this PR no longer requires JuliaDiff/TaylorSeries.jl#355 to work properly).A quick example how things work:
Points to solve before merging:
TaylorSolution
for root-finding and Lyapunov spectrumtaylorinteg
specializations(still in the works). Update: a working version is now in place.TaylorSolution
struct for ADS integrations (WIP: Automatic Domain Splitting #178).