You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbab923
Browse filesBrowse the repository at this point in the historyBrowse files
Generalize planarcontract! to arbitrary pAB, remove _contractedspace
`@planar` allocates through `TO.tensoralloc_contract` with the raw index
tuples of the planar decomposition, in which `pA` and `pB` need not be planar
partitions by themselves; only `planarcontract!` rotated them into shape, and
only when `pAB` could be absorbed into those rotations.
Replace `reorder_indices` by `planar_contract_indices`, which canonicalizes
`pA` and `pB` and remaps `pAB` instead of absorbing it, let `planarcontract!`
apply a residual cyclic `pAB` with `transpose!` through an intermediate, and
allocate planar destinations through the new `planaralloc_contract`. Allocate
the destination of `⊗` directly, since its intermediates are non-planar by
construction.
With every caller passing planar partitions, `tensorcontract_structure` can
again compose the intermediate spaces, which also restores contractions of
operands with different `spacetype` parameters.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/src/Changelog.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,8 +22,11 @@ When releasing a new version, move the "Unreleased" changes to a new version sec
22
22
23
23
### Added
24
24
25
+
-`planarcontract!` now supports an arbitrary (cyclic) output permutation `pAB`, in the same way as the non-planar `tensorcontract!`, along with the new internal helpers `TensorKit.planar_contract_indices` and `TensorKit.planaralloc_contract`. ([#531](https://github.com/QuantumKitHub/TensorKit.jl/pull/531))
26
+
25
27
### Changed
26
28
- For sector types with `GenericUnit` such that colorings are not unique, `GradedSpace`, `ProductSpace` and `HomSpace` now check for this compatibility. In particular, this prevents the construction of `TensorMap`s with incompatible colorings, which previously either errored or produced empty tensors inconsistently. ([#515](https://github.com/QuantumKitHub/TensorKit.jl/pull/515))
29
+
-`TensorOperations.tensorcontract_structure` now requires the index tuples `pA` and `pB` to be planar (cyclic) partitions for sector types with `GenericUnit()`; planar code should allocate through `TensorKit.planaralloc_contract`, which canonicalizes them. ([#531](https://github.com/QuantumKitHub/TensorKit.jl/pull/531))
27
30
28
31
### Deprecated
29
32
- The type alias `ZNSpace{N}` is deprecated in favour of `Vect[ZNIrrep{N}]` or `Rep[ℤ{N}]`: a type alias cannot compute the storage type from `N`, so the two only agree for small `N`. ([#511](https://github.com/QuantumKitHub/TensorKit.jl/pull/511))
Copy file name to clipboardExpand all lines: docs/src/man/contractions.md
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -289,6 +289,11 @@ Finally, the name `τ` is reserved for the braiding tensor: every literal crossi
289
289
The `BraidingTensor` itself does not need to be constructed by the user; the macro figures out the appropriate spaces from the surrounding contraction.
290
290
Any layout the macro cannot identify as planar is rejected at parse time with `ArgumentError("not a planar diagram expression: ...")`.
291
291
292
+
For users writing their own planar kernels, it is important to note that the index tuples `pA = (oindA, cindA)` and `pB = (cindB, oindB)` handed to `planarcontract!` need not individually be planar partitions of the operands.
293
+
As long as the overall diagram is planar, the function `TensorKit.planar_contract_indices(A, pA, B, pB, pAB)` will return the canonical `pA′`, `pB′` and the remaining output permutation `pAB′` for which the operations are each planar.
294
+
These canonical tuples are also the only ones for which the intermediate spaces exist for sector types with multiple units (i.e. multifusion categories with `GenericUnit()`).
295
+
The `@planar` macro automatically applies it to the tuples it emits, but hand-written planar kernels should do the same before allocating a destination with `TensorOperations.tensoralloc_contract`.
296
+
292
297
To make this concrete, consider the contraction `A * B` for two anyonic tensors, written in a manifestly planar fashion:
0 commit comments