From 76d6e9fa75f8f29f8b5e9c0528afc90df89b1e15 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Thu, 9 May 2024 17:43:04 -0400 Subject: [PATCH 1/3] Start using ITensorMPS --- Project.toml | 16 +++++++++------- src/abstractitensornetwork.jl | 2 +- src/apply.jl | 2 +- src/boundarymps.jl | 2 +- src/caches/beliefpropagationcache.jl | 2 +- src/expect.jl | 2 +- src/mpo_mps_compatibility.jl | 2 +- src/partitioneditensornetwork.jl | 2 +- .../alternating_update/alternating_update.jl | 2 +- src/solvers/defaults.jl | 2 +- src/solvers/dmrg.jl | 2 +- .../abstracttreetensornetwork.jl | 2 +- src/treetensornetworks/opsum_to_ttn.jl | 2 +- .../projttns/abstractprojttn.jl | 2 +- test/Project.toml | 1 + test/test_binary_tree_partition.jl | 2 +- test/test_opsum_to_ttn.jl | 2 +- test/test_tebd.jl | 2 +- test/test_treetensornetworks/test_expect.jl | 2 +- .../test_solvers/test_contract.jl | 2 +- .../test_solvers/test_dmrg.jl | 2 +- 21 files changed, 29 insertions(+), 26 deletions(-) diff --git a/Project.toml b/Project.toml index 288ebd6a..db48d326 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorNetworks" uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7" authors = ["Matthew Fishman , Joseph Tindall and contributors"] -version = "0.11.3" +version = "0.11.4" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" @@ -13,6 +13,7 @@ Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" IsApprox = "28f27b66-4bd8-47e7-9110-e2746eb8bed7" IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" @@ -36,14 +37,14 @@ TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6" [weakdeps] EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5" GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" -Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" +Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" [extensions] ITensorNetworksEinExprsExt = "EinExprs" ITensorNetworksGraphsFlowsExt = "GraphsFlows" -ITensorNetworksObserversExt = "Observers" ITensorNetworksOMEinsumContractionOrdersExt = "OMEinsumContractionOrders" +ITensorNetworksObserversExt = "Observers" [compat] AbstractTrees = "0.4.4" @@ -57,14 +58,15 @@ DocStringExtensions = "0.9" EinExprs = "0.6.4" Graphs = "1.8" GraphsFlows = "0.1.1" -ITensors = "0.4, 0.5" +ITensorMPS = "0.1" +ITensors = "0.4, 0.5, 0.6" IsApprox = "0.1" IterTools = "1.4.0" KrylovKit = "0.6, 0.7" -NamedGraphs = "0.6.0" NDTensors = "0.3" -Observers = "0.2.4" +NamedGraphs = "0.6.0" OMEinsumContractionOrders = "0.8.3" +Observers = "0.2.4" PackageExtensionCompat = "1" SerializedElementArrays = "0.1" SimpleTraits = "0.9" @@ -80,8 +82,8 @@ julia = "1.10" [extras] EinExprs = "b1794770-133b-4de1-afb4-526377e9f4c5" GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" -Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" OMEinsumContractionOrders = "6f22d1fd-8eed-4bb7-9776-e7d684900715" +Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] diff --git a/src/abstractitensornetwork.jl b/src/abstractitensornetwork.jl index 80b127f6..b7d75327 100644 --- a/src/abstractitensornetwork.jl +++ b/src/abstractitensornetwork.jl @@ -36,7 +36,7 @@ using ITensors: settags, sim, swaptags -using ITensors.ITensorMPS: ITensorMPS, add, linkdim, linkinds, siteinds +using ITensorMPS: ITensorMPS, add, linkdim, linkinds, siteinds using .ITensorsExtensions: ITensorsExtensions, indtype, promote_indtype using LinearAlgebra: LinearAlgebra, factorize using NamedGraphs: NamedGraphs, NamedGraph, not_implemented diff --git a/src/apply.jl b/src/apply.jl index 8548acc8..3af3a1f2 100644 --- a/src/apply.jl +++ b/src/apply.jl @@ -23,7 +23,7 @@ using ITensors: unioninds, uniqueinds using ITensors.ContractionSequenceOptimization: optimal_contraction_sequence -using ITensors.ITensorMPS: siteinds +using ITensorMPS: siteinds using KrylovKit: linsolve using LinearAlgebra: eigen, norm, svd using NamedGraphs: NamedEdge, has_edge diff --git a/src/boundarymps.jl b/src/boundarymps.jl index 84f567fc..b37f4249 100644 --- a/src/boundarymps.jl +++ b/src/boundarymps.jl @@ -1,5 +1,5 @@ using ITensors: inner -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS #Given an ITensorNetwork on an Lx*Ly grid with sites indexed as (i,j) then perform contraction using a sequence of mps-mpo contractions function contract_boundary_mps(tn::ITensorNetwork; kwargs...) diff --git a/src/caches/beliefpropagationcache.jl b/src/caches/beliefpropagationcache.jl index aa816c2b..2ce338f3 100644 --- a/src/caches/beliefpropagationcache.jl +++ b/src/caches/beliefpropagationcache.jl @@ -2,7 +2,7 @@ using Graphs: IsDirected using SplitApplyCombine: group using LinearAlgebra: diag using ITensors: dir -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using NamedGraphs.PartitionedGraphs: PartitionedGraphs, PartitionedGraph, diff --git a/src/expect.jl b/src/expect.jl index 8b4b6526..e1d46a9f 100644 --- a/src/expect.jl +++ b/src/expect.jl @@ -1,6 +1,6 @@ using Dictionaries: Dictionary, set! using ITensors: Op, op, contract, siteinds, which_op -using ITensors.ITensorMPS: ITensorMPS, expect +using ITensorMPS: ITensorMPS, expect default_expect_alg() = "bp" diff --git a/src/mpo_mps_compatibility.jl b/src/mpo_mps_compatibility.jl index a0479279..a0c0b228 100644 --- a/src/mpo_mps_compatibility.jl +++ b/src/mpo_mps_compatibility.jl @@ -1,4 +1,4 @@ -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS function ITensorMPS.MPO(opsum::OpSum, s::IndsNetwork) s_linear = [only(s[v]) for v in 1:nv(s)] diff --git a/src/partitioneditensornetwork.jl b/src/partitioneditensornetwork.jl index e249c973..7a023adc 100644 --- a/src/partitioneditensornetwork.jl +++ b/src/partitioneditensornetwork.jl @@ -1,6 +1,6 @@ using Graphs: dst, src using ITensors: commoninds -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using NamedGraphs.GraphsExtensions: subgraph using NamedGraphs.PartitionedGraphs: PartitionedGraph, PartitionEdge diff --git a/src/solvers/alternating_update/alternating_update.jl b/src/solvers/alternating_update/alternating_update.jl index 160e68f9..2cd5de71 100644 --- a/src/solvers/alternating_update/alternating_update.jl +++ b/src/solvers/alternating_update/alternating_update.jl @@ -1,5 +1,5 @@ using ITensors: state -using ITensors.ITensorMPS: linkind +using ITensorMPS: linkind using NamedGraphs.GraphsExtensions: GraphsExtensions function alternating_update( diff --git a/src/solvers/defaults.jl b/src/solvers/defaults.jl index 9c593827..b5d315ff 100644 --- a/src/solvers/defaults.jl +++ b/src/solvers/defaults.jl @@ -1,5 +1,5 @@ using Printf: @printf -using ITensors.ITensorMPS: maxlinkdim +using ITensorMPS: maxlinkdim default_outputlevel() = 0 default_nsites() = 2 default_nsweeps() = 1 #? or nothing? diff --git a/src/solvers/dmrg.jl b/src/solvers/dmrg.jl index 85bfa678..19511505 100644 --- a/src/solvers/dmrg.jl +++ b/src/solvers/dmrg.jl @@ -1,4 +1,4 @@ -using ITensors.ITensorMPS: ITensorMPS, dmrg +using ITensorMPS: ITensorMPS, dmrg using KrylovKit: KrylovKit """ diff --git a/src/treetensornetworks/abstracttreetensornetwork.jl b/src/treetensornetworks/abstracttreetensornetwork.jl index 8c54bddb..c8dccb1f 100644 --- a/src/treetensornetworks/abstracttreetensornetwork.jl +++ b/src/treetensornetworks/abstracttreetensornetwork.jl @@ -3,7 +3,7 @@ using NamedGraphs.GraphsExtensions: GraphsExtensions, edge_path, leaf_vertices, post_order_dfs_edges, post_order_dfs_vertices using IsApprox: IsApprox, Approx using ITensors: @Algorithm_str, directsum, hasinds, permute, plev -using ITensors.ITensorMPS: linkind, loginner, lognorm, orthogonalize +using ITensorMPS: linkind, loginner, lognorm, orthogonalize using TupleTools: TupleTools abstract type AbstractTreeTensorNetwork{V} <: AbstractITensorNetwork{V} end diff --git a/src/treetensornetworks/opsum_to_ttn.jl b/src/treetensornetworks/opsum_to_ttn.jl index c54d3b01..8f28c383 100644 --- a/src/treetensornetworks/opsum_to_ttn.jl +++ b/src/treetensornetworks/opsum_to_ttn.jl @@ -1,6 +1,6 @@ using Graphs: degree, is_tree using ITensors: flux, has_fermion_string, itensor, ops, removeqns, space, val -using ITensors.ITensorMPS: ITensorMPS, cutoff, linkdims, truncate! +using ITensorMPS: ITensorMPS, cutoff, linkdims, truncate! using ITensors.LazyApply: Prod, Sum, coefficient using ITensors.NDTensors: Block, blockdim, maxdim, nblocks, nnzblocks using ITensors.Ops: Op, OpSum diff --git a/src/treetensornetworks/projttns/abstractprojttn.jl b/src/treetensornetworks/projttns/abstractprojttn.jl index 040f7f56..55852677 100644 --- a/src/treetensornetworks/projttns/abstractprojttn.jl +++ b/src/treetensornetworks/projttns/abstractprojttn.jl @@ -1,7 +1,7 @@ using DataGraphs: DataGraphs, underlying_graph using Graphs: neighbors using ITensors: ITensor, contract, order, product -using ITensors.ITensorMPS: ITensorMPS, nsite +using ITensorMPS: ITensorMPS, nsite using NamedGraphs: NamedGraphs, NamedEdge, vertextype using NamedGraphs.GraphsExtensions: incident_edges diff --git a/test/Project.toml b/test/Project.toml index a5b76d30..0ea7fb5d 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -9,6 +9,7 @@ Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889" ITensorGaussianMPS = "2be41995-7c9f-4653-b682-bfa4e7cebb93" +ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" ITensorNetworks = "2919e153-833c-4bdc-8836-1ea460a35fc7" ITensorUnicodePlots = "73163f41-4a9e-479f-8353-73bf94dbd758" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" diff --git a/test/test_binary_tree_partition.jl b/test/test_binary_tree_partition.jl index c5fc6a85..970d7f1b 100644 --- a/test/test_binary_tree_partition.jl +++ b/test/test_binary_tree_partition.jl @@ -4,7 +4,7 @@ using Graphs: add_vertex!, vertices # Trigger package extension. using GraphsFlows: GraphsFlows using ITensors: Index, ITensor, contract, noncommoninds, randomITensor -using ITensors.ITensorMPS: MPS +using ITensorMPS: MPS using ITensorNetworks: _DensityMartrixAlgGraph, _contract_deltas_ignore_leaf_partitions, diff --git a/test/test_opsum_to_ttn.jl b/test/test_opsum_to_ttn.jl index 2bcbd556..d8b64310 100644 --- a/test/test_opsum_to_ttn.jl +++ b/test/test_opsum_to_ttn.jl @@ -13,7 +13,7 @@ using ITensors: dag, inds, removeqns -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using ITensors.NDTensors: matrix using ITensorGaussianMPS: ITensorGaussianMPS using ITensorNetworks: ITensorNetworks, OpSum, ttn, siteinds diff --git a/test/test_tebd.jl b/test/test_tebd.jl index 64e16c57..cdec4a1b 100644 --- a/test/test_tebd.jl +++ b/test/test_tebd.jl @@ -1,7 +1,7 @@ @eval module $(gensym()) using Graphs: vertices using ITensors: ITensors -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using ITensorNetworks: ITensorNetwork, cartesian_to_linear, dmrg, expect, siteinds, tebd using ITensorNetworks.ITensorsExtensions: group_terms using ITensorNetworks.ModelHamiltonians: ModelHamiltonians diff --git a/test/test_treetensornetworks/test_expect.jl b/test/test_treetensornetworks/test_expect.jl index 3dc5c1b1..48ce2aa9 100644 --- a/test/test_treetensornetworks/test_expect.jl +++ b/test/test_treetensornetworks/test_expect.jl @@ -1,6 +1,6 @@ @eval module $(gensym()) using Graphs: vertices -using ITensors.ITensorMPS: MPS +using ITensorMPS: MPS using ITensorNetworks: ttn, expect, random_mps, siteinds using LinearAlgebra: norm using NamedGraphs.NamedGraphGenerators: named_comb_tree diff --git a/test/test_treetensornetworks/test_solvers/test_contract.jl b/test/test_treetensornetworks/test_solvers/test_contract.jl index 4c5efc88..6c2c7e48 100644 --- a/test/test_treetensornetworks/test_solvers/test_contract.jl +++ b/test/test_treetensornetworks/test_solvers/test_contract.jl @@ -17,7 +17,7 @@ using ITensorNetworks: siteinds using ITensorNetworks.ModelHamiltonians: ModelHamiltonians using ITensors: prime, replaceinds, replaceprime -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using LinearAlgebra: norm, normalize using NamedGraphs.NamedGraphGenerators: named_comb_tree using Test: @test, @test_broken, @testset diff --git a/test/test_treetensornetworks/test_solvers/test_dmrg.jl b/test/test_treetensornetworks/test_solvers/test_dmrg.jl index 2e9f3f6d..a67df92a 100644 --- a/test/test_treetensornetworks/test_solvers/test_dmrg.jl +++ b/test/test_treetensornetworks/test_solvers/test_dmrg.jl @@ -3,7 +3,7 @@ using DataGraphs: edge_data, vertex_data using Dictionaries: Dictionary using Graphs: nv, vertices using ITensors: ITensors -using ITensors.ITensorMPS: ITensorMPS +using ITensorMPS: ITensorMPS using ITensorNetworks: ITensorNetworks, OpSum, From 9b802f9056f01bb9253d3a101800219fa69b9952 Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 May 2024 11:26:53 -0400 Subject: [PATCH 2/3] Bump to v0.11.5 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index db48d326..56f2e96e 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorNetworks" uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7" authors = ["Matthew Fishman , Joseph Tindall and contributors"] -version = "0.11.4" +version = "0.11.5" [deps] AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" From 3fec8a12e4491d54dd76572c9fb6a4a89ed0a747 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Fri, 10 May 2024 11:30:34 -0400 Subject: [PATCH 3/3] Fix namespace issue --- src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl b/src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl index 03566f50..09098b68 100644 --- a/src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl +++ b/src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl @@ -1,8 +1,8 @@ #using FillArrays: OneElement #using DataGraphs: DataGraph using Graphs: degree, is_tree -using ITensorMPS: ITensorMPS, cutoff, linkdims, ops, space, truncate!, val -using ITensors: flux, has_fermion_string, itensor, removeqns +using ITensorMPS: ITensorMPS, cutoff, linkdims, ops, truncate!, val +using ITensors: flux, has_fermion_string, itensor, removeqns, space using ITensors.LazyApply: Prod, Sum, coefficient using ITensors.NDTensors: Block, blockdim, maxdim, nblocks, nnzblocks using ITensors.Ops: argument, coefficient, Op, OpSum, name, params, site, terms, which_op