Skip to content

v0.21.0: Slider/TT calculus parity (roots, minimize, maximize)#21

Merged
0xC000005 merged 17 commits intomainfrom
v0.21-slider-tt-calculus
Apr 27, 2026
Merged

v0.21.0: Slider/TT calculus parity (roots, minimize, maximize)#21
0xC000005 merged 17 commits intomainfrom
v0.21-slider-tt-calculus

Conversation

@0xC000005
Copy link
Copy Markdown
Owner

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 along dim
  • ChebyshevSlider.minimize(dim, fixed) — global minimum along dim
  • ChebyshevSlider.maximize(dim, fixed) — global maximum along dim
  • ChebyshevTT.roots(dim, fixed) — same; user-frame dim/fixed,
    transparent under _dim_order (v0.20+)
  • ChebyshevTT.minimize(dim, fixed) — same
  • ChebyshevTT.maximize(dim, fixed) — same

Implementation

Pure delegation: each method validates via the existing
_calculus._validate_calculus_args, reduces N-D to 1-D via
self.slice(slice_params) (existing on both classes), constructs a
1-D ChebyshevApproximation via from_values(), and delegates to its
roots()/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

  • CI green on all 4 Python versions
  • uv run python compare_v021_slider_tt_calculus.py shows all [OK ]
  • mkdocs build --strict clean
  • uv build produces 0.21.0 wheel + sdist

🤖 Generated with Claude Code

0xC000005 and others added 15 commits April 27, 2026 10:18
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().
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]>
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-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

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).
@0xC000005 0xC000005 merged commit 405386a into main Apr 27, 2026
10 checks passed
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