Consume the tag/decoration API and further shrink the itensors.jl shim#3
Merged
Merged
Conversation
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>
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
Continues shrinking the
itensors.jlshim onto the upstream API, now thatITensorBaseexposes the tag and factorization-decoration verbs (added in ITensor/ITensorBase.jl#214). Builds on #2.left_orth/right_orthcall sites passname = (; tags = ...), which mints the bond with the tag directly, so thecommonind/settags/replaceindsretag that followed each factorization is gone. The full-update bond takes its tags fromcommonind(p, q), which errors clearly when there is not exactly one shared index, rather thantrycommonind.settagsshim for the now-publicITensorBase.settags, and mint tagged site and link indices through theIndex(dim; tags = ...)keyword constructor.loop_correlationeigenvalues witheig_valsdirectly on the ITensor, dropping thematricize/adapt/Arraydensification and theLinearAlgebra.eigvalscall. It returns the same eigenvalues, and the routine only readsmaximum(abs, λ)andsum(abs, λ).weightpicked the optimizer withhasqns(exact for graded tensors, greedy otherwise), butloop_correlationin the same module already runs greedy on every backend, so drop the branch and thehasqnshelper it was the only caller of.safe_eigenand theopmethods that moved into theOpssubmodule.Verified with the local symmetric smoke across the dense, graded, and TensorKit backends, the package test suite, and a docs build.