Derive named auxiliary legs in project#231
Open
mtfishman wants to merge 1 commit into
Open
Conversation
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 Report✅ All modified and coverable lines are covered by tests. 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
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:
|
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
The named
project,tryproject, andunchecked_projectmethods (the ones takingNamedUnitRangeindices) 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 likeCdag. 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
projectby 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, andscalarasTK.*in the TensorKit-extension tests.ITensorBasemarksspacepublic, so an unqualifiedusing TensorKit: spaceclashes with it when the tests run in a session that already hasITensorBase'sspacein scope.