Commit 758aa46
v0.21.1: TT _dim_order cluster + open issues + perf (#23)
* v0.21.1: ChebyshevTT.inner_product strict _dim_order check
Raise ValueError with reorder() hint when self._dim_order != other._dim_order
instead of silently computing a meaningless Frobenius product. Mirrors the
v0.20.1 binary algebra behavior on _check_compatible_tt mismatches.
Closes ultrareview Critical finding.
* v0.21.1: _check_compatible — numerical domain comparison
Replace exact == / != on .domain and .n_nodes with np.allclose / np.array_equal
on coerced arrays. Tolerates tuple-of-tuples vs list-of-lists syntax that
silently arises in scalar-mul (which normalizes via [list(b) for b in domain]).
Closes issue #22.
* v0.21.1: ChebyshevTT.get_evaluation_points returns user-frame columns
Permute columns by inverse _dim_order before returning so that
eval(get_evaluation_points()[i]) round-trips for any TT regardless of
storage permutation. Matches Approximation/Spline/Slider behavior.
Closes ultrareview Important finding.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* v0.21.1: ChebyshevTT.roots/min/max validate against user-frame domain
Add _user_frame_domain() private helper that returns self.domain permuted
into user-frame order. The three v0.21 methods now pass this user-frame
view to _calculus._validate_calculus_args instead of the raw storage-frame
self.domain.
Pre-fix: under non-identity _dim_order with non-uniform per-dim domains,
validation referenced the wrong domain. Tests pass before the fix only
because uniform domains masked the difference.
Closes ultrareview Critical finding.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* v0.21.1: integrate error messages reference user-frame dim (issue #20)
Add optional dim_labels= parameter to _normalize_bounds. ChebyshevTT.integrate
passes user-frame dims_sorted as dim_labels so out-of-domain bounds errors
reference the dim the user passed rather than the storage-frame index.
Helper stays user-frame-naive otherwise.
Closes #20.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* v0.21.1: eval_multi structural fix — eliminate _dim_order mutation (issue #19)
Extract _eval_storage_frame(point_storage, deriv_storage) private helper
that takes already-permuted coords. eval() permutes user→storage once at
entry and calls _eval_storage_frame; eval_multi() permutes once and calls
the helper N times for each derivative_order.
Drops the try/finally self._dim_order mutation entirely. Eliminates the
race rather than papering over it with a lock.
The FD machinery (_fd_single_dim, _fd_cross_deriv, _fd_nested) was
updated to call _eval_storage_frame instead of self.eval, since the
points it operates on are already in storage frame; routing through
self.eval would re-permute and break correctness once the saved-state
trick is removed.
Closes #19.
* v0.21.1: vectorize _calculus._optimize_1d candidate evaluation
Replace the Python list comprehension over candidates with a single
vectorized barycentric evaluation (BLAS GEMV pattern). _optimize_1d is
the canonical 1-D optimizer used by all four classes' minimize/maximize
methods; v0.21 routed Slider/TT min/max through it, making the perf
hoist worthwhile.
Bit-identical results — non-regression tests pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* v0.21.1: hoist derivative matrix application out of vectorized_eval_batch loop
The differentiation matrix (D_T) matmul is point-independent — applying
it once to self.tensor_values before the per-point loop, then doing only
the barycentric reduction inside the loop, produces identical results
with substantial speedup for batch derivative evaluations.
Each D_T[d] is applied along axis d of the full tensor (via moveaxis to
last, matmul, moveaxis back) to correctly match the per-dim interleaved
semantics of vectorized_eval. ChebyshevSpline.eval_batch (which delegates
per-piece) inherits the speedup.
* v0.21.1: add comparison/demo script
Demonstrates each fix in the TT _dim_order cluster with a non-uniform
domain and explicit reorder() — the configuration that v0.20.1/v0.21.0
test coverage masked.
Native TT sobol_indices deferred to v0.22; not included in this demo.
* v0.21.1: docs + release housekeeping
Add non-uniform-domain validation note to user-guide.
Bump version to 0.21.1.
CHANGELOG entry covering all 6 fixes + 2 perf wins, with sobol_indices
deferred to v0.22.
CLAUDE.md updated with new test count and v0.21.1 architecture line.
* v0.21.1: address final review — extend np.allclose fix to TT internal sites
Final cumulative review (M1) noted that ChebyshevTT.inner_product and
the binary-algebra _check_compatible_tt path also use exact == on
self.domain, paralleling the issue #22 fix in _algebra._check_compatible.
Apply the same np.allclose pattern to both TT sites for consistency
with the v0.21.1 fix.
(M2) Add compare_v0211_dim_cluster.py to the CLAUDE.md benchmark roster.
* v0.21.1: add ChebyshevTT.sobol_indices() (native TT contraction)
Compute first-order + total-order Sobol indices by contracting through
the TT coefficient cores in O(d * n * r^2) time. Cross-validated against
ChebyshevApproximation.sobol_indices() on dense reconstructions.
Closes the v0.21.1 sobol_indices parity item (originally deferred but
attempted on user request).
* v0.21.1: CHANGELOG/CLAUDE.md — sobol_indices shipped, not deferred
* tests: add non-uniform-domain + reorder sobol parity test (Issue 1)
Appends test_non_uniform_domain_after_reorder to TestTTSobolParity,
covering the exact configuration that masked v0.21.0 _dim_order bugs:
non-uniform per-dim domains [(-1,1), (-2,2), (-3,3)] combined with a
non-identity _dim_order (reorder([2,0,1])). Verifies TT sobol keys stay
in user-frame after reorder, matching ChebyshevApproximation reference.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* refactor: extract _apply_derivative_passes helper to barycentric.py (Issue 2)
Adds private _apply_derivative_passes(tensor, derivative_order) that
applies differentiation-matrix passes along each axis of the full
coefficient tensor using np.moveaxis. Used by vectorized_eval_batch to
replace the duplicated ~10-line derivative-hoist block, making the batch
path self-documenting. vectorized_eval inlines its own per-axis logic
(reduces axes as it goes, so the full-tensor moveaxis path doesn't apply
there) and is left unchanged to avoid unneeded churn.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* perf: cache left/right partial contractions for O(d*n*r^2) total-order sobol (Issue 3)
Replaces d independent full self-inner-product loops for total-order
computation with precomputed L[k] (left partial, dims 0..k-1) and R[k]
(right partial, dims k..d-1) matrices. For each dim j, combines L[j],
the alpha_j=0 core slice, and R[j+1] via a single einsum instead of
re-running all d cores. Reduces from O(d^2*n*r^2) to O(d*n*r^2).
Existing TestSobolFromTTCores and TestTTSobolParity tests continue to
pass at 1e-9 (2-D) and 1e-7 (3-D) tolerances.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 405386a commit 758aa46
18 files changed
Lines changed: 1104 additions & 83 deletions
File tree
- docs/user-guide
- src/pychebyshev
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
8 | 65 | | |
9 | 66 | | |
10 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
| |||
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
| 114 | + | |
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
| |||
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
132 | | - | |
| 139 | + | |
133 | 140 | | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
137 | | - | |
| 144 | + | |
| 145 | + | |
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
| 573 | + | |
| 574 | + | |
573 | 575 | | |
574 | 576 | | |
575 | 577 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
| |||
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
| 182 | + | |
176 | 183 | | |
177 | | - | |
| 184 | + | |
178 | 185 | | |
179 | 186 | | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
183 | | - | |
| 190 | + | |
184 | 191 | | |
185 | 192 | | |
186 | 193 | | |
| |||
259 | 266 | | |
260 | 267 | | |
261 | 268 | | |
262 | | - | |
263 | | - | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| |||
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
279 | 295 | | |
280 | 296 | | |
281 | 297 | | |
| |||
0 commit comments