Skip to content

Preserve sector information in more operations - #244

Merged
mtfishman merged 13 commits into
mainfrom
mf/bituple-axes
Aug 6, 2026
Merged

Preserve sector information in more operations#244
mtfishman merged 13 commits into
mainfrom
mf/bituple-axes

Conversation

@mtfishman

@mtfishman mtfishman commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Graded and sector arrays keep their sector structure through block operations, adding sub-block slicing, a sector-aware block copy, and an internal biaxes split accessor.

`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

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.10256% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.86%. Comparing base (f3a39e8) to head (bf494ac).

Files with missing lines Patch % Lines
src/abstractgradedarray.jl 18.75% 13 Missing ⚠️
src/fusionarray.jl 28.57% 5 Missing ⚠️
src/broadcast.jl 75.00% 4 Missing ⚠️
src/abeliangradedarray.jl 40.00% 3 Missing ⚠️
src/abstractsectorarray.jl 86.66% 2 Missing ⚠️
src/fusedgradedblocks.jl 50.00% 1 Missing ⚠️
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     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mtfishman and others added 9 commits August 5, 2026 15:22
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>
@mtfishman mtfishman changed the title [WIP] Return the codomain/domain split from axes as a BiTuple [WIP] Keep graded array operations sector-aware Aug 6, 2026
@mtfishman mtfishman changed the title [WIP] Keep graded array operations sector-aware [WIP] Preserve sector structure across block operations Aug 6, 2026
@mtfishman mtfishman changed the title [WIP] Preserve sector structure across block operations [WIP] Preserve sector information in more operations Aug 6, 2026
mtfishman and others added 2 commits August 5, 2026 22:57
axes 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 mtfishman changed the title [WIP] Preserve sector information in more operations Preserve sector information in more operations Aug 6, 2026
@mtfishman
mtfishman marked this pull request as ready for review August 6, 2026 15:34
@mtfishman
mtfishman enabled auto-merge (squash) August 6, 2026 15:34
@mtfishman
mtfishman merged commit 7d7bff5 into main Aug 6, 2026
26 of 37 checks passed
@mtfishman
mtfishman deleted the mf/bituple-axes branch August 6, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant