Skip to content

Restrict BSpline derivative loops to the nonzero basis window - #621

Open
ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:bspline-derivative-window
Open

ChrisRackauckas-Claude wants to merge 2 commits into
SciML:masterfrom
ChrisRackauckas-Claude:bspline-derivative-window

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary

BSpline _derivative methods for BSplineInterpolation and BSplineApprox (scalar, vector-of-vectors, and array u) iterated 1:(n-1) / 1:(h-1) even though only m = d basis values from bspline_nonzero_coefficients are nonzero. Each loop is now restricted to max(1, offset):min(n-1, offset+m-1) (or the h equivalent). Values match master exactly (bitwise identical over 1.35M derivative samples in independent review); order-2 paths improve automatically because they autodiff the analytical first derivative.

Performance (a CI box, Julia 1.12.4, JULIA_NUM_THREADS=1 taskset -c 0, @benchmark minima, n=10⁴, 1000 random probes)

Method Before After
BSplineInterpolation d1 12.24 µs/call 147.3 ns/call
BSplineInterpolation d2 12.45 µs/call 341.1 ns/call
BSplineApprox d1 4.17 µs/call 134.3 ns/call

Large-n BSpline derivative cases live in benchmark/benchmarks.jl for AirspeedVelocity.

Regression test

  • Correctness: ForwardDiff (scalar) / FiniteDifferences (matrix & VoV) for orders 1 and 2 across Interp/Approx.
  • Deterministic complexity guard: wrap A.k in a CountingVector via the existing inner constructors; assert knot reads < 200 and bitwise equality vs the unwrapped object. Master: 10 pass / 6 fail. PR: 16 pass. Observed reads on the PR: 32/31 at n=100 and 39/37 at n=10⁴ (Interp/Approx); on master: 224/89 and 20031/6695.

Test-group tails (post review fix)

Core (GROUP=Core Pkg.test):

Core/abstract_interface.jl |   11     11  2.1s
Core/extrapolation_tests.jl |  316    316  1m23.6s
Core/interface.jl |   31     31  28.7s
Core/interpolation_tests.jl | 17571       5  17576  8m31.9s
Core/parameter_tests.jl |   20     20  50.4s
Testing DataInterpolations tests passed

QA (GROUP=QA Pkg.test):

QA/alloc_tests.jl |   16     16  1m32.6s
QA/qa.jl      |   20     20  1m37.2s
Testing DataInterpolations tests passed

Also: Runic + typos on touched files clean.

Review response

Replaced the flaky ns < 1000 wall-clock testset (fails under --code-coverage=user, d1 1619–1629 ns) with the reviewer's knot-read counting test. Moved the n=10⁴ timing case to benchmark/benchmarks.jl. Dropped comments that described the unfixed timing.

Please ignore until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: low
  • Blast radius: Internal _derivative loops of BSplineInterpolation and BSplineApprox, for scalar, vector-of-vectors and array u. No API change. Window is exactly the old 1 <= l <= m guard set; summation order unchanged; results bitwise identical.
  • Evidence: Source change value-preserving (independent review, 1.35M derivatives). Flaky wall-clock guard removed; replaced by deterministic knot-read count that fails 6/16 on master and passes 16/16 on the PR. Core + QA green after the test change.
  • Independent review: Claude Code (claude-opus-5-5) initially rated medium because of the timing test; that blocking finding is addressed here.
  • Merge: ready for human review of the counting-test replacement

🤖 Generated with Cursor Agent CLI (model: auto); transcript /pr-bspline-deriv/log.txt

