-
-
Notifications
You must be signed in to change notification settings - Fork 58
Description
Is your feature request related to a problem? Please describe.
Distinction between data-reproducing interpolation methods
from non-data-reproducing interpolation methods.
Describe the solution you’d like
Instead of directly subtyping AbstractInterpolation,
Introduce a hierarchy:
AbstractReproducingInterpolation <: AbstractInterpolation
AbstractNonReproducingInterpolation <: AbstractInterpolationFor example
LinearInterpolation <: AbstractReproducingInterpolation
SmoothedConstantInterpolation <: AbstractNonReproducingInterpolationI'm not sure how I feel about the name though.
Feel free to use a better one you can think of.
Describe alternatives you’ve considered
Traits? Tim Holy Traits which seems overkill.
Any traiting implementation seems overkill.
Unless there's more functionality someone wants that would be better with traits than with a type hierarchy.
Also directly manually listing the reproducers.
The advantage of this is that I'd still have to define
the interpolator with options, e.g.
reproducers = [
LinearInterpolation
QuadraticInterpolation
(u, t) -> QuadraticInterpolation(u, t; :Backward)
LagrangeInterpolation
AkimaInterpolationConstantInterpolation
QuadraticSplineInterpolation
CubicSplineInterpolation
BSplineInterpolation
CubicHermiteSpline
PCHIPInterpolation
QuinticHermiteSpline
# ...etc.
]But it would be shorter with my FR anyway, e.g.
reproducers = [
subtypes(AbstractReproducingInterpolation);
(u, t) -> QuadraticInterpolation(u, t; :Backward)
]Additional context
The type of interpolation a user wants can be generalised
while restricting the choice of interpolator to one that replicates the data.
Also motivated by designing wrappers for DimensionalData objects.
The test that the interpolators reproduce the data can only apply to
AbstractReproducingInterpolations.
I'm happy to submit a PR if everyone's happy with this idea.