v0.21.0: Slider/TT calculus parity (roots, minimize, maximize)#21
Merged
v0.21.0: Slider/TT calculus parity (roots, minimize, maximize)#21
Conversation
Private helper that builds a 1-D ChebyshevApproximation from a 1-D Slider by evaluating at Chebyshev nodes. Foundation for v0.21 roots/minimize/maximize methods on ChebyshevSlider.
- Replace hand-rolled Chebyshev-node formula with the canonical _make_nodes_for_dim helper from _extrude_slice (single source of truth). - Drop redundant deferred import of ChebyshevApproximation (already imported at module level; no circular-import concern). - Add dimensionality assertion to catch caller misuse.
Mirrors ChebyshevApproximation.roots() signature exactly: 1-D direct, multi-D via fixed= dict. Implementation reduces to 1-D via slice() and delegates to a 1-D ChebyshevApproximation built via _to_1d_chebyshev(). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Same delegation pattern as roots(): validate -> slice -> 1-D Approximation -> delegate to its minimize().
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Verifies composition with extrude, slice, algebra, coupled partitions, and pickle round-trip. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Builds a 1-D ChebyshevApproximation from a 1-D TT via to_dense(). Foundation for v0.21 roots/minimize/maximize on ChebyshevTT.
Same delegation pattern as Slider: validate -> slice -> 1-D Approximation -> delegate to its roots(). User-frame dim/fixed translate to storage frame transparently via slice()/to_dense(). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Structural mirror of ChebyshevTT.roots(): slices to 1-D via _validate_calculus_args + self.slice(), then delegates to ChebyshevApproximation.minimize(). Six tests in TestTTMinimize. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Structural mirror of ChebyshevTT.minimize(): slices to 1-D via _validate_calculus_args + self.slice(), then delegates to ChebyshevApproximation.maximize(). Six tests in TestTTMaximize. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Verifies frame discipline under with_auto_order/reorder, composition with extrude/slice/algebra, and pickle round-trip. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Verifies Slider and TT roots/min/max agree with ChebyshevApproximation on the same function to ~1e-9.
Self-contained demo of new Slider/TT calculus methods against analytical answers. No MoCaX equivalent -- beyond-MoCaX feature. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Bump to 0.21.0. Drop the 'deferred to v0.21' note from v0.17. Add v0.21 architecture line. Update test count (1055 → 1112). Closes the calculus parity gap promised since v0.17 — all four public classes now support integrate + roots + min/max. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The Task 13 docs addition appended a v0.21 section but didn't update the upfront 'Supported Classes' table or the 'Limitations' bullet that both still claimed Slider/TT lacked roots/min/max. Both now reflect v0.21 reality.
- Add demo_3d_reorder_transparency() to compare_v021_slider_tt_calculus.py: uses explicit reorder([2,0,1]) to force non-identity _dim_order, then verifies user-frame minimize() is transparent. The existing with_auto_order() demo happens to pick canonical [0,1,2] for the chosen function so the new sub-demo visibly exercises the non-identity path. - Fix CLAUDE.md test count: v0.21 additions are 57 tests, not 64. The latent _algebra._check_compatible tuple-vs-list domain bug observed during Task 5 is filed as issue #22 (pre-existing, not introduced by v0.21).
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
Closes the v0.17-promised calculus parity gap. After this PR, all four
public classes (
ChebyshevApproximation,ChebyshevSpline,ChebyshevSlider,ChebyshevTT) support the full calculus surface:integrate,roots,minimize,maximize.What's new
ChebyshevSlider.roots(dim, fixed)— find all roots alongdimChebyshevSlider.minimize(dim, fixed)— global minimum alongdimChebyshevSlider.maximize(dim, fixed)— global maximum alongdimChebyshevTT.roots(dim, fixed)— same; user-framedim/fixed,transparent under
_dim_order(v0.20+)ChebyshevTT.minimize(dim, fixed)— sameChebyshevTT.maximize(dim, fixed)— sameImplementation
Pure delegation: each method validates via the existing
_calculus._validate_calculus_args, reduces N-D to 1-D viaself.slice(slice_params)(existing on both classes), constructs a1-D
ChebyshevApproximationviafrom_values(), and delegates to itsroots()/minimize()/maximize()from v0.9. No new math.Tests
~57 new tests across 9 new test classes in
tests/test_calculus_completion.py. Total project test count:1112. All Python versions (3.10/3.11/3.12/3.13) pass on CI.
Test plan
uv run python compare_v021_slider_tt_calculus.pyshows all[OK ]mkdocs build --strictcleanuv buildproduces 0.21.0 wheel + sdist🤖 Generated with Claude Code