From 488c345a601d8a5e20d26490a2476a851ed72a3f Mon Sep 17 00:00:00 2001 From: mtfishman Date: Fri, 17 May 2024 00:25:14 -0400 Subject: [PATCH 1/2] Use random_itensor and random_mps --- examples/Project.toml | 11 +++++++++++ examples/ex_dmrg.jl | 10 +++++----- examples/ex_qn_mps.jl | 2 +- examples/notest_ex_qft_circuit.jl | 23 ----------------------- test/Project.toml | 4 ++++ test/test_basics.jl | 10 +++++----- 6 files changed, 26 insertions(+), 34 deletions(-) create mode 100644 examples/Project.toml delete mode 100644 examples/notest_ex_qft_circuit.jl diff --git a/examples/Project.toml b/examples/Project.toml new file mode 100644 index 0000000..493eb70 --- /dev/null +++ b/examples/Project.toml @@ -0,0 +1,11 @@ +[deps] +GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" +Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +ITensorUnicodePlots = "73163f41-4a9e-479f-8353-73bf94dbd758" +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 5ca72b1..0d09b7f 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 5dac790..e9227c5 100644 --- a/examples/ex_qn_mps.jl +++ b/examples/ex_qn_mps.jl @@ -3,7 +3,7 @@ using ITensorMPS using ITensorUnicodePlots 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_qft_circuit.jl b/examples/notest_ex_qft_circuit.jl deleted file mode 100644 index 96c1c6d..0000000 --- a/examples/notest_ex_qft_circuit.jl +++ /dev/null @@ -1,23 +0,0 @@ -using ITensors -using ITensorMPS -using ITensorUnicodePlots -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 width = 100 height = 50 - -fig diff --git a/test/Project.toml b/test/Project.toml index 575f0e7..3c13045 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -7,3 +7,7 @@ LayeredLayouts = "f4a74d36-062a-4d48-97cd-1356bad1de4e" NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf" 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 40d0300..9e41436 100644 --- a/test/test_basics.jl +++ b/test/test_basics.jl @@ -19,11 +19,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] From 4a4977481b11f7cc69767092d6faa8022a4271ce Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 17 May 2024 00:48:32 -0400 Subject: [PATCH 2/2] Bump to v0.1.5 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 08c7994..7064fc6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorUnicodePlots" uuid = "73163f41-4a9e-479f-8353-73bf94dbd758" authors = ["Matthew Fishman "] -version = "0.1.4" +version = "0.1.5" [deps] Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"