Made with Cursor

Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #621 (comment)

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Risk assessment (independent review, Codex gpt-6.1-sol, head 0b97484)

  • Verdict: MERGE
  • Rating: Codex gpt-6.1-sol rated it medium-low (ML3) at head 0b97484
  • Risk: medium-low (ML3: measured performance optimization of peripheral, explicitly selected B-spline derivative methods, with unchanged results). L2 (added tests) and L7 (small internal refactor) also match; ML3 sets the highest level. These methods are peripheral to the core package's main linear/cubic interpolation paths.
  • Blast radius: First and second derivatives of BSplineInterpolation and BSplineApprox, for scalar, matrix/array, and vector-of-vectors outputs. No public names, signatures, defaults, dependency changes, or SemVer break; no existing assertions were removed, skipped, or loosened. New public-name documentation and dependency-license checks are therefore not applicable.
  • Evidence: Read the PR metadata, complete git diff origin/HEAD...HEAD, surrounding implementations, and the entire risk rubric. No linked issue exists. git diff --check origin/HEAD...HEAD passed; the checkout remained clean. Current origin/HEAD is 898d88ec6630d7bcd2886172ac81fa0fcf3e89e7; its src/ differs from the head only in these six bounds.
    • Ran python3 <local path>, which sequentially invokes Julia 1.12.4 with timeout 3600, --compiled-modules=existing, scratch head/base projects, and final_validation.jl. Used the requested depot, four Julia threads, and one BLAS thread; only one Julia process ran at a time. Snapshots include src/ and ext/; the two added testsets and their helper were extracted verbatim from the PR.
    • Head: 204/204 accuracy assertions and 16/16 knot-read assertions pass, exit 0. Base: 204/204 accuracy assertions pass; the knot-read test has 10 passes / 6 failures, exit 1, with failing counts 224, 20,031, 6,695 against <200. Clean runs contain no extension-loading errors. Logs: head, base.
    • Independent probe: 8,574 derivative evaluations, 14,290 Float64 components, zero bitwise differences. Covered degrees 1–5, both spline types, all three output shapes, uniform/averaged knots, uniform sites and nonuniform sites with averaged knots, every data site and knot, interval midpoints, endpoints, and extension extrapolation. python3 <local path> asserts the two complete bitstring files are identical.
    • Local timing loop, best of five batches of 10,000 calls, varying two nearby inputs and accumulating returned values:
    • BSplineInterpolation d1: 13074.3 → 78.0 ns/call (base → head).
    • BSplineInterpolation d2: 12507.4 → 254.4 ns/call (base → head).
    • BSplineApprox d1: 5726.1 → 74.8 ns/call (base → head).
    • BSplineApprox d2: 4360.8 → 251.2 ns/call (base → head).
    • LinearInterpolation d1: 38.9 → 41.7 ns/call (base → head).
    • Read-only gh pr view 621 / gh run view 37854493288 confirm all 21 checks succeeded on the exact head. Inspected actual logs: Methods derivative file 75,605/75,605; Mooncake 769/769; Zygote 29,470/29,470. No failing CI check requires a default-branch comparison.
    • G1: pass — independent ForwardDiff of spline evaluation and finite-difference references pass, supplemented by unchanged base/head bit patterns. G2: pass — local first/second derivative and ForwardDiff paths exercised; exact-head CI exercises Zygote/ChainRules and Mooncake. No GPU, Reactant, or MPI path changed. G3: not applicable — production code changes no shared state, cache, threading, or global default.
  • Merge: merge — no blocking findings; the independent risk rating is medium-low rather than the author's low rating.

🤖 Posted by an AI agent — harness: Codex CLI 0.162.1 · model: gpt-6.1-sol
Conversation: local headless review run (no public session URL); transcript kept by the fleet master.

ChrisRackauckas and others added 2 commits October 8, 2026 15:52
Only m=d basis values are nonzero, so iterating 1:(n-1) or 1:(h-1) was
O(n)/O(h) work for an O(degree) update. Windowing preserves values and
makes large-n derivatives ~100× faster.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent 2026.10.01-14929f9
Agent-Model: unknown (Cursor auto)
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/di/pr-bspline-deriv/log.txt on amdci2
Wall-clock ns < 1000 fails under --code-coverage=user; count knot
accesses instead and move the n=10⁴ case to AirspeedVelocity.

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Cursor Agent <noreply@cursor.com>
Agent-Harness: Cursor Agent CLI
Agent-Model: auto
@ChrisRackauckas

ChrisRackauckas commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): MERGE, risk low.

Full review

VERDICT: MERGE
RISK: low

Blocking findings

None.

The source change is a pure loop-bound tightening. On master each loop runs i in 1:(n-1) (or 1:(A.h-1)) and adds a term only when 1 <= l <= m with l = i + 1 - offset, so the terms that contribute are exactly those with i ∈ [offset, offset+m-1] ∩ [1, n-1]. The new bounds max(1, offset):min(n-1, offset+m-1) are that same set, visited in the same ascending order. The skipped iterations only read A.k under @inbounds and had no side effects. The edge cases hold: offset = 0, m = 1 (when u == k[1]) gives an empty range on both branches, and u == k[end] gives i = n-1 on both. Confirmed by running (below): results are bitwise identical to master.

