[WIP] Remove the ITensorsITensorBaseCompat submodule#2
Draft
mtfishman wants to merge 5 commits into
Draft
Conversation
Move its contents to their permanent homes: the operator and named-state system to a TNQS-owned `Ops` submodule, the remaining legacy tensor helpers to `itensors.jl`, and the index and tensor operations ITensorBase now provides (`prime`, `noprime`, `id`, `sim`, `scalartype`) to the upstream versions. Drop the legacy no-ops `disable_warn_order`, `denseblocks`, and `dense`, and name the ITensor trace `itensor_tr` so it stays distinct from `tr` on plain matrices.
randn over Index objects already covers what the legacy random_itensor wrapper did, so drop the four-line shim and call randn directly at the construction sites and in the tests. Also updates the states.md example off the removed Index tag-string constructor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
trivialrange on a named range already mints a fresh, backend-preserving range, so wrapping it back in Index(trivialrange(unnamed(...))) is redundant and collapses to trivialrange(...). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A mechanical pass replacing legacy shims with the spellings the next-gen stack already provides, shrinking the TNQS-owned shim file: - Remove the dead `itensor` and `algorithm_name` (no callers). - Re-export `TensorAlgebra.scalar` in place of the local `scalar`. - Replace `dim` with `length` at the callsites. - Replace `dag` with `conj`, which covers whole tensors, indices, and (broadcast) index collections. - Drop the `inds(; plev, tags)` filtered wrapper for inline `filter`, taking `inds` from ITensorBase. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The shim is transitional and shrinking, so the per-symbol rationale is recorded outside the source rather than carried inline. Code is unchanged, and the full test suite still passes. 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
Removes the
ITensorsITensorBaseCompatsubmodule and redistributes its contents. The operator and named-state system, which has no upstream equivalent, becomes a TNQS-ownedOpssubmodule: custom gates extendOps.op, andstateis called qualified asOps.stateso it does not collide withITensorBase.state. The remaining legacy tensor helpers TNQS owns (the index-set algebra,delta,directsum, thefactorizefamily,contract,inner,apply,Algorithm, the tag helpers, and the element-type adapters) move into a newitensors.jlshim, which shrinks over follow-ups as more of it is swapped onto the upstream API or rewritten with the new spellings.The index and tensor operations ITensorBase now provides are swapped for the upstream versions:
prime/noprime(including the whole-tensor forms),id,sim, andscalartype. The legacy no-opsdisable_warn_order,denseblocks, anddenseare deleted along with their call sites. The ITensor trace is nameditensor_trrather than aLinearAlgebra.trmethod, so it stays distinct fromtron plain matrices.As a first shrink pass, the
random_itensor,itensor,algorithm_name,scalar,dim,dag, and filtered-indsshims are dropped in favor ofrandn,TensorAlgebra.scalar,length,conj, and inlinefilterat the callsites.Depends on the ITensorBase and TensorAlgebra changes in ITensor/ITensorBase.jl#213 and ITensor/TensorAlgebra.jl#205, pinned via
[sources]until those register.TODO
[sources]pins once ITensorBase 0.11 and TensorAlgebra 0.17.1 register.