-
-
Notifications
You must be signed in to change notification settings - Fork 242
Tableau Implementation for Tsit5 #2913
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
base: master
Are you sure you want to change the base?
Tableau Implementation for Tsit5 #2913
Conversation
|
@ChrisRackauckas : Request you to kindly review this PR and provide your feedback |
| """ | ||
| Evaluate a polynomial at Θ, given coefficients for Θ¹, Θ², ..., Θ⁶. | ||
| Assumes coeffs = [a₁, a₂, ..., a₆] for Θ¹, Θ², ..., Θ⁶. | ||
| """ | ||
| function eval_poly_theta(Θ, coeffs) | ||
| # coeffs[1]*Θ + coeffs[2]*Θ^2 + ... + coeffs[6]*Θ^6 | ||
| return sum(coeffs[i] * Θ^i for i in 1:length(coeffs)) | ||
| 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.
isn't this just evalpoly?
| [@evalpoly(Θ, tableau[i,:]...) for i in 1:num_stages] | ||
| else | ||
| # For derivative: d/dΘ [a₀ + a₁*Θ + a₂*Θ² + ...] = a₁ + 2*a₂*Θ + 3*a₃*Θ² + ... | ||
| [@evalpoly(Θ, [j * tableau[i, j+1] for j in 1:(num_coeffs-1)]...) for i in 1:num_stages] |
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.
@oscardssmith : Thanks for the feedback and suggestion. Apologies I was not familiar with this. Could you please check if this change looks right?
|
Sorry was trying to get this repo passing tests again first. This should just be added as part of the normal ExplicitRK implementation. With a field for the interpolation values added to the Note this is the same tableau as the one that is tested https://github.com/SciML/DiffEqDevTools.jl/blob/master/src/ode_tableaus.jl#L989 |
|
Thank you for these updates. I will work on what you said and send you a new PR tomorrow. |
|
@ChrisRackauckas Could you please review the changes I have made? I will do some more testing, but I wanted to know if I have incorporated your suggestions. I have also created a new PR in DiffEqBase, can you please review that as well? Thanks! |
|
all of the generic_dense parts are missing? |
@ChrisRackauckas Does this involve implementing equivalent logic as in
|
|
Yes exactly, just for the ExplicitRK tableau with its generic coefficient vector. |
@ChrisRackauckas Could you please review this PR and provide your feedback? I have implemented this based on my understanding of how it was implemented for Tsit5 in this code here, but I made it generic for different orders. |
| function construct_tsit5_interp_matrix_auto(T::Type) | ||
| if T <: Union{Float32, Float64} | ||
| return construct_tsit5_interp_matrix(T) | ||
| else | ||
| return construct_tsit5_interp_matrix_highprecision(T) |
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.
this hsould just be dispatch
| Automatically selects appropriate precision based on type. | ||
| """ | ||
| function construct_tsit5_interp_matrix_auto(T::Type) |
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.
| function construct_tsit5_interp_matrix_auto(T::Type) | |
| function construct_tsit5_interp_matrix_auto(::Type{T}) where T |
force specialize
| High-precision version for BigFloat and other arbitrary-precision types. | ||
| We have not tested this | ||
| """ | ||
| function construct_tsit5_interp_matrix_highprecision(T::Type) |
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.
| function construct_tsit5_interp_matrix_highprecision(T::Type) | |
| function construct_tsit5_interp_matrix_highprecision(::Type{T}) where T |
| ... and so on for all 7 stages | ||
| = | ||
| """ | ||
| function construct_tsit5_interp_matrix(T::Type = Float64) |
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.
| function construct_tsit5_interp_matrix(T::Type = Float64) | |
| function construct_tsit5_interp_matrix(::Type{Float64}) |
| end | ||
|
|
||
| # In-place version | ||
| function generic_rk_interpolant!(out, Θ, dt, y₀, k, B_interp; idxs=nothing, order=0) |
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.
these aren't implementing the dense.jl dispatches required for the interpolation to be used in the solution. Check OrdinaryDiffEqCore/src/dense. See how it's done for example with OrdinaryDiffEqVerner.
|
Sorry got behind having to revive a bit of this repo. Left some comments. Still some work to do here but on the right track |
|
@ChrisRackauckas In the latest PR, I have incorporated the logic for dense interpolation and also addressed your comments on force specialization and dispatch support. I will now work on benchmarking and functional tests for these changes. |
|
@ChrisRackauckas Could you please review this pull request? |
|
Could you please review the pull request that I sent a link to? Thanks! |
|
That looks right. Is that PR not to here? |
|
Yes, it is. Is the PR ready to be merged? |
|
if tests are passing. needs a rebase and then those changes and yeah it looks like that makes it ready |
@ChrisRackauckas, thanks for your feedback. I will work on rebasing the PR, running the test, and getting the PR ready for landing. Is there anything I can work on in parallel? I have a (slightly) better understanding of the codebase from the work I have done so far, and I would love to pick up any medium/large work to get a better understanding and contribute more. Also if you have any feedback on my work so far - specifically on what I can improve - I would greatly appreciate it. I also wanted to say that this work is really interesting and wanted to thank you for the opportunity you provided. |
In this PR, I have attempted to implement the butcher tableau approach for the Tsit5 algorithm for both solving and interpolation.
I have used the coefficient values from OrdinaryDiffEqExplicitRK. I am working on extending the benchmark tests for interpolation.
Please review my changes and provide feedback for the following: