Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better functionality for partitioned tensor networks/graphs #87

Closed
mtfishman opened this issue Apr 14, 2023 · 2 comments
Closed

Better functionality for partitioned tensor networks/graphs #87

mtfishman opened this issue Apr 14, 2023 · 2 comments

Comments

@mtfishman
Copy link
Member

For example, something we want to do is be able to flatten a doubly-partitioned tensor network into a singly-partitioned tensor network:

julia> tn = randomITensorNetwork(named_grid((4, 4)); link_space=2);

julia> tnp = partition(tn; npartitions=2);

julia> tnpp = partition(tnp; npartitions=2);

julia> tnp2 = DataGraph(underlying_graph(tnpp), map(tnp -> reduce(, vertex_data(tnp)), vertex_data(tnpp)));

julia> tnp2[1] == tnp[1]
true

julia> tnp2[2] == tnp[2]
true

It would be nice to define a function that flattens a partitioned ITensorNetwork:

ITensorNetwork(partitioned_tn::DataFraph{<:Any,ITensorNetwork}) = reduce(, vertex_data(partitioned_tn))

and then make sure map_vertex_data works for this case (which currently errors if the vertex data type changes), so we can do:

map_vertex_data(ITensorNetwork, tnpp) 

Other ideas would be to define a PartitionedITensorNetwork so we can dispatch on that type:

const PartitionedITensorNetwork{V} = DataGraph{V,<:ITensorNetwork}

and distinguish between singly-partitioned vs. more nested partitionings. Having a function that flattens nested partitioned network into a single ITensorNetwork would be helpful as well.

A related function we have for dealing with nested partitioned tensor networks is nested_graph_leaf_vertices, which works like this:

vertex_groups = nested_graph_leaf_vertices(tnpp)

for finding groups of vertices but maybe the API should be rethought since it's a confusing name.

@mtfishman
Copy link
Member Author

Another idea would be to add a way to call partition and specify that you want to make sure that certain vertices are grouped together. An interface could be:

julia> tn = randomITensorNetwork(named_grid((4, 4)); link_space=2);

julia> tnp = partition(tn; npartitions=2, group_vertices=[[(1, 1), (2, 1)], [(3, 4), (4, 4)]]);

to make sure that vertices (1, 1), (2, 1) are grouped together and [(3, 4), (4, 4)] are grouped together. This could be implemented by first partitioning the graph according to the grouping (treating unspecified vertices as groups of 1), partitioning that partitioned graph, and then regrouping based on the functionality in the first post of this issue.

@mtfishman
Copy link
Member Author

Closed by #126.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant