Repository navigation
Address the review findings on the polar spline space - #17
Merged
Merged
Conversation
`pseudo_cartesian` rebuilt the chart coefficients `cos.(θ)` and `sin.(θ)` over all `Nθ` Greville abscissae on every call, so a routine called once per quadrature point was `O(Nθ)`. They are fixed for the basis, so `PolarSplineBasis` now caches them: at 64x128 cubic, one call goes from 3552 B / 1389 ns to 192 B / 63 ns, measured in two cold processes with the same script. The vector-of-points `evaluate` dispatched on a bare `AbstractVector`, so a single point written as `[s, θ]` reached it and failed with a bare `BoundsError`. It now dispatches on the element type. Also: `vec` rather than `[:]` in the two grid comprehensions, which drops a copy from the per-Newton-iteration path of `weighted_matrix`; the documented signature of `PolarSplineQuadrature` matches the source again; and tests for the `meshwidth`, `mesh` and `domain` forwards, for `show`, and for the new dispatch. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Follow-up to the review of #15. That PR merged before these landed on it, so they come as their own change. Seven findings, none of them a bug; two are worth a measurement.
pseudo_cartesianwasO(Nθ)per callIt rebuilt the chart coefficients
cos.(θ)andsin.(θ)over allNθGreville abscissae on every call. They are fixed for the basis, soPolarSplineBasiscaches them in the constructor instead. The routine is called once per quadrature point — some 65 000 calls at 64×128 — by both the test suite and the theory page.Two cold processes, same script, 64×128 cubic:
For scale, an ordinary
evaluateon this basis is 368 B / 125 ns.A single point written as a vector reached the wrong method
evaluate(B, û, X::AbstractVector)is the vector-of-points method, soevaluate(B, û, [0.3, 1.0])reached it and failed with a bareBoundsErrorrather than evaluating at the point(0.3, 1.0). It now dispatches on the element type,AbstractVector{<:Union{Tuple, AbstractVector}}, and a vector point reaches the single-point method.This was filed in #15 as pre-existing. It is not:
TensorProductBasishas fourevaluatemethods and none of them takes a vector of points, and the one-dimensional form cannot hit it because a one-dimensional point is a scalar. The method is new with the polar space.The rest
vecrather than[:]in the two grid comprehensions, which drops a copy of the whole quadrature grid from the per-Newton-iteration path ofweighted_matrix.PolarSplineQuadraturesaidquadrature_order.(degree(B))where the source saysmap(quadrature_order, degree(B)). Equivalent, but the rendered signature should match.0.2.0heading in the CHANGELOG.meshwidth,meshanddomainforwards, forshow, and for the new dispatch. Seven assertions, so the polar testset goes 391 → 398.One finding from the review is not in this diff:
scripts/polar_mass_cost.jlhas no assertion and noexit, against #15's claim that all four scripts exit non-zero on failure. A timing script needs no threshold, so the description was what was wrong, and #15's body is corrected in place.Verification
Full suite green on this base: 16 testsets, 0 failures, the polar testset at 398. Aqua passes all eight checks. JuliaFormatter,
fatou lintand the NFC check are clean on the three changed files.One gap worth naming: the local manifest resolved ContinuumArrays 0.20.10, not the 0.21 that
mainhas just admitted, so the 0.21 path is tested here only by CI.No CHANGELOG entry: the polar space is unreleased, the existing entry describes the end state, and none of its figures move.
🤖 Generated with Claude Code