Make NamedTensor the primary tensor type, ITensor an IndexName alias#193
Merged
Conversation
3f2070b to
55b3b74
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #193 +/- ##
==========================================
+ Coverage 73.65% 73.77% +0.11%
==========================================
Files 29 29
Lines 1545 1548 +3
==========================================
+ Hits 1138 1142 +4
+ Misses 407 406 -1
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:
|
55b3b74 to
debeefb
Compare
ddf1b83 to
51b53f2
Compare
Make the name-generic types the primary tensor types and turn the `ITensor` family into `IndexName`-specialized aliases, mirroring how `Index` is already `NamedUnitRange{IndexName}`.
`AbstractITensor{DimName}` becomes `AbstractNamedTensor{DimName}` and `ITensor{DimName}` becomes `NamedTensor{DimName}`, with `const AbstractITensor = AbstractNamedTensor{IndexName}` and `const ITensor = NamedTensor{IndexName}`. `ITensorOperator`, `LazyITensor`, and `SymbolicITensor` are renamed to their `NamedTensor*` counterparts, each keeping the old name as an `IndexName` alias. The internal broadcast-style and layout helpers take the `NamedTensor*` prefix without an alias, and the source files are renamed to match the new type names.
`NamedTensor`, `AbstractNamedTensor`, and the `ITensor`-family aliases are all exported, so existing `ITensor` / `AbstractITensor` / `Index` code and signatures keep working, and `show` still prints an `IndexName` tensor as `ITensor`. `IndexName`, the dimension-name type carried by `Index` and behind the `ITensor` aliases, is now `public` with a docstring.
This is breaking: `ITensor` is now `NamedTensor{IndexName}`, so a tensor with non-`IndexName` dimension names has to be built through `NamedTensor` or `nameddims` rather than `ITensor`.
The ITensorNetworksNext layer will follow the same flip in a later PR, dispatching on `AbstractNamedTensor` and renaming its network hierarchy to name-generic primaries with `IndexName` aliases.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
51b53f2 to
7c520a5
Compare
mtfishman
added a commit
to ITensor/ITensorNetworksNext.jl
that referenced
this pull request
Jun 30, 2026
## Summary Update the `ITensorBase` compat to `0.9` (the rename of the primary tensor types landed in ITensor/ITensorBase.jl#193). No source changes are needed: ITensorNetworksNext uses only the `ITensor`-family names, which 0.9 keeps as aliases of the renamed `NamedTensor` types, and its `inds` call sites (iteration, `setdiff`, `eltype`) work unchanged now that `inds` returns a `Vector` instead of a `Tuple`. This drops support for ITensorBase 0.8, so it is a breaking release. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Make the name-generic types the primary tensor types and turn the
ITensorfamily intoIndexName-specialized aliases, mirroring howIndexis alreadyNamedUnitRange{IndexName}.AbstractITensor{DimName}becomesAbstractNamedTensor{DimName}, withconst AbstractITensor = AbstractNamedTensor{IndexName}.ITensor{DimName}becomesNamedTensor{DimName}, withconst ITensor = NamedTensor{IndexName}.ITensorOperator,LazyITensor, andSymbolicITensorare renamed to theirNamedTensor*counterparts, each keeping the old name as anIndexNamealias. The internal broadcast-style and layout helpers take theNamedTensor*prefix without an alias.NamedTensor,AbstractNamedTensor, and theITensor-family aliases are all exported, so existingITensor/AbstractITensor/Indexcode and signatures keep working, andshowstill prints anIndexNametensor asITensor.IndexName, the dimension-name type carried byIndexand behind theITensoraliases, is nowpublicwith a docstring. Source files are renamed to match the new type names.This is breaking:
ITensoris nowNamedTensor{IndexName}, so a tensor with non-IndexNamedimension names has to be built throughNamedTensorornameddimsrather thanITensor.The ITensorNetworksNext layer will follow the same flip in a later PR, dispatching on
AbstractNamedTensorand renaming its network hierarchy to name-generic primaries withIndexNamealiases.