Skip to content

Commit

Permalink
Merge branch 'main' into rsvd
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored Apr 26, 2024
2 parents 1930c8c + f0d6a6f commit e4b5863
Show file tree
Hide file tree
Showing 165 changed files with 5,606 additions and 6,796 deletions.
1 change: 0 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7'
- '1'
os:
- ubuntu-latest
Expand Down
47 changes: 35 additions & 12 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]> and contributors"]
version = "0.4.0"
version = "0.10.1"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand All @@ -13,52 +13,75 @@ Dictionaries = "85a47980-9c8c-11e8-2b9f-f7ca1fa99fb4"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
GraphsFlows = "06909019-6f44-4949-96fc-b9d9aaa02889"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
IsApprox = "28f27b66-4bd8-47e7-9110-e2746eb8bed7"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NDTensors = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
Observers = "338f10d5-c7f1-4033-a7d1-f9dec39bcaa0"
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SerializedElementArrays = "d3ce8812-9567-47e9-a7b5-65a6d70a3065"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2"
SplitApplyCombine = "03a91e81-4c3e-53e1-a0a4-9c0c8f19dd66"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructWalk = "31cdf514-beb7-4750-89db-dda9d2eb8d3d"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
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"

[extensions]
ITensorNetworksEinExprsExt = "EinExprs"
ITensorNetworksGraphsFlowsExt = "GraphsFlows"
ITensorNetworksObserversExt = "Observers"
ITensorNetworksOMEinsumContractionOrdersExt = "OMEinsumContractionOrders"

[compat]
AbstractTrees = "0.4.4"
Combinatorics = "1"
Compat = "3, 4"
DataGraphs = "0.1.7"
DataGraphs = "0.2.3"
DataStructures = "0.18"
Dictionaries = "0.4"
Distributions = "0.25.86"
DocStringExtensions = "0.8, 0.9"
DocStringExtensions = "0.9"
EinExprs = "0.6.4"
Graphs = "1.8"
GraphsFlows = "0.1.1"
ITensors = "0.3.23"
ITensors = "0.4"
IsApprox = "0.1"
IterTools = "1.4.0"
KrylovKit = "0.6.0"
NamedGraphs = "0.1.11"
KrylovKit = "0.6, 0.7"
NamedGraphs = "0.6.0"
NDTensors = "0.3"
Observers = "0.2"
Requires = "1.3"
OMEinsumContractionOrders = "0.8.3"
PackageExtensionCompat = "1"
SerializedElementArrays = "0.1"
SimpleTraits = "0.9"
SparseArrayKit = "0.2.1"
SparseArrayKit = "0.3"
SplitApplyCombine = "1.2"
StaticArrays = "1.5.12"
StructWalk = "0.2"
Suppressor = "0.2"
TimerOutputs = "0.5.22"
TupleTools = "1.4"
julia = "1.7"
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"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
Expand Down
103 changes: 63 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
> [!WARNING]
> This is a pre-release software. There are no guarantees that functionality won't break
> from version to version, though we will try our best to indicate breaking changes
> following [semantic versioning](https://semver.org/) (semver) by bumping the minor
> version of the package. We are biasing heavily towards "moving fast and breaking things"
> during this stage of development, which will allow us to more quickly develop the package
> and bring it to a point where we have enough features and are happy enough with the external
> interface to officially release it for general public use.
>
> In short, use this package with caution, and don't expect the interface to be stable
> or for us to clearly announce parts of the code we are changing.


# ITensorNetworks

A package to provide general network data structures and tools to use with ITensors.jl.
Expand All @@ -18,13 +32,13 @@ julia> ] add ITensorNetworks
Here are is an example of making a tensor network on a chain graph (a tensor train or matrix product state):

```julia
julia> using ITensors
julia> using Graphs: neighbors, path_graph

julia> using ITensorNetworks
julia> using ITensorNetworks: ITensorNetwork

julia> tn = ITensorNetwork(named_grid(4); link_space=2)
ITensorNetwork{Int64} with 4 vertices:
4-element Vector{Int64}:
julia> tn = ITensorNetwork(path_graph(4); link_space=2)
ITensorNetworks.ITensorNetwork{Int64} with 4 vertices:
4-element NamedGraphs.OrderedDictionaries.OrderedIndices{Int64}
1
2
3
Expand All @@ -36,7 +50,7 @@ and 3 edge(s):
3 => 4

with vertex data:
4-element Dictionary{Int64, Any}
4-element Dictionaries.Dictionary{Int64, Any}
1 │ ((dim=2|id=739|"1,2"),)
2 │ ((dim=2|id=739|"1,2"), (dim=2|id=920|"2,3"))
3 │ ((dim=2|id=920|"2,3"), (dim=2|id=761|"3,4"))
Expand Down Expand Up @@ -73,9 +87,13 @@ julia> neighbors(tn, 4)
and here is a similar example for making a tensor network on a grid (a tensor product state or project entangled pair state (PEPS)):

```julia
julia> using NamedGraphs.GraphsExtensions: subgraph

