Skip to content

Commit

Permalink
Start using ITensorMPS.jl (#172)
Browse files Browse the repository at this point in the history
* Start using ITensorMPS.jl

* Bump to v0.11.5
  • Loading branch information
mtfishman authored May 10, 2024
1 parent 411786e commit f9c7012
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 28 deletions.
16 changes: 9 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensorNetworks"
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
version = "0.11.4"
version = "0.11.5"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/abstractitensornetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/boundarymps.jl
Original file line number Diff line number Diff line change
@@ -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...)
Expand Down
2 changes: 1 addition & 1 deletion src/caches/beliefpropagationcache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/expect.jl
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
2 changes: 1 addition & 1 deletion src/mpo_mps_compatibility.jl
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/partitioneditensornetwork.jl
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/solvers/alternating_update/alternating_update.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ITensors: state
using ITensors.ITensorMPS: linkind
using ITensorMPS: linkind
using NamedGraphs.GraphsExtensions: GraphsExtensions

function alternating_update(
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/defaults.jl
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dmrg.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ITensors.ITensorMPS: ITensorMPS, dmrg
using ITensorMPS: ITensorMPS, dmrg
using KrylovKit: KrylovKit

"""
Expand Down
2 changes: 1 addition & 1 deletion src/treetensornetworks/abstracttreetensornetwork.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/treetensornetworks/opsum_to_ttn/opsum_to_ttn.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#using FillArrays: OneElement
#using DataGraphs: DataGraph
using Graphs: degree, is_tree
using ITensors: flux, has_fermion_string, itensor, ops, removeqns, space, truncate!, val
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
Expand Down
2 changes: 1 addition & 1 deletion src/treetensornetworks/projttns/abstractprojttn.jl
Original file line number Diff line number Diff line change
@@ -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

Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/test_binary_tree_partition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion test/test_opsum_to_ttn.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_tebd.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_treetensornetworks/test_expect.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_treetensornetworks/test_solvers/test_contract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions test/test_treetensornetworks/test_solvers/test_dmrg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@
using DataGraphs: edge_data, vertex_data
using Dictionaries: Dictionary
using Graphs: nv, vertices
using ITensors: ITensors
using ITensors.ITensorMPS: ITensorMPS, linkdims
using ITensorMPS: ITensorMPS
using ITensorNetworks:
ITensorNetworks, OpSum, ttn, apply, dmrg, inner, mpo, random_mps, random_ttn, siteinds
ITensorNetworks,
OpSum,
ttn,
apply,
dmrg,
inner,
mpo,
random_mps,
random_ttn,
linkdims,
siteinds
using ITensorNetworks.ITensorsExtensions: replace_vertices
using ITensorNetworks.ModelHamiltonians: ModelHamiltonians
using ITensors: ITensors
using KrylovKit: eigsolve
using NamedGraphs.NamedGraphGenerators: named_comb_tree
using Observers: observer
Expand Down

2 comments on commit f9c7012

@mtfishman
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/106559

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.11.5 -m "<description of version>" f9c701290b554c090648daba1da0a03912c88031
git push origin v0.11.5

Please sign in to comment.