Non-blocking findings

  1. The PR body's test evidence covers the wrong group (claim gap, now covered by my runs). The new tests are in test/Methods/derivative_tests.jl, which runs under GROUP=Methods. The PR body pastes tails for GROUP=Core and GROUP=QA only. I ran the full file on the PR head and everything passed (BSplines 32532/32532, no failures anywhere in the file).
  2. The "window matches autodiff / FD" testset (test/Methods/derivative_tests.jl:406-439) cannot catch this regression. It passes 204/204 on master as well, as you'd expect for a value-preserving change. It is a sanity check on values, mostly redundant with the existing BSpline test_derivatives calls. The scalar cases compare against ForwardDiff of the evaluation path, which is independent of the changed code. The matrix/VoV d2 cases take finite differences of derivative(A, τ), which is the changed code, so they are partly circular (d1 is checked independently, though). The tolerances (1e-8 / 1e-6 / 1e-5) are round numbers, not derived. They are loose against exact-to-roundoff ForwardDiff, but no assertion fits observed error to the buggy path. The test that actually guards the change is the knot-read counting testset.
  3. The knot-read counting test (test/Methods/derivative_tests.jl:11-33, :442-454) builds objects through the full positional inner constructors BSplineInterpolation(u, t, d, k, c, sc, knotVecType, extrapolation_left, extrapolation_right, t_props). That is the package's own internal API inside its own tests, so it's acceptable, but it breaks whenever the struct gains a field. The bound < 200 is a fixed threshold, not derived. It sits far from the PR's values (31–39) and from master's at n=10⁴ (6695 / 20031). At n=100, master's Approx makes 89 reads and passes, so only 6 of the 16 cases discriminate.
  4. The inner 1 <= l <= m guard is now always true (src/derivatives.jl:393, 419, 447, 470, 495, 522) and could be dropped. It is harmless as it stands.
  5. Style nits. The test comment at derivative_tests.jl:406-407 ("Restricting the B-spline derivative accumulation…") reads like it narrates the change rather than describing the invariant. Minor. The benchmark setup (benchmark/benchmarks.jl:61-76) builds n=10⁴ BSpline objects when the module loads. That takes about 4.3 s / 1.5 GB allocated for BSplineInterpolation and about 1 s / 0.7 GB for BSplineApprox here, which is acceptable for an AirspeedVelocity suite. The test file builds the same objects, and the counting testset takes 6.3 s.
  6. The PR links no issue, so there was no tracking issue or sibling work to check interface fit against.

What I ran

All runs used julia +1.11 with JULIA_NUM_THREADS=1. "Confirmed by running" applies to every result in this section.

  • Bitwise equivalence probe (scratch/probe.jl, results in scratch/equiv.log). The same script ran against the PR head and against git archive origin/master (b98db80, the merge base), and I compared the serialized outputs bit for bit.

    • Coverage: n ∈ {4, 5, 7, 12, 40}; d ∈ 1:5; knot vectors :Uniform and :Average; uniform and random t; scalar, matrix and VoV u; BSplineInterpolation plus BSplineApprox with several h.
    • Evaluation points: every knot, both endpoints, interval midpoints, a dense grid, and extrapolation points on both sides (ExtrapolationType.Extension). Orders 1 and 2.
    • Result: 0 bitwise mismatches over 142,848 derivative samples. 33 constructions failed identically on both (singular/ill-posed configurations), and there were no evaluation errors.
  • New tests on master. I ran the PR's test/Methods/derivative_tests.jl against master's src (scratch/methods_master.log).

    • Window testset: 204/204 pass.
    • Knot-read testset: 10 pass, 6 fail, with observed reads 224 (n=100 Interp, orders 1 and 2), 20031 (n=10⁴ Interp) and 6695 (n=10⁴ Approx). This matches the PR body's "Master: 10 pass / 6 fail" and its read counts.
  • Changed test file on the PR head (scratch/methods_pr.log): the whole file passes in 195.7 s. Window testset 204/204; knot-read testset 16/16.

  • Timing. Hand-rolled best-of-5 loops (scratch/timing.jl), n=10⁴, one probe point, on this laptop under load from parallel jobs:

    Case PR master
    Interp d1 203 ns 6435 ns
    Interp d2 135 ns 16756 ns
    Approx d1 144 ns 2250 ns

    The speedup direction and size reproduce. The absolute numbers differ from the PR's CI-box table, as expected on different hardware.

  • Formatting and spelling. julia +1.12 --project=@runic -m Runic --check --diff on the 3 touched files was clean. typos on the same files was clean (scratch/format.log).

  • Constructor cost (scratch/construct_cost.log), measured for finding 5.

