Skip to content

Label (a la traits) interpolators that reproduce the data from those that don't #462

@kapple19

Description

@kapple19

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 <: AbstractInterpolation

For example

LinearInterpolation <: AbstractReproducingInterpolation
SmoothedConstantInterpolation <: AbstractNonReproducingInterpolation

I'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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions