Repository navigation
Commit a2add70
Update JET to 0.12 and run the package analysis in CI (#570)
* Update JET to 0.12 and run the package analysis as a test group
Mooncake 0.5.45 lifted its `JET = "0.9 - 0.11"` cap, so JET 0.12 is now
resolvable. Add `test/other/jet.jl`, which runs `JET.test_package` over
TensorKit, and gate it in `runtests.jl`.
JET 0.12 only works on Julia 1.12+; on older versions it loads empty stubs and
signals this through `JET_AVAILABLE`. Whole-package analysis is therefore pinned
to the 0.12 generation, so its reports need not be curated for several
JET/Julia combinations. Mooncake's tangent tests reach JET through Mooncake's
extension and work with any functional JET, so they are gated separately.
The `Mooncake = "0.5.45"` floor is load-bearing: with an older Mooncake the
resolver settles on JET 0.11 and the analysis would be silently skipped.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Fix genuine errors uncovered by JET
Four latent bugs on paths that no test exercises:
- `@planar ... order=(...)` called a bare `normalizeindex`, which is not in
scope: an outright `UndefVarError`. Nothing tests `order=`.
- `_extract_contraction_pairs` interpolated `$ex` into its error message, but
the argument is named `rhs`, so constructing the error threw instead.
- `src/tensors/linalg.jl` threw `DimensionError`, which does not exist; the
intended type is `IndexError`.
- `numout`/`numin`'s fallbacks built `MethodError(f, T)` from a bare type.
`MethodError`'s second field must be the argument *tuple*, so `showerror`
itself threw `ErrorException("expected tuple type")` and the intended error
was never printable. Every other site in the file already uses `(T,)`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Make the JET analysis clean
No behavioural changes; each hunk silences a report that JET cannot see through.
Inference cannot narrow a `local` binding that is only assigned inside a branch,
so replace the sentinel-by-undefinedness idiom with real sentinel values:
`@cached`'s `hasparams`/`typed` flags become `nothing` checks on `params`/`typeex`,
`planar_trace`'s `local i, j` becomes `i = j = 0`, and `_construct_braidingtensors!`
tracks `V1`/`V2` as `nothing` rather than via `foundV1`/`foundV2`.
`OneOrNoneIterator`'s default `state = true` is a `Bool`, but a recursive call
passes an `Int`, so `if state` is reported as a non-boolean context; `isone`
accepts both and keeps the `Bool` default.
`fusiontensor` used `TupleTools.prod(d)` on a value inferred as
`Union{Tuple, NamedTuple}`; `reshape(F, :, sz[end])` computes the same leading
dimension without the union split.
The remaining reports came from functions that serve both tensors and spaces
under one name. Julia narrows a slot after a call that would otherwise throw a
`MethodError`, so an untyped argument passed to such a function is refined to
`Union{AbstractTensorMap, TensorMapSpace}` rather than to a tensor, and the next
call splits on a branch that has no method.
`_braid!`/`_transpose!` are fixed structurally rather than by annotation: they
now take `space(tdst)`/`space(tsrc)` once and pass the spaces to both
`spacecheck_transform` and `treebraider`/`treetransposer`, whose tensor-accepting
forwarding methods are therefore removed. `permute!`/`braid!`/`transpose!` likewise
pass spaces to `spacecheck_transform`, so its tensor-accepting method is removed too. `space` has no space-accepting method,
so this narrows the arguments on its own, and the non-dense path now computes two
spaces instead of four.
Where no such restructuring applies, the contract is written down instead:
`_trace_permute!` (matching `add_transform!` next door), the
`UniqueTreeTransformer`/`GenericTreeTransformer` constructors (`::HomSpace`,
their only caller always passes one), `parenttype(::Type{Union{}})`, and the
primal `A` of `trace_permute_pullback_ΔA!`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Fix JET reports in code merged from main
- `_recouple!`: pass `true`/`false` as gemm scalars so they cannot be union-split independently of `U`'s eltype
- `nothing_or_block`: only accept a `Diagonal` wrapping a `SectorVector`, the only one `block` supports
- `_fsbraid`: assert the `FusionTreeBlock` before the final `repartition`
- drop `numind(::AbstractTensorMap)`, which the generic `numind(x) = numin(x) + numout(x)` already covers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Drop the schur DefaultAlgorithm forwarding and its JET ignores
TensorKit has no schur implementation for tensors, so `schur_full`/`schur_vals` already
fail in `select_algorithm`. The forwarding methods only gave JET an unimplemented
`DiagonalAlgorithm` path to report; MatrixAlgebraKit#276 itself has been fixed upstream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix _dense_strides for ndims = 1
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 60076fd commit a2add70
22 files changed
Lines changed: 95 additions & 63 deletions
File tree
- ext
- src
- auxiliary
- factorizations
- fusiontrees
- planar
- pullbacks
- tensors
- test
- mooncake
- other
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
94 | | - | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
101 | | - | |
| 99 | + | |
102 | 100 | | |
103 | 101 | | |
104 | 102 | | |
| |||
117 | 115 | | |
118 | 116 | | |
119 | 117 | | |
120 | | - | |
| 118 | + | |
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
| 125 | + | |
128 | 126 | | |
129 | 127 | | |
130 | 128 | | |
| |||
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
141 | | - | |
| 139 | + | |
142 | 140 | | |
143 | 141 | | |
144 | 142 | | |
145 | | - | |
| 143 | + | |
146 | 144 | | |
147 | 145 | | |
148 | 146 | | |
| |||
151 | 149 | | |
152 | 150 | | |
153 | 151 | | |
154 | | - | |
| 152 | + | |
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
| |||
172 | 170 | | |
173 | 171 | | |
174 | 172 | | |
175 | | - | |
| 173 | + | |
176 | 174 | | |
177 | 175 | | |
178 | 176 | | |
| |||
193 | 191 | | |
194 | 192 | | |
195 | 193 | | |
196 | | - | |
| 194 | + | |
197 | 195 | | |
198 | 196 | | |
199 | 197 | | |
200 | | - | |
| 198 | + | |
201 | 199 | | |
202 | 200 | | |
203 | 201 | | |
| |||
| 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 | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | 106 | | |
108 | 107 | | |
109 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
660 | | - | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | | - | |
342 | | - | |
| 341 | + | |
343 | 342 | | |
344 | 343 | | |
345 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | | - | |
187 | 186 | | |
188 | 187 | | |
189 | | - | |
190 | 188 | | |
191 | 189 | | |
192 | 190 | | |
193 | | - | |
194 | 191 | | |
195 | 192 | | |
196 | | - | |
197 | 193 | | |
198 | | - | |
| 194 | + | |
199 | 195 | | |
200 | 196 | | |
201 | 197 | | |
| |||
609 | 605 | | |
610 | 606 | | |
611 | 607 | | |
612 | | - | |
| 608 | + | |
613 | 609 | | |
614 | 610 | | |
615 | 611 | | |
| |||
0 commit comments