What I did not verify

  • The PR body's CI-box @benchmark table. I did not use BenchmarkTools or a CI box, and my numbers come from a different machine.
  • The "1.35M derivative samples" figure from the author's independent review. My own probe covers 142,848 samples.
  • I did not rerun the full GROUP=Core, GROUP=QA or GROUP=Methods suites, or any Extensions (Zygote / Mooncake / SparseConnectivityTracer). They are unaffected by reading: the contributing term set is unchanged, so tracer sparsity patterns are identical. That is suspected from reading, not run.
  • Julia 1.10 (LTS), pre-release Julia, and 32-bit.

🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium
Conversation: local Claude session 3c311569-dda6-4687-bc9f-65febb212c33 (fleet master)

@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review December 1, 2026 01:45
@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member Author

🤖 Automated comment from an AI agent running as @ChrisRackauckas — not written or reviewed by Chris.

PR: #621

Reviewed head: 0b97484
Raw SHA-256: e3b32de8798bce7785291064bc62cb8cbefeb58aa709087935db9ce8a7ebabfa
Source SHA-256: 4f139306cee457dc8d82149ddebe4e48ff909fe5981c7e43402c47c2367a6dc4
Source: standard-review-v1 (harness-log)
Reviewer session: 6086d1a9-25c6-4064-a4e0-9bff72428773
Slot: 1
Confidence: unknown
Own risk fixed before author rating/discussion: yes
Redaction: ran (substitutions=0)

Risk assessment

  • Risk: medium-low (ML3)
  • Verdict: MERGE
  • Reviewed head: 0b97484

Review report

VERDICT: MERGE
Round: 1
Head: 0b97484
Base: b98db80
Slot: 1
CI: green
Session: 6086d1a9-25c6-4064-a4e0-9bff72428773
Reviewer: Antigravity CLI 1.5.21; model: gemini-4-carbon-high
Review triage: {"families":[],"contract":false}

Risk

medium-low (ML3: restricts peripheral BSplineInterpolation and BSplineApprox _derivative loops to the nonzero basis window; values are bit-for-bit unchanged across all u shapes, orders, and ChainRules t-tangents, with deterministic knot-read checks and AirspeedVelocity benchmarks)

Blocking findings

None.

