Skip to content

Commit d2e667e

Browse files
committed
Fix tests
1 parent a609ecd commit d2e667e

File tree

9 files changed

+37
-32
lines changed

9 files changed

+37
-32
lines changed

README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ and 3 edge(s):
3636
3 => 4
3737

3838
with vertex data:
39-
4-element Dictionaries.Dictionary{Int64, Any}
39+
4-element Dictionary{Int64, Any}
4040
1 │ ((dim=2|id=739|"1↔2"),)
4141
2 │ ((dim=2|id=739|"1↔2"), (dim=2|id=920|"2↔3"))
4242
3 │ ((dim=2|id=920|"2↔3"), (dim=2|id=761|"3↔4"))
@@ -88,7 +88,7 @@ and 4 edge(s):
8888
(1, 2) => (2, 2)
8989

9090
with vertex data:
91-
4-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
91+
4-element Dictionary{Tuple{Int64, Int64}, Any}
9292
(1, 1) │ ((dim=2|id=74|"1×1↔2×1"), (dim=2|id=723|"1×1↔1×2"))
9393
(2, 1) │ ((dim=2|id=74|"1×1↔2×1"), (dim=2|id=823|"2×1↔2×2"))
9494
(1, 2) │ ((dim=2|id=723|"1×1↔1×2"), (dim=2|id=712|"1×2↔2×2"))
@@ -118,7 +118,7 @@ and 1 edge(s):
118118
(1, 1) => (1, 2)
119119

120120
with vertex data:
121-
2-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
121+
2-element Dictionary{Tuple{Int64, Int64}, Any}
122122
(1, 1) │ ((dim=2|id=74|"1×1↔2×1"), (dim=2|id=723|"1×1↔1×2"))
123123
(1, 2) │ ((dim=2|id=723|"1×1↔1×2"), (dim=2|id=712|"1×2↔2×2"))
124124

@@ -132,7 +132,7 @@ and 1 edge(s):
132132
(2, 1) => (2, 2)
133133

