Skip to content

[WIP] Remove the ITensorsITensorBaseCompat submodule#2

Draft
mtfishman wants to merge 5 commits into
mf/itensorbase-backendfrom
mf/rm-compat
Draft

[WIP] Remove the ITensorsITensorBaseCompat submodule#2
mtfishman wants to merge 5 commits into
mf/itensorbase-backendfrom
mf/rm-compat

Conversation

@mtfishman

@mtfishman mtfishman commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

Removes the ITensorsITensorBaseCompat submodule and redistributes its contents. The operator and named-state system, which has no upstream equivalent, becomes a TNQS-owned Ops submodule: custom gates extend Ops.op, and state is called qualified as Ops.state so it does not collide with ITensorBase.state. The remaining legacy tensor helpers TNQS owns (the index-set algebra, delta, directsum, the factorize family, contract, inner, apply, Algorithm, the tag helpers, and the element-type adapters) move into a new itensors.jl shim, 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, and scalartype. The legacy no-ops disable_warn_order, denseblocks, and dense are deleted along with their call sites. The ITensor trace is named itensor_tr rather than a LinearAlgebra.tr method, so it stays distinct from tr on plain matrices.

As a first shrink pass, the random_itensor, itensor, algorithm_name, scalar, dim, dag, and filtered-inds shims are dropped in favor of randn, TensorAlgebra.scalar, length, conj, and inline filter at 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

  • Remove the [sources] pins once ITensorBase 0.11 and TensorAlgebra 0.17.1 register.

mtfishman and others added 5 commits July 8, 2026 20:01
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>
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