Apply the conjugation op to destination axes in bipermutedimsopadd!#184
Open
mtfishman wants to merge 5 commits into
Open
Apply the conjugation op to destination axes in bipermutedimsopadd!#184mtfishman wants to merge 5 commits into
mtfishman wants to merge 5 commits into
Conversation
1 task
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #184 +/- ##
==========================================
- Coverage 79.37% 79.28% -0.09%
==========================================
Files 20 20
Lines 669 671 +2
==========================================
+ Hits 531 532 +1
- Misses 138 139 +1
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.
239efed to
a0fc687
Compare
## 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.
a0fc687 to
9b0c83f
Compare
Added a compatibility function for bipermutedimsopadd! to maintain backward compatibility.
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 also adds
linearbroadcasted(*, ::Number, ::ConjBroadcasted), so scaling a conjugated broadcast operand such asconj.(a) ./ βlowers correctly instead of erroring.