Non-blocking findings

  1. [new opt-in] test/Methods/derivative_tests.jl:441-453 and benchmark/benchmarks.jl:62-76: Knot-read regression test exercises only the 2 scalar dispatches out of the 6 modified _derivative methods, and n = 10_000 setup runs dense $O(n^3)$ collocation (~2.3 GB allocated).

    • Observed evidence (confirmed by running): All six _derivative methods in src/derivatives.jl (BSplineInterpolation and BSplineApprox across AbstractVector{<:Number}, AbstractVector{<:AbstractVector}, and AbstractArray{<:Number}, at lines 390, 416, 444, 467, 492, and 519) were updated properly: probing all six at n = 200, h = 80 confirms knot reads drop from 425 -> 33 (BSplineInterpolation) and 184 -> 32 (BSplineApprox) for scalar, Vector{Vector}, and Matrix data alike. However, @testset "BSpline derivative reads O(degree) knots" only tests scalar u = sin.(t), so an accidental regression in any of the 4 non-scalar methods would still pass both the value test (since values are unchanged) and the knot-read test. In addition, constructing BSplineInterpolation(u, t, 3, :Average) and BSplineApprox(u, t, 3, n ÷ 3, :Average) at n = 10_000 allocates 1602.2 MB (~5.3–5.9s dense $10{,}000 \times 10{,}000$ LU) and 710.8 MB (~1.5s) both in the unit test and unconditionally when loading benchmark/benchmarks.jl, whereas at n = 1_000, h = 333 Base already reads 2027 and 692 knots vs 35 and 34 on Head (< 100 discriminates cleanly at ~1% of the memory).
    • Implementation fix: In test/Methods/derivative_tests.jl (@testset "BSpline derivative reads O(degree) knots", lines 441-453), replace (100, 10_000) scalar-only construction with n = 1_000 (h = n ÷ 3) across all three u shapes (u_sc = sin.(t), u_mat = [sin.(t)'; cos.(t)'], u_vov = [[sin(ti), cos(ti)] for ti in t]) and assert knot_reads(A, t[n ÷ 2] + 0.01, order) < 100 for all 6 (BSplineInterpolation | BSplineApprox) × (scalar | matrix | vov) combinations and order in (1, 2) (or build the n = 10_000 test spline via the inner constructor with prebuilt clamped knots k and control points c to bypass the dense collocation solve). Optionally in benchmark/benchmarks.jl:62-76, build bs_interp and bs_approx via their inner constructors or smaller collocation size if load-time memory matters on constrained CI runners, and add SUITE["derivative"]["bspline_approx_d2"] alongside bspline_interp_d2. No other call sites or docs are affected.
  2. [pre-existing] src/derivatives.jl:431-432 and src/derivatives.jl:507-508: BoundsError in degree-0 BSplineInterpolation and BSplineApprox derivatives when ndims(A.u) >= 3.

    • Observed evidence (confirmed by running on Base and Head): Evaluating derivative(A, t, 1) on BSplineInterpolation(zeros(2, 2, 18), t, 0, :Average) or BSplineApprox(zeros(2, 2, 18), t, 0, 4, :Average) throws BoundsError: attempt to access 2×2×18 Array{Float64, 3} at index [1:2, 1] identically at both b98db80406869b7664d5760ed48785f3f2d5cad6 and 0b9748416449324afca72767fa8e380238d774f5, because the A.d == 0 early-return branches index A.u[:, 1] assuming a 2D matrix, whereas the A.d >= 1 branches below (src/derivatives.jl:441,449,516,524) use _u_view and support arbitrary-dimensional arrays.
    • Implementation fix: In src/derivatives.jl, update the if A.d == 0 blocks of _derivative(A::BSplineInterpolation{<:AbstractArray{<:Number}}, t::Number, iguess) (lines 430-433) and _derivative(A::BSplineApprox{<:AbstractArray{<:Number}}, t::Number, iguess) (lines 506-509) to use u₁ = _first(A.u) instead of A.u[:, 1]:
      if A.d == 0
          u₁ = _first(A.u)
          return isempty(searchsorted(A.t, t)) ? zero(u₁) : fill(typed_nan(A.u), size(u₁))
      end
      Add a regression test in test/Methods/derivative_tests.jl (@testset "BSplines") constructing BSplineInterpolation(zeros(2, 2, 6), collect(1.0:6.0), 0, :Average) and BSplineApprox(zeros(2, 2, 6), collect(1.0:6.0), 0, 3, :Average) and asserting derivative(A, 2.5, 1) == zeros(2, 2) off-knot and all(isnan, derivative(A, 2.0, 1)) at a knot. No other call sites or docs are affected.
  3. [regression] Commit metadata (b8e02be9a6c331e2dfb11b29044f5f2a3d1719f8 and 0b9748416449324afca72767fa8e380238d774f5): Agent-Session commit trailers deviate from attribution rules.

    • Observed evidence (confirmed by running git log --format=fuller): Commit b8e02be9a6c331e2dfb11b29044f5f2a3d1719f8 includes a local transcript path and build host name in its Agent-Session: trailer instead of a bare local session/job identifier, and commit 0b9748416449324afca72767fa8e380238d774f5 omits Agent-Session: altogether.
    • Implementation fix: No source code change is needed when squash-merging with commit-body sanitization that strips local path/host lines. If any further commits are pushed to the branch, end each commit message with Agent-Session: local session <session-id> (no session URL) (never a transcript path or host name) and ensure the PR description carries the matching harness, model, and session attribution line. No tests or docs are affected.

