This repository was archived by the owner on Sep 9, 2024. It is now read-only.
WIP: Make coefficients Rational for better generics#60
Closed
tomasaschan wants to merge 1 commit intomasterfrom
Closed
WIP: Make coefficients Rational for better generics#60tomasaschan wants to merge 1 commit intomasterfrom
tomasaschan wants to merge 1 commit intomasterfrom
Conversation
Contributor
Author
|
(The build failures are because Coveralls doesn't work on 0.4 - all our tests pass on both versions...) |
Contributor
|
The original paper by Kaps and Rentrop (1979) doesn't give ratios for the GRK4T coefficients, so presumably they are not know/don't exist. |
Contributor
|
One problem is that conversion of constant rational coefficients to floating-point cannot be done at compile time, so we have to be cautious about using these in inner loops. |
Contributor
|
Could/should Probably better convert the table before the inner loops to the used float-type. |
8 tasks
Contributor
|
I think this has been addressed by #68, right? |
Contributor
Author
|
So it would seem. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is still just WIP, but I need some advice to keep this moving.
@pwl mentioned that it might be a good idea to convert all the coefficients in this code to rational, to make generic programming easier. I agree, since
Float64is quite poisonous in this aspect; the promotion of almost anything and aFloat64will be aFloat64. We've discussed before how to handle inputs of types that don't make sense in an ODE context and agreed that converting to floats is the most rational (heh...) thing to do, but there still might, for example, be applications forFloat32arguments, or arguments of some user-defined number type, where we don't want to forceFloat64s on the user.The PR currently only converts the coefficient tables that were already specified as fractions, but there is one table that wasn't (and I couldn't find a reference where it was) and there's also a bunch of coefficients and constants scattered throughout the various solvers, which are all specified as
Float64literals. Do we want to try to make something more sensible with those? What?It could also be argued that making the code generic yet type stable is too complicated to be worth the effort, in which case it's a good thing that I didn't spend more than a few minutes on this PR yet. (But I'd hate to end the discussion about this with "a
Float64ought to be enough for anyone"...)