Skip to content

Consume the tag/decoration API and further shrink the itensors.jl shim#3

Merged
mtfishman merged 4 commits into
mf/itensorbase-backendfrom
mf/followups-round2
Jul 10, 2026
Merged

Consume the tag/decoration API and further shrink the itensors.jl shim#3
mtfishman merged 4 commits into
mf/itensorbase-backendfrom
mf/followups-round2

Conversation

@mtfishman

@mtfishman mtfishman commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Continues shrinking the itensors.jl shim onto the upstream API, now that ITensorBase exposes the tag and factorization-decoration verbs (added in ITensor/ITensorBase.jl#214). Builds on #2.

  • Name the new bond at the factorization instead of relabeling it after. The left_orth / right_orth call sites pass name = (; tags = ...), which mints the bond with the tag directly, so the commonind / settags / replaceinds retag that followed each factorization is gone. The full-update bond takes its tags from commonind(p, q), which errors clearly when there is not exactly one shared index, rather than trycommonind.
  • Retire the local settags shim for the now-public ITensorBase.settags, and mint tagged site and link indices through the Index(dim; tags = ...) keyword constructor.
  • Take the loop_correlation eigenvalues with eig_vals directly on the ITensor, dropping the matricize / adapt / Array densification and the LinearAlgebra.eigvals call. It returns the same eigenvalues, and the routine only reads maximum(abs, λ) and sum(abs, λ).
  • Use the greedy contraction optimizer unconditionally for loop weights. weight picked the optimizer with hasqns (exact for graded tensors, greedy otherwise), but loop_correlation in the same module already runs greedy on every backend, so drop the branch and the hasqns helper it was the only caller of.
  • Update the API reference for the removed safe_eigen and the op methods that moved into the Ops submodule.

Verified with the local symmetric smoke across the dense, graded, and TensorKit backends, the package test suite, and a docs build.

mtfishman and others added 4 commits July 10, 2026 13:49
Drop the `matricize` / `adapt` / `Array` densification and call
`MatrixAlgebraKit.eig_vals` directly on the contracted ITensor with the
codomain/domain split. It returns the same eigenvalues as the previous dense
`LinearAlgebra.eigvals` path, and the routine only reads `maximum(abs, λ)` and
`sum(abs, λ)`, so sorting by `abs` is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the removed `safe_eigen` from the utilities block, and resolve the custom
gate `op` methods in the `Ops` submodule by setting `CurrentModule` there, so the
`op(::OpName"...", ::SiteType"...")` entries and their docstrings are picked up
again.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`weight` chose the contraction optimizer with `hasqns`, using the exact optimizer
for graded tensors and greedy otherwise. `loop_correlation` in the same module
already runs greedy for every backend, so drop the branch and the `hasqns` helper
it was the only caller of, and always take the greedy sequence.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Name the new bond at the factorization instead of relabeling it afterward: the
`left_orth` / `right_orth` sites pass `name = (; tags = ...)`, which mints the
bond with the tag directly, so the `commonind` / `settags` / `replaceinds` retag
that followed each factorization is gone.

Delete the local `settags` shim in favor of the now-public `ITensorBase.settags`,
and mint tagged indices through the `Index(dim; tags = ...)` keyword constructor
where the site and link indices are built. The full-update bond takes its tags
from `commonind(p, q)`, which errors clearly when there is not exactly one shared
index, rather than `trycommonind`, whose `nothing` would fail anyway.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman changed the title [WIP] Consume the tag/decoration API and further shrink the itensors.jl shim Consume the tag/decoration API and further shrink the itensors.jl shim Jul 10, 2026
@mtfishman mtfishman marked this pull request as ready for review July 10, 2026 18:45
@mtfishman mtfishman merged commit 9174ea5 into mf/itensorbase-backend Jul 10, 2026
@mtfishman mtfishman deleted the mf/followups-round2 branch July 10, 2026 18:46
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