What I ran

  • Python environment check: Ran uv run --locked python --version on the build host -> Python 3.13.13 (warning: --locked has no effect when used outside of a project; no uv.lock or Python code exists in this pure-Julia repository).
  • Julia toolchain, formatting, and spelling: Using julia version 1.12.4 on 64-bit Linux on the build host, verified Runic.format_string(read(f, String)) == read(f, String) -> true for src/derivatives.jl, test/Methods/derivative_tests.jl, and benchmark/benchmarks.jl, and ran typos across the repository (exit 0, zero findings).
  • Full repository test groups at 0b9748416449324afca72767fa8e380238d774f5:
    • GROUP=Methods julia --project -e 'using Pkg; Pkg.test()' -> 94,471 / 94,471 passed (Methods/derivative_tests.jl: 75,605, Methods/integral_inverse_tests.jl: 317, Methods/integral_tests.jl: 18,498, Methods/online_tests.jl: 30, Methods/thread_safety_tests.jl: 21).
    • GROUP=QA julia --project -e 'using Pkg; Pkg.test()' -> 36 / 36 passed (QA/alloc_tests.jl: 16 including zero-allocation BSplineInterpolation and BSplineApprox derivative checks; QA/qa.jl: 20 Aqua and ExplicitImports checks across src/ and ext/).
    • GROUP=Extensions julia --project -e 'using Pkg; Pkg.test()' -> 30,899 / 30,899 passed (Extensions/mooncake_tests.jl: 769, Extensions/sparseconnectivitytracer_tests.jl: 660, Extensions/zygote_tests.jl: 29,470, exercising ChainRulesCore.rrule/frule t-derivatives on BSplineInterpolation and BSplineApprox).
    • GROUP=Core julia --project -e 'using Pkg; Pkg.test()' -> 17,949 passed, 5 pre-existing broken (17,954 total).
    • GROUP=Misc julia --project -e 'using Pkg; Pkg.test()' -> 52 / 52 passed (Misc/plot_rec.jl: 24, Misc/public_api.jl: 16, Misc/show.jl: 12).
  • Base (b98db80406869b7664d5760ed48785f3f2d5cad6) vs Head (0b9748416449324afca72767fa8e380238d774f5) adversarial and numerical probes:
    • Failing-before / passing-after knot-read probe: At n = 100, d = 3, BSplineInterpolation reads 224 knots on Base (fails < 200) vs 32 on Head (passes < 200); at n = 1_000, h = 333, reads drop from 2027 -> 35 (BSplineInterpolation) and 692 -> 34 (BSplineApprox) for both order = 1 and order = 2; at n = 200, h = 80, all 6 (Interp | Approx) × (scalar | Vector{Vector} | Matrix) dispatches drop from 425 -> 33 and 184 -> 32.
    • Exhaustive bit-for-bit equivalence (--check-bounds=yes): Compared 73,088 derivative(A, t, order) evaluations across d in (0, 1, 2, 3, 4, 5, 15), Float64, Float32, Vector{Vector}, SVector, Matrix, and 3D Array inputs, :Average and :Uniform knot vectors, all 5 ExtrapolationType modes, order in (1, 2), exact endpoints t[1] and t[end], nextfloat(t[1]), prevfloat(t[end]), exact interior knots and data sites, NaN, and out-of-range points -> 0 mismatches (isequal bit-for-bit on every case).
    • Independent analytic polynomial reproduction: Verified 3,540 / 3,540 checks for exact polynomials $p(t) = \sum_{r=0}^d (-1)^r t^r / (r + 1)$ (d in 1:5, order in (1, 2), BSplineInterpolation and BSplineApprox across scalar, Matrix, and Vector{Vector}, interior/knot/endpoint/extrapolated points) against exact analytic $p'(t)$ and $p''(t)$ (rtol = 1e-9 for order = 1, rtol = 1e-8 for order = 2).
    • Edge-case, concurrency, and benchmark probes: Verified repeated interior knots up to multiplicity d + 1 (exercising denom == 0 branches), ComplexF64, BigFloat (rtol = 1e-60 vs ForwardDiff), 4-thread concurrent derivative(A, x, 1) and derivative(A, x, 2) stress test across all 6 BSpline variants (2,000 loops × 41 points, 0 mismatches), and benchmark/benchmarks.jl load + execution (bspline_interp_d1 median 67 ns, bspline_interp_d2 median 214 ns, bspline_approx_d1 median 66 ns; measured Base-to-Head speedups at n = 10_000, h = 3_333: 123x–219x on BSplineInterpolation order 1, 85x–97x on order 2, 72x–80x on BSplineApprox order 1, and 30x–32x on order 2).

What I did not verify

  • Core 32-bit x86 runner, Julia lts (1.10), and Julia pre matrix configurations (all checks were run on 64-bit Linux with Julia 1.12.4 on the build host).
  • Full docs/make.jl documentation build (the PR modifies no docstrings, docs/ files, or public API signatures).

AUTHOR_GRADE: {"task": "perf", "score": 4, "difficulty": 2, "rounds": 1, "author_harness": "Cursor Agent CLI", "author_model": "auto", "note": "Clean 6-line loop-window restriction across all 6 BSpline _derivative methods giving ~30x-220x speedups at n=10^4 with bit-for-bit identical outputs, deterministic knot-read test, and AirspeedVelocity benchmarks; minor deductions for Agent-Session commit trailer hygiene and scalar-only knot-read coverage."}

Head link: 0b97484


🤖 Posted by an AI agent — harness: Antigravity CLI 1.5.21 · model: gemini-4-carbon-high
Conversation: local session 6086d1a9-25c6-4064-a4e0-9bff72428773 (no session URL)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants