Skip to content

Conversation

ev-br
Copy link
Member

@ev-br ev-br commented Dec 29, 2023

What does this implement/fix?

Add a BSpline.insert_knot method to parallel the module-level insert routine. The latter is a wrapper around FITPACK, and the new routine has a small cython snippet instead.

This can be further optimized, especially for multiple knots: ATM m > 1 incurs m allocations, each being linear in data. However for the first version let's keep it simple, and optimize on a user request.

To get feature-completeness, still need to port FITPACK's handling of periodic boundary conditions. this is done now.

Additional information

This PR only adds functionality, and does not remove anything Fortran, not just yet.

@ev-br ev-br added enhancement A new feature or improvement scipy.interpolate labels Dec 29, 2023
Copy link
Member

@j-bowhay j-bowhay left a comment

Choose a reason for hiding this comment

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

Some cursory comments

@rgommers rgommers added this to the 1.13.0 milestone Jan 2, 2024
Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

I tried to have a look here, and AFAICT, things look pretty good. I don't know the classes involved here very well though, and I don't undersand everything, especially not what's happening with self.k and slicing backwards.

The variable naming in the new tests is also not ideal (spl, spl_1f, spl_1), but the tests do indicate that the implementation essentially matches our existing wrappers, so that's a great status already.

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

With the same minor caveats as before (I'm not all that familiar with the code; some variable names could be improved), this LGTM!

@lucascolley lucascolley added the Cython Issues with the internal Cython code base label Mar 12, 2024
@ev-br
Copy link
Member Author

ev-br commented Mar 17, 2024

Core dev approved, has no backwards compat issues. Merging in. Thanks for tge reviews @j-bowhay , @h-vetinari

@ev-br ev-br merged commit 5c8b806 into scipy:main Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cython Issues with the internal Cython code base enhancement A new feature or improvement scipy.interpolate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants