Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions docs/src/experimental_methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,6 @@ Methods which still need to be discussed, modified, or deprecated.
linkinds(tn::AbstractITensorNetwork)
```

* Rewrite every index of a network according to a structural mapping `IndsNetwork => IndsNetwork`
(site indices per vertex, link indices per edge). The two `IndsNetwork`s must share the
same underlying graph (`abstractitensornetwork.jl`):
```julia
replaceinds(tn::AbstractITensorNetwork, is_is′::Pair{<:IndsNetwork, <:IndsNetwork})
```

* "Split" an edge index by applying a map to each copy of it on the adjacent ITensors.
By default the `dst(edge)` copy is primed and the `src(edge)` copy is unchanged (`abstractitensornetwork.jl`):
```julia
split_index(tn::AbstractITensorNetwork, edges_to_split;
src_ind_map::Function = identity,
dst_ind_map::Function = prime)
```

## TreeTensorNetwork Types

#### OpSum Constructors
Expand Down
16 changes: 0 additions & 16 deletions src/abstractitensornetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -741,22 +741,6 @@ function combine_linkinds(
return combine_linkinds(tn, combiners)
end

function split_index(
tn::AbstractITensorNetwork,
edges_to_split;
src_ind_map::Function = identity,
dst_ind_map::Function = prime
)
tn = copy(tn)
for e in edges_to_split
inds = commoninds(tn[src(e)], tn[dst(e)])
tn[src(e)] = replaceinds(tn[src(e)], inds, src_ind_map(inds))
tn[dst(e)] = replaceinds(tn[dst(e)], inds, dst_ind_map(inds))
end

return tn
end

function inner_network(x::AbstractITensorNetwork, y::AbstractITensorNetwork; kwargs...)
return LinearFormNetwork(x, y; kwargs...)
end
Expand Down
17 changes: 12 additions & 5 deletions test/test_belief_propagation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ using Compat: Compat
using Graphs: vertices
using ITensorNetworks: ITensorNetworks, @preserve_graph, BeliefPropagationCache, contract,
contraction_sequence, environment, inner_network, message, message_diff,
partitioned_tensornetwork, scalar, siteinds, split_index, tensornetwork, update,
update_factor, updated_message, ⊗
partitioned_tensornetwork, scalar, siteinds, tensornetwork, update, update_factor,
updated_message, ⊗
include("utils.jl")
using ITensors.NDTensors: array
using ITensors:
ITensors, Algorithm, ITensor, combiner, dag, inds, inner, op, prime, random_itensor
using ITensors: ITensors, Algorithm, ITensor, combiner, commoninds, dag, inds, inner, op,
prime, random_itensor
using LinearAlgebra: eigvals, tr
using NamedGraphs.NamedGraphGenerators: named_comb_tree, named_grid
using NamedGraphs.PartitionedGraphs: quotientedges
Expand Down Expand Up @@ -60,7 +60,14 @@ using Test: @test, @testset
#Test forming a two-site RDM. Check it has the correct size, trace 1 and is PSD
vs = [(2, 2), (2, 3)]

ψψsplit = split_index(ψψ, NamedEdge.([(v, 1) => (v, 2) for v in vs]))
# Prime the bra-ket shared site indices on the ket side at the
# selected vertices, so the contracted RDM has open primed/unprimed
# legs there. Mutates a copy of `ψψ` in place; no graph edits.
ψψsplit = copy(ψψ)
for v in vs
common = commoninds(ψψsplit[(v, 1)], ψψsplit[(v, 2)])
ψψsplit[(v, 2)] = prime(ψψsplit[(v, 2)], common)
end
env_tensors = environment(bpc, [(v, 2) for v in vs])
rdm =
contract(vcat(env_tensors, ITensor[ψψsplit[vp] for vp in [(v, 2) for v in vs]]))
Expand Down
Loading