Skip to content

Commit

Permalink
Remove most exports (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman authored Apr 3, 2024
1 parent 5284728 commit 2b592c0
Show file tree
Hide file tree
Showing 42 changed files with 502 additions and 371 deletions.
2 changes: 1 addition & 1 deletion 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.1"
version = "0.5"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ and 3 edge(s):
3 => 4

with vertex data:
4-element Dictionaries.Dictionary{Int64, Any}
4-element 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 @@ -104,7 +104,7 @@ and 4 edge(s):
(1, 2) => (2, 2)

with vertex data:
4-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
4-element Dictionary{Tuple{Int64, Int64}, Any}
(1, 1) │ ((dim=2|id=712|"1×1,2×1"), (dim=2|id=598|"1×1,1×2"))
(2, 1) │ ((dim=2|id=712|"1×1,2×1"), (dim=2|id=457|"2×1,2×2"))
(1, 2) │ ((dim=2|id=598|"1×1,1×2"), (dim=2|id=683|"1×2,2×2"))
Expand Down Expand Up @@ -134,7 +134,7 @@ and 1 edge(s):
(1, 1) => (1, 2)

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

Expand All @@ -148,7 +148,7 @@ and 1 edge(s):
(2, 1) => (2, 2)

with vertex data:
2-element Dictionaries.Dictionary{Tuple{Int64, Int64}, Any}
2-element Dictionary{Tuple{Int64, Int64}, Any}
(2, 1) │ ((dim=2|id=712|"1×1,2×1"), (dim=2|id=457|"2×1,2×2"))
(2, 2) │ ((dim=2|id=457|"2×1,2×2"), (dim=2|id=683|"1×2,2×2"))
```
Expand All @@ -164,7 +164,7 @@ julia> using ITensorNetworks: ⊗, contract, contraction_sequence
julia> using ITensorUnicodePlots: @visualize

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

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

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

julia> tn1 = ITensorNetwork(s; link_space=2)
ITensorNetwork{Int64} with 3 vertices:
Expand All @@ -195,7 +195,7 @@ and 2 edge(s):
2 => 3

with vertex data:
3-element Dictionaries.Dictionary{Int64, Any}
3-element Dictionary{Int64, Any}
1 │ ((dim=2|id=830|"S=1/2,Site,n=1"), (dim=2|id=186|"1,2"))
2 │ ((dim=2|id=369|"S=1/2,Site,n=2"), (dim=2|id=186|"1,2"), (dim=2|id=430|"2,3…
3 │ ((dim=2|id=558|"S=1/2,Site,n=3"), (dim=2|id=430|"2,3"))
Expand All @@ -212,7 +212,7 @@ and 2 edge(s):
2 => 3
with vertex data:
3-element Dictionaries.Dictionary{Int64, Any}
3-element Dictionary{Int64, Any}
1 │ ((dim=2|id=830|"S=1/2,Site,n=1"), (dim=2|id=994|"1,2"))
2 │ ((dim=2|id=369|"S=1/2,Site,n=2"), (dim=2|id=994|"1,2"), (dim=2|id=978|"2,3
3 │ ((dim=2|id=558|"S=1/2,Site,n=3"), (dim=2|id=978|"2,3"))
Expand Down Expand Up @@ -293,8 +293,8 @@ julia> @visualize Z;

julia> contraction_sequence(Z)
2-element Vector{Vector}:
NamedGraphs.Key{Tuple{Int64, Int64}}[Key((1, 1)), Key((1, 2))]
Any[Key((2, 1)), Any[Key((2, 2)), NamedGraphs.Key{Tuple{Int64, Int64}}[Key((3, 1)), Key((3, 2))]]]
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))]]]

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

Expand Down
2 changes: 2 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
DataGraphs = "b5a273c3-7e6c-41f6-98bd-8d7f1525a36a"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
ITensorNetworks = "2919e153-833c-4bdc-8836-1ea460a35fc7"
ITensorUnicodePlots = "73163f41-4a9e-479f-8353-73bf94dbd758"
Expand Down
3 changes: 2 additions & 1 deletion examples/boundary.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Graphs: vertices
using NamedGraphs
using ITensors
using ITensorNetworks
using ITensorNetworks: ITensorNetwork
using ITensorUnicodePlots
using Metis

Expand Down
2 changes: 1 addition & 1 deletion examples/contraction_sequence/contraction_sequence.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NamedGraphs
using ITensors
using ITensorNetworks
using ITensorNetworks: randomITensorNetwork
using Random

Random.seed!(1234)
Expand Down
11 changes: 7 additions & 4 deletions examples/dynamics/2d_ising_imag_tebd.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using ITensors
using ITensorNetworks
using Graphs: vertices
using ITensors: ITensors, inner
using ITensors.ITensorMPS: MPO, MPS
using ITensorNetworks: cartesian_to_linear, dmrg, expect, group_terms, ising, siteinds, tebd
using ITensorUnicodePlots
using UnicodePlots
using Random
using NamedGraphs: named_grid, rename_vertices
using UnicodePlots: heatmap
using Random: Random

Random.seed!(1234)

Expand Down
6 changes: 6 additions & 0 deletions examples/dynamics/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"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
7 changes: 3 additions & 4 deletions examples/examples.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using ITensors
using ITensorNetworks
using ITensorUnicodePlots
using NamedGraphs
using ITensorNetworks: IndsNetwork, itensors
using ITensorUnicodePlots: @visualize
using NamedGraphs: named_grid

χ, d = 5, 2
system_dims = (4, 4)
Expand Down
24 changes: 20 additions & 4 deletions examples/mincut.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
using NamedGraphs
using ITensors
using ITensorNetworks
using ITensorUnicodePlots
using Graphs:
adjacency_matrix,
bfs_tree,
center,
diameter,
eccentricity,
neighborhood_dists,
nv,
periphery,
radius
using NamedGraphs:
dijkstra_mst,
dijkstra_parents,
dijkstra_tree,
mincut_partitions,
named_grid,
symrcm_permute
using ITensors: dag
using ITensorNetworks: ITensorNetwork, , flatten_networks, siteinds
using ITensorUnicodePlots: @visualize

g = named_grid(5)
s = siteinds("S=1/2", g)
Expand Down
11 changes: 6 additions & 5 deletions examples/mps.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using AbstractTrees
using ITensors
using ITensorNetworks
using AbstractTrees: print_tree
using DataGraphs: edge_data, vertex_data
using ITensors: contract, dag, sim
using ITensorNetworks: IndsNetwork, ITensorNetwork, contraction_sequence, siteinds
using ITensorUnicodePlots
using Random
using NamedGraphs
using Random: Random, randn!
using NamedGraphs: named_path_graph, subgraph

Random.seed!(1234)

Expand Down
5 changes: 5 additions & 0 deletions examples/treetensornetworks/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[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"
2 changes: 1 addition & 1 deletion examples/treetensornetworks/comb_tree.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using NamedGraphs
using ITensors
using ITensorNetworks
using ITensorNetworks: TTN
using ITensorUnicodePlots

g = named_comb_tree((5, 2))
Expand Down
13 changes: 8 additions & 5 deletions examples/treetensornetworks/ttn_type.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using AbstractTrees
using NamedGraphs
using ITensors
using ITensorNetworks
using ITensorUnicodePlots
using Graphs: dst, edgetype, neighbors, src, vertices
using NamedGraphs: incident_edges, is_leaf, leaf_vertices, named_binary_tree
using ITensors: contract, dag, prime
using ITensorNetworks:
TTN, , contraction_sequence, inner, norm_sqr_network, orthogonalize, siteinds
using ITensorUnicodePlots: @visualize
using LinearAlgebra: norm, qr, svd
using Random: randn!

g = named_binary_tree(3)
s = siteinds("S=1/2", g)
Expand Down
119 changes: 1 addition & 118 deletions src/exports.jl
Original file line number Diff line number Diff line change
@@ -1,118 +1 @@
# Graphs
export grid,
dst,
edges,
src,
neighbors,
inneighbors,
induced_subgraph,
mincut,
ne,
nv,
outneighbors,
has_edge,
has_vertex,
bfs_tree,
dfs_tree,
edgetype,
is_directed,
is_tree,
rem_vertex!,
vertices,
post_order_dfs_vertices,
edge_path,
vertex_path

# NamedGraphs
export Key,
named_binary_tree,
named_grid,
parent_vertex,
child_vertices,
post_order_dfs_edges,
leaf_vertices,
is_leaf,
incident_edges, # TODO: Remove this export.
comb_tree,
named_comb_tree,
subgraph,
mincut_partitions

# DataGraphs
export DataGraph, vertex_data, edge_data, underlying_graph

# ITensorNetworks: indsnetwork.jl
export IndsNetwork, union_all_inds

# ITensorNetworks: itensornetwork.jl
export AbstractITensorNetwork,
ITensorNetwork,
,
itensors,
reverse_bfs_edges,
data_graph,
default_bp_cache,
flatten_networks,
inner_network,
norm_network,
factorize!,
norm_sqr_network,
linkinds_combiners,
combine_linkinds,
externalinds,
internalinds,
subgraphs,
reverse_bfs_edges,
randomITensorNetwork,
random_mps,
# treetensornetwork
default_root_vertex,
mpo,
mps,
ortho_center,
set_ortho_center,
BilinearFormNetwork,
QuadraticFormNetwork,
TreeTensorNetwork,
TTN,
random_ttn,
ProjTTN,
ProjTTNSum,
ProjOuterProdTTN,
set_nsite,
position,
# contraction_sequences.jl
contraction_sequence,
# utils.jl
cartesian_to_linear,
# namedgraphs.jl
rename_vertices,
# models.jl
heisenberg,
ising,
# opsum.jl
group_terms,
# tebd.jl
tebd,
# treetensornetwork/opsum_to_ttn.jl
mpo,
# treetensornetwork/solvers.jl
TimeDependentSum,
dmrg_x,
tdvp,
to_vec

# ITensorNetworks: mincut.jl
export path_graph_structure, binary_tree_structure

# ITensorNetworks: approx_itensornetwork.jl
export approx_itensornetwork

# ITensorNetworks: partition.jl
export partition, partition_vertices, subgraphs, subgraph_vertices

# ITensorNetworks: utility.jl
export relabel_sites

# KrylovKit
export eigsolve, linsolve
export ITensorNetwork
7 changes: 3 additions & 4 deletions src/mincut.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using Graphs: weights
using Graphs: dijkstra_shortest_paths
using NamedGraphs: NamedDiGraph
using GraphsFlows: GraphsFlows
using AbstractTrees: Leaves, PostOrderDFS
using Combinatorics: powerset
using Graphs: dijkstra_shortest_paths, weights
using GraphsFlows: GraphsFlows
using NamedGraphs: NamedDiGraph

# a large number to prevent this edge being a cut
MAX_WEIGHT = 1e32
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using Glob
using ITensorNetworks
@eval module $(gensym())
using Test: @test, @testset
using Glob: Glob
using ITensorNetworks: ITensorNetworks

# https://discourse.julialang.org/t/rdir-search-recursive-for-files-with-a-given-name-pattern/75605/12
@testset "ITensorNetworks.jl, test directory $root" for (root, dirs, files) in walkdir(
Expand All @@ -12,5 +13,4 @@ using ITensorNetworks
@time include(joinpath(root, test_file))
end
end

nothing
end
3 changes: 3 additions & 0 deletions test/test_abstractgraph.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@eval module $(gensym())
using NamedGraphs: add_edge!, add_vertex!, NamedDiGraph
using ITensorNetworks: _root, _is_rooted, _is_rooted_directed_binary_tree
using Test: @test, @testset

@testset "test rooted directed graphs" begin
g = NamedDiGraph([1, 2, 3])
Expand All @@ -13,3 +15,4 @@ using ITensorNetworks: _root, _is_rooted, _is_rooted_directed_binary_tree
add_edge!(g, 1, 4)
@test !_is_rooted_directed_binary_tree(g)
end
end
Loading

2 comments on commit 2b592c0

@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/104115

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.5.0 -m "<description of version>" 2b592c0ef37a315721c6b09e516e9e0a3a4ecb0e
git push origin v0.5.0

Please sign in to comment.