julia> using NamedGraphs.NamedGraphGenerators: named_grid

julia> tn = ITensorNetwork(named_grid((2, 2)); link_space=2)
ITensorNetwork{Tuple{Int64, Int64}} with 4 vertices:
4-element Vector{Tuple{Int64, Int64}}:
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 4 vertices:
4-element NamedGraphs.OrderedDictionaries.OrderedIndices{Tuple{Int64, Int64}}
(1, 1)
(2, 1)
(1, 2)
Expand All @@ -88,7 +106,7 @@ and 4 edge(s):
(1, 2) => (2, 2)

with vertex data:
4-element Dictionary{Tuple{Int64, Int64}, Any}
4-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
(1, 1) │ ((dim=2|id=74|"1×1,2×1"), (dim=2|id=723|"1×1,1×2"))
(2, 1) │ ((dim=2|id=74|"1×1,2×1"), (dim=2|id=823|"2×1,2×2"))
(1, 2) │ ((dim=2|id=723|"1×1,1×2"), (dim=2|id=712|"1×2,2×2"))
Expand All @@ -109,30 +127,30 @@ julia> neighbors(tn, (1, 2))
(2, 2)

julia> tn_1 = subgraph(v -> v[1] == 1, tn)
ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element Vector{Tuple{Int64, Int64}}:
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element NamedGraphs.OrderedDictionaries.OrderedIndices{Tuple{Int64, Int64}}
(1, 1)
(1, 2)

and 1 edge(s):
(1, 1) => (1, 2)

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

julia> tn_2 = subgraph(v -> v[1] == 2, tn)
ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element Vector{Tuple{Int64, Int64}}:
ITensorNetworks.ITensorNetwork{Tuple{Int64, Int64}} with 2 vertices:
2-element NamedGraphs.OrderedDictionaries.OrderedIndices{Tuple{Int64, Int64}}
(2, 1)
(2, 2)

and 1 edge(s):
(2, 1) => (2, 2)

with vertex data:
2-element Dictionary{Tuple{Int64, Int64}, Any}
2-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
(2, 1) │ ((dim=2|id=74|"1×1,2×1"), (dim=2|id=823|"2×1,2×2"))
(2, 2) │ ((dim=2|id=823|"2×1,2×2"), (dim=2|id=712|"1×2,2×2"))
```
Expand All @@ -141,11 +159,15 @@ with vertex data:
Networks can also be merged/unioned:

```julia
julia> using ITensorUnicodePlots
julia> using ITensors: prime

julia> using ITensorNetworks: , contract, contraction_sequence, siteinds

julia> using ITensorUnicodePlots: @visualize

julia> s = siteinds("S=1/2", named_grid(3))
IndsNetwork{Int64, Index} with 3 vertices:
3-element Vector{Int64}:
ITensorNetworks.IndsNetwork{Int64, ITensors.Index} with 3 vertices:
3-element NamedGraphs.OrderedDictionaries.OrderedIndices{Int64}
1
2
3
Expand All @@ -155,17 +177,17 @@ and 2 edge(s):
2 => 3

with vertex data:
3-element Dictionary{Int64, Vector{Index}}
1 │ Index[(dim=2|id=598|"S=1/2,Site,n=1")]
2 │ Index[(dim=2|id=457|"S=1/2,Site,n=2")]
3 │ Index[(dim=2|id=683|"S=1/2,Site,n=3")]
3-element Dictionaries.Dictionary{Int64, Vector{ITensors.Index}}
1ITensors.Index[(dim=2|id=683|"S=1/2,Site,n=1")]
2ITensors.Index[(dim=2|id=123|"S=1/2,Site,n=2")]
3ITensors.Index[(dim=2|id=656|"S=1/2,Site,n=3")]

