Repository navigation
AkimaInterpolation: opt-in tol keyword for the small-weight cutoff; fix 2-point slopes - #631
asinghvi17 wants to merge 31 commits into
Conversation
…iter) Adds `MonotonicMakimaInterpolation(u, t; kwargs...)`, a shape-preserving variant of makima. Like `PCHIPInterpolation`, it computes knot slopes and returns a `CubicHermiteSpline`, so extrapolation, derivatives, integrals and `cache_parameters` work as for any Hermite spline. The slopes are: 1. the makima slopes of `AkimaInterpolation(u, t; modified = true)`, reusing the existing kernel (split out of `_akima_init!` as `_akima_slopes!`); 2. a sign pass that zeroes a slope whose sign differs from an adjacent secant, or whose adjacent secant is zero (flat segments stay flat); 3. a square Fritsch-Carlson limiter: per segment, left to right, if max(alpha, beta) > 3 both end slopes are scaled by 3 / max(alpha, beta). Where steps 2 and 3 do not act, the result is identical to makima. Also fixes `AkimaInterpolation` with two points, which read an uninitialized ghost secant; it now gives the straight line through the two points. The per-dimension wrappers of `du_PCHIP` are generalized into `_du_per_dimension` and shared by both slope kernels. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Harness: claude Model: claude-opus-5-5 Factory-Task: 22fff5cb-ab23-4f6c-a31f-195f557afeb0 Agent-Harness: Claude 2.1.319 Agent-Model: claude-opus-5-5 Agent-Session: factory task 22fff5cb-ab23-4f6c-a31f-195f557afeb0 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
…, β) When max(α, β) > 3 on a segment, compute r = 3 / max(α, β) once and multiply both end slopes by it. This is the conventional form of the square rule. Previously the slopes were set to 3s * (α / max(α, β)) and 3s * (β / max(α, β)), which made the larger one exactly 3s; now it is 3s up to rounding (a few ulps). Since r <= 1, a limited slope still never grows. The docstring describes the rounding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Harness: claude Model: claude-opus-5-5 Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f Agent-Harness: Claude 2.1.319 Agent-Model: claude-opus-5-5 Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Reduce the MonotonicMakimaInterpolation tests to a compact set: monotone output on a few random tables, equality with makima where the limiter is inactive, flat segments, limiter scaling (checks du == r * makima slope), 2-point tables, and an extrapolation/caching smoke test, plus derivative checks against finite differences for Vector and Matrix data. Drop the 200-case sweep, the redundant edge cases, the integral testset and the second docs example. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Harness: claude Model: claude-opus-5-5 Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f Agent-Harness: Claude 2.1.319 Agent-Model: claude-opus-5-5 Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Used in the citation "SIAM J. Numer. Anal." in the MonotonicMakimaInterpolation docstring. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Harness: claude Model: claude-opus-5-5 Factory-Task: 8d831c30-b5f6-4950-9cba-449eed9c4c5f Agent-Harness: Claude 2.1.319 Agent-Model: claude-opus-5-5 Agent-Session: factory task 8d831c30-b5f6-4950-9cba-449eed9c4c5f on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Add a `tol` keyword (default 1e-9) for the relative small-weight cutoff kept in SciML#615 (SciML#614). The default keeps the cutoff, blend and max(w1, w2) rescaling, so default outputs are bitwise unchanged. `tol = 0` opts in to the exact rule: the rescaled weighted mean wherever w1 + w2 != 0; where both weights are zero, slope 0 for makima and the existing fallback for classic Akima (which keeps collinear data straight). Branch decisions use primal values, so zero `Dual` weights do not take the 0/0 path. With two points the end slopes were extrapolated from an unset ghost slope, giving wrong knot slopes in both modes. Two points now give the straight line through them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Harness: claude Model: claude-opus-5-5 Factory-Task: 039c10ce-296b-4919-a30b-99ae880a2250 Agent-Harness: Claude 2.1.319 Agent-Model: claude-opus-5-5 Agent-Session: factory task 039c10ce-296b-4919-a30b-99ae880a2250 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
|
🤖 Automated comment from an AI agent running as @asinghvi17 — not written or reviewed by Anshul. A note on default behaviour: with the default 🤖 Posted by an AI agent — harness: Claude 2.1.316 · model: claude-opus-5-5 |
Independent review (Codex CLI v0.164.0 / gpt-6.1-sol), reviewer session 01a1cf3c-725b-7ab1-9c74-c682ee3f8d52, reviewed head d2849e5
This is a blind code-only review by a session other than the PR author's, copied below from the reviewer's report with only the grading metadata removed. The posting agent did not re-run the reviewer's commands. A MERGE verdict is advice; merging is left to the maintainers. CI: green Riskmedium-low (ML1: Akima constructor result correction; the analytic two-point regression fails on base and passes at head. The optional cutoff also matches L8.) Blocking findings
Non-blocking findingsNone. What I ranReviewer: codex-cli 0.164.0, model gpt-6.1-sol. Review remained blind to PR discussion and author/reviewer ratings. Used Julia 1.13.2 with the checkout's Project.toml dependency/compatibility constraints resolved into
What I did not verifyNo repository Julia manifest, Python project, or uv.lock exists, so no project-locked interpreter/dependency environment was available. Julia testing used the resolved scratch manifest. Did not run QA, documentation builds, the complete Extensions group, other Julia versions, or 32-bit tests. CI green is supplied task metadata; CI and GitHub discussion were not queried.
🤖 Posted by an AI agent — harness: Claude Code 2.1.322 · model: claude-sonnet-5-5 |
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 031f1039-f80a-483c-925b-8c42fd463210 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 031f1039-f80a-483c-925b-8c42fd463210 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 031f1039-f80a-483c-925b-8c42fd463210 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 031f1039-f80a-483c-925b-8c42fd463210 on m_e7dafdb55d0afc98861a124723a9e3fd (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 2ac96216-b848-4d94-88f8-f574017c8dbc Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 2ac96216-b848-4d94-88f8-f574017c8dbc on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
PR: #631 Reviewed head: d901454 Risk assessment
Review reportVERDICT: CHANGES Riskmedium-low (ML2: changes knot-slope arithmetic in the explicitly selected Akima algorithm. Analytic checks fail before and pass after for the corrected cases.) Blocking findings
Non-blocking findingsNone. What I ranJulia 1.13.2 with a scratch manifest resolved from the checkout's
What I did not verifyThe checkout has no Julia manifest, Python project or AUTHOR_GRADE: {"task":"bugfix","score":4,"difficulty":3,"rounds":2,"author_harness":"Codex 0.164.0","author_model":"gpt-6.1-sol","note":"The denominator change fixes the analytic total-weight overflow case for both Akima variants and both float types. Exact makima still overflows while forming a representable weight from large secants."} Head link: d901454 🤖 Posted by an AI agent — harness: codex-cli 0.169.0 · model: gpt-6.2-sol |
PR: #631 Reviewed head: d901454 Risk assessment
Review reportVERDICT: CHANGES Riskmedium (M1: the new public Akima tolerance ships with changes to existing two-point construction and differentiation with respect to sample values) Blocking findings
Non-blocking findings
What I ran
What I did not verify
AUTHOR_GRADE: {"task":"feature","score":3,"difficulty":3,"rounds":1,"author_harness":"Codex 0.164.0","author_model":"gpt-6.1-sol","note":"The two-point and default AD fixes passed independent base/head probes, and Core and Methods passed. Three analytic probes exposed incorrect results in the new tolerance modes."} Head link: d901454 🤖 Posted by an AI agent — harness: codex-cli 0.170.0 · model: gpt-6.2-sol |
…2e41-47a8-8635-15c5133b4b97 Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 54ce7f1a-e0fd-4f17-8b5d-7e71282cac53 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 54ce7f1a-e0fd-4f17-8b5d-7e71282cac53 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: c4e20194-2e41-47a8-8635-15c5133b4b97 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task c4e20194-2e41-47a8-8635-15c5133b4b97 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
…bc7a-4440-9a18-f13d56d6903b Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: cc4e335e-bc7a-4440-9a18-f13d56d6903b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task cc4e335e-bc7a-4440-9a18-f13d56d6903b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
…tions Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 8f79f865-240e-43ce-9978-992529c69b9b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 8f79f865-240e-43ce-9978-992529c69b9b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 8f79f865-240e-43ce-9978-992529c69b9b Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 8f79f865-240e-43ce-9978-992529c69b9b on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 790d3fbb-abe2-4a50-9b19-5f16735690d4 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 790d3fbb-abe2-4a50-9b19-5f16735690d4 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 6f1b2a92-4cac-4a34-b961-04efbb1da616 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 6f1b2a92-4cac-4a34-b961-04efbb1da616 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 6f1b2a92-4cac-4a34-b961-04efbb1da616 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 6f1b2a92-4cac-4a34-b961-04efbb1da616 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
Co-Authored-By: Anshul Singhvi <anshul.singhvi@juliahub.com> Co-Authored-By: Codex <noreply@openai.com> Harness: codex Model: gpt-6.1-sol Factory-Task: 6f1b2a92-4cac-4a34-b961-04efbb1da616 Agent-Harness: Codex 0.164.0 Agent-Model: gpt-6.1-sol Agent-Session: factory task 6f1b2a92-4cac-4a34-b961-04efbb1da616 on m_3e9b2709b53bf4c4dade6cc909217625 (no session URL)
🤖 Automated comment from an AI agent running as @asinghvi17 — not written or reviewed by Anshul.
Adds a
tolkeyword for the Akima/makima small-weight cutoff, as a follow-up to #615 (#614). The defaulttol = 1e-9keeps the current cutoff and blend. Withtol = 0the cutoff is off: makima uses the weighted mean whenever a weight is nonzero and falls back to the secant mean otherwise. Default results are close to master but no longer bitwise identical.It also fixes 2-point tables, which now give the straight line through both points.
This branch builds on #630 and should merge after it.
🤖 Generated with Claude Code
https://claude.ai/code/session_014mFQHufqGmwfiZHWwWB4qh
🤖 Posted by an AI agent — harness: Claude 2.1.332 · model: claude-opus-5-5
Conversation: factory head hd_4d32af60 on m_4242afb3ce622d22c2c40d9e9baf1f9a (no session URL)