Preserve the codomain/domain split in map construction and aligndims#207
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #207 +/- ##
==========================================
+ Coverage 74.62% 74.80% +0.18%
==========================================
Files 30 30
Lines 1537 1564 +27
==========================================
+ Hits 1147 1170 +23
- Misses 390 394 +4
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:
|
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Build each map constructor from a shared `*_nameddims` helper plus separate nonempty-codomain and empty-codomain forwarding methods, so an empty codomain lands in the domain rather than recursing back through the named overload once the names are stripped.
36a595b to
eb1556c
Compare
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
Map-shaped construction now forwards a codomain/domain split down to the backing storage instead of flattening.
randn,rand, andzerostake a codomain and a domain index tuple (randn((i,), (j,))), and therand_map/randn_map/zeros_maphooks on indices build a backing object partitioned accordingly: a TensorKitTensorMapstores acodomain ← domainmap, a dense backend stores flat. Following thesimilar_mapconvention the domain is conjugated in the flattened view, so the result is an ordinary tensor over the codomain indices and the duals of the domain indices. This fixesrand_map((i,), (j,))on TensorMap-backed indices, which previously flattened everything into the codomain.aligndimsgains a map formaligndims(a, codomain, domain)that both repartitions and permutes, and its existing single-tuple form now routes throughTensorAlgebra.permutedimsso aTensorMap-backed tensor permutes correctly (aTensorMaphas no flatpermutedims). Both ride thepermutedimsseam from ITensor/TensorAlgebra.jl#202, so any backend implementing it works with no dedicated method, and a dense backend ignores the split and stores flat.