-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Enable use of keywords save_idxs, saveat, save_start, save_everystep, and dense #19
Conversation
I do not know why but apparently the build on Windows 32bit again fails because of some error bounds, (see #17 (comment)): https://ci.appveyor.com/project/ChrisRackauckas/delaydiffeq-jl/build/1.0.85/job/i2n6fykov52cueo0 I did not even change those bounds... Tests pass on all other architectures. |
src/solve.jl
Outdated
# calculate and add errors to solution if analytic solution to problem exists | ||
# can not use same mechanism as for ODE problems since analytic solutions for DDE depend | ||
# on initial value u0 | ||
if integrator.opts.save_everystep && isempty(integrator.opts.saveat) |
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.
Can this be pulled out to a function call on the integrator? It would make solve
a bit more legible.
src/solve.jl
Outdated
errors = nothing | ||
end | ||
|
||
if integrator.opts.dense |
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.
Pull this out to a function too?
src/utils.jl
Outdated
|
||
if !needed | ||
# delete not required time point, function value, and interpolation data | ||
deleteat!(integrator.integrator.sol.t, integrator.saveiter + 1) |
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.
won't deleateat! be slow to do one-by-one, and it would be much faster to just do the change at the end? I am not sure why this is needed if you're also doing the other thing at the end.
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.
It's not necessary to delete these entries, but I wanted to check if there is any benefit in deleting unneeded entries already during the algorithm.
The problem is that the entries that can be deleted do not have to be successive entries - some entries might be needed to calculate interpolated values of the output solution whereas others can be removed completely... Maybe one could completely remove these entries and only keep the interpolated values - but I do not know if this could cause other problems....
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'd run timings on it. I know Julia amortizes push!
, but I think it might re-allocate with eery deleteat!
and subsequently ignore the amortization, making it quite expensive to delateat!
very often. I would only want to use this code path then in cases where I have a really tight RAM limit that I am hitting. It would probably be good to keep it as an option.
Cool, that was it. Tests pass. So after moving those pieces out to a function and making an option for the |
1 similar comment
Currently HDF5 has build errors on Windows 32bit:
I noticed the same errors some days ago when I tried to debug the Windows 32bit error but it was gone after some hours. So probably we can just try to restart the tests til it works... |
At least Travis CI builds pass but there's still the download error on Windows 32bit... |
well since it did run Win32 once and pass I'm pretty confident it's fixed. Since all of the changes are made I'll merge now. Of course, this will be re-run in the future, so if the test fails when the caching gets fixed we can open it up again. |
Codecov Report
@@ Coverage Diff @@
## master #19 +/- ##
==========================================
+ Coverage 78.04% 82.08% +4.04%
==========================================
Files 8 9 +1
Lines 164 268 +104
==========================================
+ Hits 128 220 +92
- Misses 36 48 +12
Continue to review full report at Codecov.
|
This PR tries to solve the same issues as #18. Parameter estimation would be simplified when these keywords can be applied. Currently, the use of
save_idxs
andsave_start
is (usually) not possible, and the use ofsaveat
,save_everystep
, anddense
leads to incorrect solutions. In contrast to the old PR this implementation does not use a second, separate solution with specified indices and time points immediately, but only after all calculations are done.Moreover, if the final solution is not dense and does only contain time points specified by
saveat
, the ODE solution is already reduced during the calculations, i.e. time points that are not required for accurate interpolation of the time points specified bysaveat
are removed as soon as they are not needed anymore to correctly calculate the next step.Some simple benchmarks comparing current master, the old PR, and this PR are available at https://gist.github.com/devmotion/97a1c30df6fe7e0774b6456cc0240a24.