Preserve sector information in more operations - #244
Merged
Conversation
`axes` on `FusionArray` and its block and structural types now returns a `BiTuple` carrying the codomain/domain split instead of a flat tuple, with GradedArrays-owned `codomain`/`domain` accessors for the two halves. The split is load-bearing for fermions, where each block's leg partition drives the phase bookkeeping.
Draft-only `[sources]` pin so CI resolves the BiTuple accessors before TensorAlgebra 0.19.1 registers. Removed before the PR is ready.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #244 +/- ##
==========================================
- Coverage 81.36% 80.86% -0.51%
==========================================
Files 30 30
Lines 2555 2608 +53
==========================================
+ Hits 2079 2109 +30
- Misses 476 499 +23
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:
|
Array arithmetic and in-place broadcast route through the graded broadcast fold, and the structural deltas display through their dense form, so `BiTuple` axes never reach Base's flat-tuple shape and print machinery. Equality checks compare axes directly now that `BiTuple` equality is flat, and `one!` on a `FusionMatrix` fills coupled blocks through the fused path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`copyto!` and `.=` from a plain array into a sector-array block, and `isdiag` on a graded matrix, now act on the block data (unique-fusion only for the writes) rather than the generic paths that combine the block's `BiTuple` axes. Lets the `axes`-returns-a-`BiTuple` work drop the corresponding Base index and broadcast overloads. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`isdiag` on a graded matrix now tests each stored block via `isdiag` on the sector array itself, and concatenation reads the source block as a view instead of copying its data. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`copy_sector!` is a sector-aware block copy that checks the sectors match and accepts a block or a plain source. Block assignment and concatenation route through it, so `a[Block] = dense` works. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Both operands are sector arrays there, so `copy!` applies and adds the full-axis check of sector labels and lengths. `copy_sector!` is only needed where the source may be a plain array. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`copy_sector!` does the full-axis check that `copy!`/`copyto!` need, so they delegate to it. `isdiag` on a sector matrix drops the unique-fusion requirement, since the structural factor is diagonal for any fusion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
They are GradedArrays accessors on the axes `BiTuple`, not TensorKit overloads, so they belong beside `axes(::FusionArray)` rather than in the TensorKit integration file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
axes returns a flat Tuple again, satisfying the Base and BlockArrays axes contract, and the codomain/domain split moves to an internal biaxes accessor. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A BlockIndexRange view or getindex now stays a sector array rather than a dense SubArray, so the concatenation scatter can slice blocks directly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
axes as a BiTupleaxes returns a flat Tuple, so the Tuple(axes(...)) wrappers were no-ops. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
TensorAlgebra 0.19.1 is registered, so GradedArrays resolves against the released version. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mtfishman
marked this pull request as ready for review
August 6, 2026 15:34
mtfishman
enabled auto-merge (squash)
August 6, 2026 15:34
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
Graded and sector arrays keep their sector structure through block operations, adding sub-block slicing, a sector-aware block copy, and an internal
biaxessplit accessor.