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 f99f9db
Browse filesBrowse the repository at this point in the historyBrowse files
* Implement `twist!` through a cached `treetwister` and the transform kernel
`twist!` looped over all fusion trees and scaled every subblock separately,
with a cost that grows with the number of subblocks rather than the data size,
and one kernel launch per subblock for GPU tensors (#595).
- Add `twist(src, inds; inv)` for fusion tree pairs and blocks, returning the
scalar twist factor, with `inds` given as indices or as a `Bool` mask.
- Add the cached `treetwister`, a `UniqueTreeTransformer` for all sectors since
a twist maps every tree pair onto itself, keyed on a fixed-length mask.
- `twist!` and `twist` on a `TensorMap` go through `add_transform!` (in place
for `twist!`, a single pass for `twist`); other tensor types keep the loop.
- Move the shortcut for trivial permutations from `add_transform!` into
`_braid!` and `_transpose!`, so `add_transform!` always applies the
transformer.
- Cache a device `treetwister` in the GPUArrays extension.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Handle adjoint operands of `twist!` and `twist` through the twister
Adjoint destinations and sources are unwrapped as in the other index
manipulations: the twist mask of an adjoint destination is relabeled onto the
legs of its parent with the inverse twist, and `treetwister` takes a `conjsrc`
flag, with the destination space and the permutation of the source legs
following from the source space. An in-place twist of an adjoint therefore
uses the same transformer as the equivalent twist of its parent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Make `twist!` mirror `braid!` with a public `twist!(tdst, tsrc, inds, α, β, ...)`
`twist!(t, inds)` and `twist(t, inds)` are now thin wrappers around the
three-argument form, which goes through `unwrap_adjoints` and a `_twist!`
kernel entry like `_braid!`. Adds `twist_pb` with Mooncake and Enzyme rules,
and backend/allocator keywords for `twist`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fix `spacecheck_transform` ambiguity and Enzyme crash of in-place `twist!` on Julia 1.10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Return `t` from the in-place `twist!` wrapper to avoid an Enzyme crash on Julia 1.10
Enzyme aborts in `fixup_callconv!` when compiling the wrapper while it
returned the result of the three-argument `twist!`, which also broke the
fermionic contraction rules. The in-place Enzyme rules call the wrapper again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Support twisting `DiagonalTensorMap`s on GPU and test diagonal twists
GPU diagonal sources go through a cached `diagonal_treetwister`, analogous to
`_braid!` and `_transpose!` for diagonal tensors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/src/Changelog.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@ When releasing a new version, move the "Unreleased" changes to a new version sec
23
23
### Added
24
24
25
25
- Enzyme rules for `planartrace!`, with a pullback that also supports adjoint tensors
26
+
-`twist(src, inds; inv = false)` for fusion tree pairs and blocks, returning `src` together with the scalar twist factor of the legs `inds`, which can be given as indices or as a `Bool` mask
27
+
-`twist!(tdst, tsrc, inds, α = 1, β = 0, [backend], [allocator]; inv = false)` computing `tdst = β * tdst + α * twist(tsrc, inds; inv)`, in line with `permute!` and `braid!`, together with Mooncake and Enzyme rules; `twist` now also accepts `backend` and `allocator` keywords
26
28
27
29
### Changed
28
30
@@ -36,6 +38,8 @@ When releasing a new version, move the "Unreleased" changes to a new version sec
36
38
37
39
### Performance
38
40
41
+
-`twist!` and `twist` on a `TensorMap`, a `DiagonalTensorMap` or their adjoints use a cached tree transformer and the index manipulation kernel instead of a loop over all fusion trees, which removes the per-subblock bookkeeping and turns a twist of a GPU tensor, diagonal or not, into a single kernel launch ([#595](https://github.com/QuantumKitHub/TensorKit.jl/issues/595))
0 commit comments