134134
with vertex data:
135-
2-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
135+
2-element Dictionary{Tuple{Int64, Int64}, Any}
136136
(2, 1) │ ((dim=2|id=74|"1×1↔2×1"), (dim=2|id=823|"2×1↔2×2"))
137137
(2, 2) │ ((dim=2|id=823|"2×1↔2×2"), (dim=2|id=712|"1×2↔2×2"))
138138
```
@@ -155,13 +155,13 @@ and 2 edge(s):
155155
2 => 3
156156

157157
with vertex data:
158-
3-element Dictionaries.Dictionary{Int64, Vector{Index}}
158+
3-element Dictionary{Int64, Vector{Index}}
159159
1 │ Index[(dim=2|id=598|"S=1/2,Site,n=1")]
160160
2 │ Index[(dim=2|id=457|"S=1/2,Site,n=2")]
161161
3 │ Index[(dim=2|id=683|"S=1/2,Site,n=3")]
162162

163163
and edge data:
164-
0-element Dictionaries.Dictionary{NamedGraphs.NamedEdge{Int64}, Vector{Index}}
164+
0-element Dictionary{NamedEdge{Int64}, Vector{Index}}
165165

166166
julia> tn1 = ITensorNetwork(s; link_space=2)
167167
ITensorNetwork{Int64} with 3 vertices:
@@ -175,7 +175,7 @@ and 2 edge(s):
175175
2 => 3
176176

177177
with vertex data:
178-
3-element Dictionaries.Dictionary{Int64, Any}
178+
3-element Dictionary{Int64, Any}
179179
1 │ ((dim=2|id=598|"S=1/2,Site,n=1"), (dim=2|id=123|"1↔2"))
180180
2 │ ((dim=2|id=457|"S=1/2,Site,n=2"), (dim=2|id=123|"1↔2"), (dim=2|id=656|"2↔3…
181181
3 │ ((dim=2|id=683|"S=1/2,Site,n=3"), (dim=2|id=656|"23"))
@@ -192,7 +192,7 @@ and 2 edge(s):
192192
2 => 3
193193
194194
with vertex data:
195-
3-element Dictionaries.Dictionary{Int64, Any}
195+
3-element Dictionary{Int64, Any}
196196
1 │ ((dim=2|id=598|"S=1/2,Site,n=1"), (dim=2|id=382|"12"))
197197
2 │ ((dim=2|id=457|"S=1/2,Site,n=2"), (dim=2|id=382|"12"), (dim=2|id=190|"23
198198
3 │ ((dim=2|id=683|"S=1/2,Site,n=3"), (dim=2|id=190|"2↔3"))
@@ -312,5 +312,9 @@ This file was generated with [weave.jl](https://github.com/JunoLab/Weave.jl) wit
312312
313313
```julia
314314
using ITensorNetworks, Weave
315-
weave(joinpath(pkgdir(ITensorNetworks), "examples", "README.jl"); doctype="github", out_path=pkgdir(ITensorNetworks))
315+
weave(
316+
joinpath(pkgdir(ITensorNetworks), "examples", "README.jl");
317+
doctype="github",
318+
out_path=pkgdir(ITensorNetworks),
319+
)
316320
```

examples/belief_propagation/bpexample.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ using ITensorNetworks
66
using ITensorNetworks: construct_initial_mts, update_all_mts, get_single_site_expec
77

88
n = 4
9-
dims = (n, n)
10-
g = named_grid(dims)
11-
# g = named_comb_tree(dims)
9+
system_dims = (n, n)
10+
g = named_grid(system_dims)
11+
# g = named_comb_tree(system_dims)
1212
s = siteinds("S=1/2", g)
1313
chi = 2
1414

@@ -19,7 +19,7 @@ combiners = linkinds_combiners(ψψ)
1919
ψψ = combine_linkinds(ψψ, combiners)
2020

2121
# Apply Sz to site v
22-
v = one.(dims)
22+
v = one.(system_dims)
2323
= copy(ψ)
2424
Oψ[v] = apply(op("Sz", s[v]), ψ[v])
2525
ψOψ = inner_network(ψ, Oψ; flatten=true, map_bra_linkinds=prime)

examples/contraction_sequence/contraction_sequence.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Random.seed!(1234)
77

88
ITensors.disable_warn_order()
99

10-
dims = (2, 3)
11-
g = named_grid(dims)
10+
system_dims = (2, 3)
11+
g = named_grid(system_dims)
1212
s = siteinds("S=1/2", g)
1313

1414
χ = 10
@@ -17,7 +17,7 @@ s = siteinds("S=1/2", g)
1717
tn = norm_sqr_network(ψ)
1818

1919
# Contraction sequence for exactly computing expectation values
20-
# contract_edges = map(t -> (1, t...), collect(keys(cartesian_to_linear(dims))))
20+
# contract_edges = map(t -> (1, t...), collect(keys(cartesian_to_linear(system_dims))))
2121
# inner_sequence = reduce((x, y) -> [x, y], contract_edges)
2222

2323
println("optimal")

examples/examples.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ using ITensorUnicodePlots
44
using NamedGraphs
55

66
χ, d = 5, 2
7-
dims = (4, 4)
8-
g = named_grid(dims)
7+
system_dims = (4, 4)
8+
g = named_grid(system_dims)
99

1010
# Network of indices
1111
is = IndsNetwork(g; link_space=χ, site_space=d)

examples/partition/partitioning.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ using ITensorUnicodePlots
55
using KaHyPar
66
using Suppressor
77

8-
dims = (4, 4)
9-
g = hypercubic_lattice_graph(dims)
8+
system_dims = (4, 4)
9+
g = hypercubic_lattice_graph(system_dims)
1010

1111
s = siteinds("S=1/2", g)
1212

examples/peps.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ function heisenberg(g::AbstractGraph)
1515
return os
1616
end
1717

18-
dims = (3, 3)
19-
g = named_grid(dims)
18+
system_dims = (3, 3)
19+
g = named_grid(system_dims)
2020
s = siteinds("S=1/2", g)
2121

2222
= heisenberg(g)

examples/peps/ising_tebd.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ Random.seed!(1234)
88

99
ITensors.disable_warn_order()
1010

11-
dims = (6, 6)
12-
n = prod(dims)
13-
g = named_grid(dims)
11+
system_dims = (6, 6)
12+
n = prod(system_dims)
13+
g = named_grid(system_dims)
1414

1515
h = 2.0
1616

1717
@show h
18-
@show dims
18+
@show system_dims
1919

2020
s = siteinds("S=1/2", g)
2121

2222
#
2323
# DMRG comparison
2424
#
2525

26-
g_dmrg = rename_vertices(g, cartesian_to_linear(dims))
26+
g_dmrg = rename_vertices(g, cartesian_to_linear(system_dims))
2727
ℋ_dmrg = ising(g_dmrg; h)
2828
s_dmrg = [only(s[v]) for v in vertices(s)]
2929
H_dmrg = MPO(ℋ_dmrg, s_dmrg)
@@ -33,7 +33,7 @@ E_dmrg, ψ_dmrg = dmrg(
3333
H_dmrg, ψ_dmrg_init; nsweeps=20, maxdim=[fill(10, 10); 20], cutoff=1e-8
3434
)
3535
@show E_dmrg
36-
Z_dmrg = reshape(expect(ψ_dmrg, "Z"), dims)
36+
Z_dmrg = reshape(expect(ψ_dmrg, "Z"), system_dims)
3737

3838
display(Z_dmrg)
3939
display(heatmap(Z_dmrg))
@@ -59,7 +59,7 @@ println("maxdim = $χ")
5959
@show ortho
6060

6161
# Contraction sequence for exactly computing expectation values
62-
inner_sequence = reduce((x, y) -> [x, y], vec(Tuple.(CartesianIndices(dims))))
62+
inner_sequence = reduce((x, y) -> [x, y], vec(Tuple.(CartesianIndices(system_dims))))
6363

6464
println("\nFirst run TEBD without orthogonalization")
6565
ψ = @time tebd(
@@ -81,6 +81,6 @@ E = @time expect(ℋ, ψ; sequence=inner_sequence)
8181

8282
println("\nMeasure magnetization")
8383
Z_dict = @time expect("Z", ψ; sequence=inner_sequence)
84-
Z = [Z_dict[Tuple(I)] for I in CartesianIndices(dims)]
84+
Z = [Z_dict[Tuple(I)] for I in CartesianIndices(system_dims)]
8585
display(Z)
8686
display(heatmap(Z))

src/specialitensornetworks.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RETURN A TENSOR NETWORK WITH COPY TENSORS ON EACH VERTEX.
33
Note that passing a link_space will mean the indices of the resulting network don't match those of the input indsnetwork
44
"""
55
function delta_network(eltype::Type, s::IndsNetwork; link_space=nothing)
6-
return ITensorNetwork((v, inds...) -> δ(eltype, inds...), s; link_space)
6+
return ITensorNetwork((v, inds...) -> delta(eltype, inds...), s; link_space)
77
end
88

99
function delta_network(s::IndsNetwork; link_space=nothing)
@@ -50,7 +50,7 @@ function ising_network(eltype::Type, s::IndsNetwork, beta::Number; szverts=nothi
5050
end
5151

5252
function ising_network(s::IndsNetwork, beta::Number; szverts=nothing)
53-
return ising_network(typeof(beta), s; szverts)
53+
return ising_network(typeof(beta), s, beta; szverts)
5454
end
5555

5656
"""

test/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
66
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
77
ITensorUnicodePlots = "73163f41-4a9e-479f-8353-73bf94dbd758"
88
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
9+
KaHyPar = "2a6221f6-aa48-11e9-3542-2d9e0ef01880"
910
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1011
Metis = "2679e427-3c69-5b7f-982b-ece356f1e94b"
1112
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"

0 commit comments

Comments
 (0)