Skip to content

Commit 1733090

Browse files
mtfishmanclaude
andcommitted
Add explicit hascommoninds/uniqueinds imports where transitive scope was lost
Continuing the precompile fix from the previous commit. Several files across `src/` call bare `hascommoninds(t1::ITensor, t2::ITensor)` or `uniqueinds(t1::ITensor, t2::ITensor)` (both ITensors functions on ITensor pairs — these are legitimate, not the deleted network+edge wrappers) but don't import those names themselves. They were relying on `abstractitensornetwork.jl`'s top-level `using ITensors: ..., hascommoninds, unioninds, uniqueinds, ...` to bring those names into the `ITensorNetworks` module namespace via transitive scope. The wrapper deletion in this PR removed those imports from `abstractitensornetwork.jl` (since the wrappers it defined were the only local users), which in turn breaks the transitive scope downstream files were depending on. Cold precompile fails; Revise's incremental updates mask the problem locally. Files updated (each gets only the names it actually uses): - `src/apply.jl` — adds `hascommoninds` to the existing `using ITensors: ...` line. - `src/solvers/subspace/densitymatrix.jl` — adds `using ITensors: hascommoninds, uniqueinds`. - `src/solvers/applyexp.jl` — adds `using ITensors: uniqueinds`. - `src/treetensornetworks/projttns/projttn.jl` — adds `hascommoninds` to the existing `using ITensors: ITensor` line. - `src/treetensornetworks/projttns/projouterprodttn.jl` — same. `src/solvers/subspace/ortho_subspace.jl` already does bare `using ITensors`, which brings everything into scope, so it's unaffected. These imports made the transitive dependency that already existed explicit. No semantic changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5fe5564 commit 1733090

5 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/apply.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ using .BaseExtensions: maybe_real
22
using Graphs: has_edge
33
using ITensors.NDTensors: scalartype
44
using ITensors: ITensors, ITensor, Index, Ops, apply, commonind, commoninds, contract, dag,
5-
denseblocks, factorize, factorize_svd, hasqns, isdiag, noncommoninds, noprime, prime,
6-
replaceind, replaceinds, tags, unioninds, uniqueinds
5+
denseblocks, factorize, factorize_svd, hascommoninds, hasqns, isdiag, noncommoninds,
6+
noprime, prime, replaceind, replaceinds, tags, unioninds, uniqueinds
77
using KrylovKit: linsolve
88
using LinearAlgebra: eigen, norm, qr, svd
99
using NamedGraphs: NamedEdge, has_edge

src/solvers/applyexp.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using ITensors: uniqueinds
12
using Printf: @printf
23

34
@kwdef mutable struct ApplyExpProblem{State} <: AbstractProblem

src/solvers/subspace/densitymatrix.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using ITensors: hascommoninds, uniqueinds
12
using NamedGraphs.GraphsExtensions: incident_edges
23
using Printf: @printf
34

src/treetensornetworks/projttns/projouterprodttn.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using DataGraphs: DataGraphs
22
using Dictionaries: set!
3-
using ITensors: ITensor
3+
using ITensors: ITensor, hascommoninds
44
using NamedGraphs.GraphsExtensions: incident_edges, is_leaf_vertex
55

66
struct ProjOuterProdTTN{V} <: AbstractProjTTN{V}

src/treetensornetworks/projttns/projttn.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using DataGraphs: DataGraphs, underlying_graph
22
using Dictionaries: Dictionary, Indices
33
using Graphs: edgetype, vertices
4-
using ITensors: ITensor
4+
using ITensors: ITensor, hascommoninds
55
using NamedGraphs.GraphsExtensions: incident_edges, is_leaf_vertex
66
using NamedGraphs: NamedEdge
77

0 commit comments

Comments
 (0)