Repository navigation
Commit 2a04bdc
* Intercept `TO.tensoradd!` instead of `TensorKit.add_transform!`
The blockwise `tensoradd` implementations were only reachable through
`TensorKit`'s internals: `TO.tensoradd!` delegated to `permute!`, and the
`add_transform!` methods defined here caught the kernel. Neither is a
contract `TensorKit` owes us, and both stopped holding on TensorKit's
index-manipulation refactor (QuantumKitHub/TensorKit.jl#526), where
`TO.tensoradd!` calls the braid kernel directly and `add_transform!`
gained a `conjsrc` argument. Nothing errors in that case: dense block
tensors survive via TensorKit's generic subblock fallback, while sparse
ones silently produce zeros, because the fallback writes through blocks a
sparse container never materialized.
Implement `TO.tensoradd!` for the block tensor types instead. That is the
public entry point `@tensor` lowers to, so it is reachable no matter how
TensorKit arranges its kernels, and `conjA` is handled explicitly rather
than relying on it having been unwrapped into an adjoint beforehand.
The mixed block/plain methods take the concrete `TensorMap` so that
`(BlockTensorMap, SparseBlockTensorMap)` and the reverse resolve to the
general method rather than being ambiguous.
The added testset calls `TO.tensoradd!` directly rather than through
`@tensor`, so this stays covered independently of TensorKit's routing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Pin the planar entry points in the tests
`planaradd!`, `planartrace!` and `planarcontract!` are reached through
`transpose!`, `trace_permute!` and `contract!`, so they currently land on
methods defined here and are not affected by TensorKit#526. They rest on
the same undocumented delegation that broke `tensoradd!` though, and there
was no planar coverage here at all, so pin them directly.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 2304c56 commit 2a04bdc
2 files changed
Lines changed: 110 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 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 | + | |
3 | 54 | | |
4 | 55 | | |
5 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
50 | 51 | | |
51 | 52 | | |
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 | + | |
53 | 112 | | |
54 | 113 | | |
55 | 114 | | |
| |||
0 commit comments