This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
WIP: Make coefficients Rational for better generics #60
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
Float64
is quite poisonous in this aspect; the promotion of almost anything and aFloat64
will 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 forFloat32
arguments, or arguments of some user-defined number type, where we don't want to forceFloat64
s 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
Float64
literals. 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
Float64
ought to be enough for anyone"...)