Skip to content

Derive named auxiliary legs in project#231

Open
mtfishman wants to merge 1 commit into
mainfrom
mf/project-aux-leg
Open

Derive named auxiliary legs in project#231
mtfishman wants to merge 1 commit into
mainfrom
mf/project-aux-leg

Conversation

@mtfishman

Copy link
Copy Markdown
Member

Summary

The named project, tryproject, and unchecked_project methods (the ones taking NamedUnitRange indices) now derive a named auxiliary leg for each surplus axis of the input array. When the array carries more axes than the codomain and domain indices account for, each extra trailing axis is an auxiliary leg the backend added to keep the result symmetry-allowed, for example a flux-canceling charge leg for a charge-shifting operator like Cdag. Those axes now come back as named dimensions with freshly minted names, so a caller can read them off the result.

An operator that shifts charge can then be built directly through project by reshaping its dense matrix to a trailing length-1 axis: project(reshape(m, (size(m)..., 1)), (i', ), (i,)) returns the operator with its flux carried on a named aux index. The bare graded-space form already derived this axis, but the named wrappers passed it through unnamed.

Also qualifies space, dim, dual, and scalar as TK.* in the TensorKit-extension tests. ITensorBase marks space public, so an unqualified using TensorKit: space clashes with it when the tests run in a session that already has ITensorBase's space in scope.

The named `project`, `tryproject`, and `unchecked_project` methods now
derive a named auxiliary leg for each surplus axis of the input array,
matching the bare graded-space form. A surplus trailing axis is an
auxiliary leg the backend added to keep the result symmetry-allowed, for
example a flux-canceling charge leg for a charge-shifting operator, and
it now comes back as a named dimension.

Also qualifies `space`, `dim`, `dual`, and `scalar` as `TK.*` in the
TensorKit-extension tests, since `ITensorBase` marks `space` public and
it otherwise clashes with the `TensorKit` import.
@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.06%. Comparing base (d963009) to head (aee7097).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
+ Coverage   78.02%   78.06%   +0.03%     
==========================================
  Files          30       30              
  Lines        1734     1737       +3     
==========================================
+ Hits         1353     1356       +3     
  Misses        381      381              
Flag Coverage Δ
docs 26.95% <71.42%> (+0.10%) ⬆️

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.

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