Add convexity-constrained fitting and knot insertion#43
Merged
Conversation
- New fitpack_convex_curve type wrapping concon (automatic knots) and cocosp (least-squares with given knots) for local convexity/concavity constraints on cubic splines - Add insert_knot method to fitpack_curve (single and multiple, with automatic storage growth and periodic curve support) - Add FP_BOOL comm helpers (size/pack/expand) for logical array round-trip communication - Add CONCON_MAXBIN, CONCON_MAXTR, CONCON_QP_FAIL error constants - 4 new tests: convex fit, convex least-squares, knot insertion, periodic knot insertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fitpack_convex_curvetype wrappingconcon(automatic knots) andcocosp(least-squares with given knots) for local convexity/concavity constraints on cubic splines — a unique FITPACK capability that SciPy has never wrappedinsert_knotmethod tofitpack_curve(single and multiple knots, with automatic storage growth and periodic curve support viainsert_inplace)FP_BOOLcomm helpers (FP_BOOL_COMM_SIZE_1D,PACK_1D,EXPAND_1D) for logical array round-trip communicationCONCON_MAXBIN,CONCON_MAXTR,CONCON_QP_FAILerror constants withFITPACK_MESSAGEsupportNew files
src/fitpack_convex_curves.f90—fitpack_convex_curvetype withfit(concon),least_squares(cocosp),set_convexity, full comm supportTest plan
test_convex_fit— mncoco data, concave constraints, 3 smoothing levels, verifies s''(x) <= 0test_convex_least_squares— mncosp data, convex and concave cases via cocosptest_insert_knot— sine curve, verifies knot count +1 and values unchanged to machine precisiontest_insert_knot_periodic— periodic curve, same verification