You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[BREAKING] Drop unused methods and reshape basic ITensorNetwork constructor surface (#354)
## Summary
- **Reshape the basic `ITensorNetwork` constructor surface around two
forms:**
- `ITensorNetwork(tensors)` — collection of tensors, edges inferred from
shared indices.
- `ITensorNetwork(tensors, graph::NamedGraph)` — tensors placed at the
vertices of a given graph, no edge inference.
`tensors` is any collection where `keys(tensors)` are vertex labels and
`values(tensors)` are the `ITensor`s at those vertices (e.g. a `Dict`, a
`Dictionary`, or a `Vector{ITensor}` with linear-index vertex labels).
The legacy single-`ITensor` wrap, `Vector{ITensorNetwork}` (Kronecker
product), default-empty (`ITensorNetwork{V}()` / `ITensorNetwork()`),
pair-vector, and two-vector forms are removed; construct via `Dict` or
`Dictionary` instead.
- **Drop unused or trivially-replaceable helpers:**
- `_gate_vertices`, `_contract_gate` (whole helpers, zero callers).
- `neighbor_tensors`, `eachtensor(tn, vertices)` 2-arg form,
`site_combiners` (had a ` # TODO: will be broken` marker),
`flatten_linkinds`, the lowercase `indsnetwork` alias.
- The `siteinds(tn, vertex)` aliases — the method is **kept** but is now
implemented natively via `setdiff` over neighbors (matching
ITensorNetworksNext.jl) rather than aliased to `uniqueinds`. The
underlying `uniqueinds(tn::AbstractITensorNetwork, vertex)` method is
removed.
- The whole `src/graphs.jl` (just
`SimpleGraphs.SimpleGraph(::Vector{ITensor})`, unused).
- The whole `src/update_observer.jl` (`update_observer!`,
`compose_observers`, `ComposedObservers`, `ValuesObserver`; no callers
in `src/`).
- **Sync `docs/src/deprecated_methods.md` and
`docs/src/experimental_methods.md`** to reflect the deletions.
The `IndsNetwork`-, `AbstractNamedGraph`-, and
`AbstractSimpleGraph`-based constructor families
(`ITensorNetwork(is::IndsNetwork)`, `ITensorNetwork(::Function,
is::IndsNetwork)`, `ITensorNetwork(value, is::IndsNetwork)`,
`ITensorNetwork(eltype, undef, is::IndsNetwork)`, etc.) are **not**
touched in this PR; their removal is being staged separately so it can
be reviewed on its own. The same applies to the deprecated per-edge
wrappers `linkinds(tn, edge)` / `commoninds(tn, edge)` / `uniqueinds(tn,
edge)`, which are still used by internal call sites and are being
deferred for replacement with explicit set-function calls (e.g.
`intersect(inds(tn[src(e)]), inds(tn[dst(e)]))`).
Release notes:
Breaking. Removed public methods include `ITensorNetwork(::ITensor)`,
`ITensorNetwork(::Vector{ITensorNetwork})`, `ITensorNetwork{V}()` and
`ITensorNetwork()`, `ITensorNetwork(::AbstractVector{<:Pair{<:Any,
ITensor}})`, `ITensorNetwork(vs::AbstractVector,
ts::AbstractVector{ITensor})`, `uniqueinds(tn::AbstractITensorNetwork,
vertex)`, `neighbor_tensors`, `eachtensor(tn, vertices)` 2-arg form,
`flatten_linkinds`, `indsnetwork` (lowercase alias), `site_combiners`,
`SimpleGraphs.SimpleGraph(::Vector{ITensor})`, and the contents of
`update_observer.jl`. The `siteinds(tn, vertex)` accessor is preserved
with a re-implemented body. Construct an `ITensorNetwork` from
collections via `ITensorNetwork(tensors)` or `ITensorNetwork(tensors,
graph::NamedGraph)`.
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* From a single `ITensor`. Wraps the tensor in a single-vertex network (`itensornetwork.jl`):
51
-
```julia
52
-
ITensorNetwork(t::ITensor)
53
-
```
54
-
55
33
* Construct an `ITensorNetwork` from an `IndsNetwork`. Initializes ITensors with `undef` storage on each vertex
56
34
of the `IndsNetwork` with the corresponding indices (`itensornetwork.jl`):
57
35
```julia
@@ -63,58 +41,20 @@ Suggestions of methods which could be deleted.
63
41
64
42
#### Local Operations on ITensorNetworks
65
43
66
-
* Versions of `siteinds` taking a `vertex` argument. Each of these is just an alias for `uniqueinds`. Possibly the wrong design / implementation. (`abstractitensornetwork.jl`).
# Calculate the overlap of the gate acting on the previous p and q versus the new p and q in the presence of environments. This is the cost function that optimise_p_q will minimise
0 commit comments