Apply the conjugation op to destination axes in bipermutedimsopadd!#184
Merged
Conversation
1 task
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
==========================================
- Coverage 79.37% 78.98% -0.39%
==========================================
Files 20 20
Lines 669 671 +2
==========================================
- Hits 531 530 -1
- Misses 138 141 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
mtfishman
added a commit
to ITensor/GradedArrays.jl
that referenced
this pull request
Jun 26, 2026
## Summary Makes `conj` dualize graded axes consistently across GradedArrays, matching `Base.conj(::AbelianGradedArray)`. The materialization path (`bipermutedimsopadd!` on an `AbstractSectorArray` with `op = conj`) now routes through `Base.conj`, which dualizes the sectors and carries the fermionic reversal phase that a bare block-data conjugation drops. The `SectorStyle` broadcast picks up the same behavior: `broadcasted_sector` is op-aware, so `conj.(x)` dualizes the result axes, and a broadcast that conjugates only some operands such as `conj.(s) .- t` now errors as a sector mismatch rather than silently keeping the original axes. `Base.conj` on the structural factors `AbelianSectorDelta` and `SectorIdentity` dualizes their axes. Builds on ITensor/TensorAlgebra.jl#184, which makes the `bipermutedimsopadd!` and `permutedimsop` `op` apply to the destination axes. ## TODO - [ ] Drop the `[sources]` pin on TensorAlgebra and confirm the `0.11.2` compat floor once ITensor/TensorAlgebra.jl#184 merges and registers.
mtfishman
force-pushed
the
mf/conj-dualizes-axes
branch
from
June 26, 2026 19:45
239efed to
a0fc687
Compare
mtfishman
enabled auto-merge (squash)
June 26, 2026 19:45
## Summary `bipermutedimsopadd!` and `permutedimsop` now apply their element-wise `op` to the destination axes, so a conjugating permutation (`op = conj`) dualizes graded axes and keeps axes and data in sync. `op` acts as a conjugation flag, either `identity` or `conj`: on a graded axis `conj` dualizes, and on a dense axis it is a no-op, so dense arrays are unaffected. Transposition is carried by the permutation arguments rather than by `op`. This also adds `linearbroadcasted(*, ::Number, ::ConjBroadcasted)`, so scaling a conjugated broadcast operand such as `conj.(a) ./ β` lowers correctly instead of erroring.
`bipermutedimsopadd!`'s `op` is a conjugation flag, either `identity` or `conj`. `check_input` now rejects any other function with an `ArgumentError`, so an unsupported `op` fails with a clear message at the boundary rather than later as a `MethodError` from applying it to an axis.
mtfishman
force-pushed
the
mf/conj-dualizes-axes
branch
from
June 26, 2026 19:53
a0fc687 to
9b0c83f
Compare
mtfishman
disabled auto-merge
June 27, 2026 14:58
mtfishman
force-pushed
the
mf/conj-dualizes-axes
branch
from
June 27, 2026 15:00
cb40f44 to
4aa2954
Compare
mtfishman
added a commit
to ITensor/GradedArrays.jl
that referenced
this pull request
Jun 27, 2026
The new check_input signature lands in the breaking TensorAlgebra 0.12 release (ITensor/TensorAlgebra.jl#184).
mtfishman
enabled auto-merge (squash)
June 27, 2026 15:22
mtfishman
added a commit
to ITensor/SparseArraysBase.jl
that referenced
this pull request
Jun 27, 2026
## Summary Widens the TensorAlgebra compat bound to admit the breaking 0.12 release (ITensor/TensorAlgebra.jl#184). The TensorAlgebra extension uses `matricize`, `unmatricize`, and `FusionStyle`, none of which changed, so this is a compat-only update.
This was referenced Jun 27, 2026
mtfishman
added a commit
to ITensor/ITensorBase.jl
that referenced
this pull request
Jun 27, 2026
## Summary Widens the TensorAlgebra compat bound to admit the breaking 0.12 release (ITensor/TensorAlgebra.jl#184). ITensorBase's code is unaffected, so this is a compat-only update.
mtfishman
added a commit
to ITensor/GradedArrays.jl
that referenced
this pull request
Jun 27, 2026
## Summary Adapts to the breaking TensorAlgebra 0.12 release (ITensor/TensorAlgebra.jl#184), whose `check_input(bipermutedimsopadd!, ...)` now takes `op`. Passes `op` through in the `AbstractSectorArray` and `AbstractGradedArray` materialization paths and raises the TensorAlgebra compat bound to `0.12`. This is the minimal change that unblocks downstream packages on TensorAlgebra 0.12. Conjugating broadcasts (`conj.`) must dualize the result axes to satisfy the new `op`-aware `check_input`. That support is left to a follow-up, so `conj.` on graded and sector arrays is unsupported for now (marked with a broken test). Direct `conj` is unaffected. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bipermutedimsopadd!andpermutedimsopnow apply their element-wiseopto the destination axes, so a conjugating permutation (op = conj) dualizes graded axes and keeps axes and data in sync.opacts as a conjugation flag, eitheridentityorconj: on a graded axisconjdualizes, and on a dense axis it is a no-op, so dense arrays are unaffected.check_inputrejects any otheropwith an informative error. Transposition is carried by the permutation arguments rather than byop.This is breaking:
check_input(::typeof(bipermutedimsopadd!), dest, op, src, perm_codomain, perm_domain)now takesopas a positional argument, so packages that call or specialize it must passop. GradedArrays is updated to match in ITensor/GradedArrays.jl#185.This also adds
linearbroadcasted(*, ::Number, ::ConjBroadcasted), so scaling a conjugated broadcast operand such asconj.(a) ./ βlowers correctly instead of erroring.