-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
ENH: add BSpline.insert_knot
method
#19777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cursory comments
The `x` parameter was documented as array_like, but in fact only scalars are accepted.
to mirror FITPACK's `insert` routine.
There was a problem hiding this 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.
There was a problem hiding this 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!
Core dev approved, has no backwards compat issues. Merging in. Thanks for tge reviews @j-bowhay , @h-vetinari |
What does this implement/fix?
Add a
BSpline.insert_knot
method to parallel the module-levelinsert
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
incursm
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.