diff --git a/Project.toml b/Project.toml index da997b9..0be11b7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorVisualizationBase" uuid = "cd2553d2-8bef-4d93-8a38-c62f17d5ad23" authors = ["Matthew Fishman and contributors"] -version = "0.1.10" +version = "0.1.11" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" diff --git a/README.md b/README.md index 06d97ae..75e303b 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ j = Index(10, "j") k = Index(40, "k") l = Index(40, "l") m = Index(40, "m") -A = randomITensor(i, j, k) -B = randomITensor(i, j, l, m) -C = randomITensor(k, l) +A = random_itensor(i, j, k) +B = random_itensor(i, j, l, m) +C = random_itensor(k, l) ABC = @visualize A * B * C ``` This will execute the contraction and output diff --git a/examples/Project.toml b/examples/Project.toml new file mode 100644 index 0000000..cb8c246 --- /dev/null +++ b/examples/Project.toml @@ -0,0 +1,12 @@ +[deps] +GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" +Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" +ITensorVisualizationBase = "cd2553d2-8bef-4d93-8a38-c62f17d5ad23" +ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" +LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e" +NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" + +[compat] +ITensorMPS = "0.2.2" +ITensors = "0.6.8" diff --git a/examples/ex_dmrg.jl b/examples/ex_dmrg.jl index f91751d..b4c3778 100644 --- a/examples/ex_dmrg.jl +++ b/examples/ex_dmrg.jl @@ -14,11 +14,11 @@ x = Index([QN("Sz", 0) => 2]; tags="X") y = Index([QN("Sz", 0) => 2]; tags="Y") n = 2 -ψn1n2 = randomITensor(l⃗[n - 1], s⃗[n], s⃗[n + 1], l⃗[n + 1], dag(x), dag(y)) -hn1 = randomITensor(dag(h⃗[n - 1]), s⃗[n]', dag(s⃗[n]), h⃗[n], x, y) -hn2 = randomITensor(dag(h⃗[n]), s⃗[n + 1]', dag(s⃗[n + 1]), h⃗[n + 1]) -ELn0 = randomITensor(l⃗[n - 1]', h⃗[n - 1], dag(l⃗[n - 1])) -ERn2 = randomITensor(l⃗[n + 1]', dag(h⃗[n + 1]), dag(l⃗[n + 1])) +ψn1n2 = random_itensor(l⃗[n - 1], s⃗[n], s⃗[n + 1], l⃗[n + 1], dag(x), dag(y)) +hn1 = random_itensor(dag(h⃗[n - 1]), s⃗[n]', dag(s⃗[n]), h⃗[n], x, y) +hn2 = random_itensor(dag(h⃗[n]), s⃗[n + 1]', dag(s⃗[n + 1]), h⃗[n + 1]) +ELn0 = random_itensor(l⃗[n - 1]', h⃗[n - 1], dag(l⃗[n - 1])) +ERn2 = random_itensor(l⃗[n + 1]', dag(h⃗[n + 1]), dag(l⃗[n + 1])) edge_labels = (; plevs=true) diff --git a/examples/ex_qn_mps.jl b/examples/ex_qn_mps.jl index 6e1d26a..583ba34 100644 --- a/examples/ex_qn_mps.jl +++ b/examples/ex_qn_mps.jl @@ -3,7 +3,7 @@ using ITensorMPS using ITensorVisualizationBase s = siteinds("S=1/2", 5; conserve_qns=true) -ψ = randomMPS(s, n -> isodd(n) ? "↑" : "↓"; linkdims=2) +ψ = random_mps(s, n -> isodd(n) ? "↑" : "↓"; linkdims=2) orthogonalize!(ψ, 2) ψdag = prime(linkinds, dag(ψ)) tn = [ψ..., ψdag...] diff --git a/examples/notest_ex_2d_circuit.jl b/examples/notest_ex_2d_circuit.jl deleted file mode 100644 index d42462a..0000000 --- a/examples/notest_ex_2d_circuit.jl +++ /dev/null @@ -1,27 +0,0 @@ -using ITensors -using ITensorMPS -using ITensorVisualizationBase -using Graphs -using LayeredLayouts -using PastaQ: randomcircuit - -Nx, Ny = 3, 3 -N = Nx * Ny -# TODO: change to (Nx, Ny) with PastaQ v0.0.16 -gates = randomcircuit( - Nx, Ny; depth=4, twoqubitgates="CX", onequbitgates="Rn", layered=false, rotated=false -) - -s = siteinds("Qubit", N) - -U, s̃ = circuit_network(gates, s) -ψ = MPS(s) -ψ̃ = MPS(s̃) -tn = [prod(ψ), U..., prod(ψ̃)] - -edge_labels = (; plevs=true) -layout(g) = layered_layout(solve_positions(Zarate(), g)) -@visualize fig tn arrow_show = true edge_labels = edge_labels layout = layout edge_textsize = - 20 - -fig diff --git a/examples/notest_ex_qft_circuit.jl b/examples/notest_ex_qft_circuit.jl deleted file mode 100644 index b62fe09..0000000 --- a/examples/notest_ex_qft_circuit.jl +++ /dev/null @@ -1,23 +0,0 @@ -using ITensors -using ITensorMPS -using ITensorVisualizationBase -using Graphs -using LayeredLayouts -using PastaQ: qft - -N = 4 -gates = qft(N) - -s = siteinds("Qubit", N) - -U, s̃ = circuit_network(gates, s) -ψ = MPS(s) -ψ̃ = MPS(s̃) -tn = [ψ..., U..., ψ̃...] - -edge_labels = (; tags=true, plevs=true) -layout(g) = layered_layout(solve_positions(Zarate(), g)) -@visualize fig tn arrow_show = true edge_labels = edge_labels edge_textsize = 20 layout = - layout - -fig diff --git a/test/Project.toml b/test/Project.toml index 2555433..3db06b3 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -2,7 +2,12 @@ GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" +ITensorVisualizationBase = "cd2553d2-8bef-4d93-8a38-c62f17d5ad23" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e" NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[compat] +ITensorMPS = "0.2.2" +ITensors = "0.6.8" diff --git a/test/test_basics.jl b/test/test_basics.jl index 7530dda..70b9b79 100644 --- a/test/test_basics.jl +++ b/test/test_basics.jl @@ -16,11 +16,11 @@ using Test y = Index([QN("Sz", 0) => 2]; tags="Y") n = 2 - ψn1n2 = randomITensor(l⃗[n - 1], s⃗[n], s⃗[n + 1], l⃗[n + 1], dag(x), dag(y)) - hn1 = randomITensor(dag(h⃗[n - 1]), s⃗[n]', dag(s⃗[n]), h⃗[n], x, y) - hn2 = randomITensor(dag(h⃗[n]), s⃗[n + 1]', dag(s⃗[n + 1]), h⃗[n + 1]) - ELn0 = randomITensor(l⃗[n - 1]', h⃗[n - 1], dag(l⃗[n - 1])) - ERn2 = randomITensor(l⃗[n + 1]', dag(h⃗[n + 1]), dag(l⃗[n + 1])) + ψn1n2 = random_itensor(l⃗[n - 1], s⃗[n], s⃗[n + 1], l⃗[n + 1], dag(x), dag(y)) + hn1 = random_itensor(dag(h⃗[n - 1]), s⃗[n]', dag(s⃗[n]), h⃗[n], x, y) + hn2 = random_itensor(dag(h⃗[n]), s⃗[n + 1]', dag(s⃗[n + 1]), h⃗[n + 1]) + ELn0 = random_itensor(l⃗[n - 1]', h⃗[n - 1], dag(l⃗[n - 1])) + ERn2 = random_itensor(l⃗[n + 1]', dag(h⃗[n + 1]), dag(l⃗[n + 1])) tn = [ELn0, ψn1n2, hn1, hn2, ERn2]