and edge data:
0-element Dictionary{NamedEdge{Int64}, Vector{Index}}
0-element Dictionaries.Dictionary{NamedGraphs.NamedEdge{Int64}, Vector{ITensors.Index}}

julia> tn1 = ITensorNetwork(s; link_space=2)
ITensorNetwork{Int64} with 3 vertices:
3-element Vector{Int64}:
ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
3-element NamedGraphs.OrderedDictionaries.OrderedIndices{Int64}
1
2
3
Expand All @@ -175,14 +197,14 @@ and 2 edge(s):
2 => 3

with vertex data:
3-element Dictionary{Int64, Any}
1 │ ((dim=2|id=598|"S=1/2,Site,n=1"), (dim=2|id=123|"1,2"))
2 │ ((dim=2|id=457|"S=1/2,Site,n=2"), (dim=2|id=123|"1,2"), (dim=2|id=656|"2,3…
3 │ ((dim=2|id=683|"S=1/2,Site,n=3"), (dim=2|id=656|"2,3"))
3-element Dictionaries.Dictionary{Int64, Any}
1 │ ((dim=2|id=683|"S=1/2,Site,n=1"), (dim=2|id=382|"1,2"))
2 │ ((dim=2|id=123|"S=1/2,Site,n=2"), (dim=2|id=382|"1,2"), (dim=2|id=190|"2,3…
3 │ ((dim=2|id=656|"S=1/2,Site,n=3"), (dim=2|id=190|"2,3"))
julia> tn2 = ITensorNetwork(s; link_space=2)
ITensorNetwork{Int64} with 3 vertices:
3-element Vector{Int64}:
ITensorNetworks.ITensorNetwork{Int64} with 3 vertices:
3-element NamedGraphs.OrderedDictionaries.OrderedIndices{Int64}
1
2
3
Expand All @@ -192,10 +214,10 @@ and 2 edge(s):
2 => 3
with vertex data:
3-element Dictionary{Int64, Any}
1 │ ((dim=2|id=598|"S=1/2,Site,n=1"), (dim=2|id=382|"1,2"))
2 │ ((dim=2|id=457|"S=1/2,Site,n=2"), (dim=2|id=382|"1,2"), (dim=2|id=190|"2,3
3 │ ((dim=2|id=683|"S=1/2,Site,n=3"), (dim=2|id=190|"2,3"))
3-element Dictionaries.Dictionary{Int64, Any}
1 │ ((dim=2|id=683|"S=1/2,Site,n=1"), (dim=2|id=934|"1,2"))
2 │ ((dim=2|id=123|"S=1/2,Site,n=2"), (dim=2|id=934|"1,2"), (dim=2|id=614|"2,3
3 │ ((dim=2|id=656|"S=1/2,Site,n=3"), (dim=2|id=614|"2,3"))

julia> @visualize tn1;
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
Expand Down Expand Up @@ -273,8 +295,8 @@ julia> @visualize Z;

julia> contraction_sequence(Z)
2-element Vector{Vector}:
Key{Tuple{Int64, Int64}}[Key((1, 1)), Key((1, 2))]
Any[Key((2, 1)), Any[Key((2, 2)), Key{Tuple{Int64, Int64}}[Key((3, 1)), Key((3, 2))]]]
NamedGraphs.Keys.Key{Tuple{Int64, Int64}}[Key((1, 1)), Key((1, 2))]
Any[Key((2, 1)), Any[Key((2, 2)), NamedGraphs.Keys.Key{Tuple{Int64, Int64}}[Key((3, 1)), Key((3, 2))]]]

julia>= contract(Z, (1, 1) => (2, 1));

Expand Down Expand Up @@ -308,11 +330,12 @@ julia> @visualize Z̃;
This file was generated with [weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
This file was generated with [Weave.jl](https://github.com/JunoLab/Weave.jl) with the following commands:
```julia
using ITensorNetworks, Weave
weave(
using ITensorNetworks: ITensorNetworks
using Weave: Weave
Weave.weave(
joinpath(pkgdir(ITensorNetworks), "examples", "README.jl");
doctype="github",
out_path=pkgdir(ITensorNetworks),
Expand Down
6 changes: 6 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
ITensorNetworks = "2919e153-833c-4bdc-8836-1ea460a35fc7"
ITensorUnicodePlots = "73163f41-4a9e-479f-8353-73bf94dbd758"
NamedGraphs = "678767b0-92e7-4007-89e4-4527a8725b19"
Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9"
Loading

0 comments on commit e4b5863

Please sign in to comment.