Skip to content

Conversation

ev-br
Copy link
Contributor

@ev-br ev-br commented Apr 2, 2024

Add UnivariateSpline family of classes.

SciPy plans to refactor / rework the matching part of scipy.interpolate, the current SciPy proposal is to add two two new functions, make_splrep and make_splprep and slowly phase out splrep, splprep and *UnivariateSplines, see scipy/scipy#19970 . Since this is still under discussion in SciPy, here we add two layers:

  • new-style make_splrep : add internally but do not expose to the public API. If/when this lands in SciPy, CuPy will only need to add them to __init__ to expose them.
  • backwards compatible *UnivariateSpline classes. These reuse the make_splrep internally and adjust the API to match the venerable SciPy API.

The differences to the SciPy API are minimal:

  • FITPACK in SciPy has a limitation that the spline order is k <= 5. We do not have this limitation here.
  • UnivariateSpline.roots is not implemented. This is similar to other .roots methods which rely on solving the non-symmetric eigenvalue problem.

Also note that this PR only deals with construction of an interpolant. Once constructed, evaluations go through BSpline.__call__ method, so the runtime performance relates to BSpline.

This PR is on top of #8263, which adds a needed low-level kernel.

cross-ref #7186 for the tracker.

ev-br added 3 commits March 30, 2024 18:38
These are clones of the SciPy proposed versions,
cf scipy PR 19970.

Since these functions are not yet available in scipy main, do not
expose them, for now at least.
Internally reuse `make_splrep`, adjust the internals to match the
SciPy API.
@takagi takagi added this to the v14.0.0a1 milestone Apr 10, 2024
@takagi
Copy link
Contributor

takagi commented Apr 10, 2024

/test full

Copy link
Contributor

@takagi takagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@takagi takagi merged commit f9b6231 into cupy:main Apr 12, 2024
@takagi
Copy link
Contributor

takagi commented Apr 12, 2024

Thanks, @ev-br!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants