On finding a good ordering of sites in an MPS #92
-
Hi guys! I recently saw a pull request extending TreeSA to support path decomposition finding and got curious about the comment on using this to find a good ordering of the sites in an MPS. Is there some documentation or example on how to use the algo for this purpose? I’m trying to find a good reordering of the legs on an MPS (the local dimensions are not uniform) and was wondering on what to use for that. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Here is a sample code to obtaining a "good" MPS ordering. We first generate a sample tensor network with 3-regular graph topology, which has one tensor in each edge, and each tensor has rank 2 (this is for demonstration purpose, OMEinsumContractionOrders has not such constraint). julia> using OMEinsumContractionOrders, Graphs
julia> rg3 = Graphs.random_regular_graph(100, 3; seed=42); # graph topology
julia> code = OMEinsumContractionOrders.EinCode([[e.src, e.dst] for e in edges(rg3)], Int[]); # one tensor for each edge Then we optimize the path decomposition for the sample tensor network: julia> optcode = optimize_code(code, uniformsize(code, 2), PathSA());
julia> contraction_complexity(optcode, uniformsize(code, 2)) # check pathwidth
Time complexity: 2^19.29432458408747
Space complexity: 2^14.0 <---- this one
Read-write complexity: 2^19.67212316041469 The path decomposition can be characterized by the elimination ordering or vertices, which is when a vertex is removed from the graph. It can be viewed as the site ordering of MPS I think.
Here, "good" means low path width, which is a graph characteristic that measures how similar a graph is to a line. |
Beta Was this translation helpful? Give feedback.
Here is a sample code to obtaining a "good" MPS ordering. We first generate a sample tensor network with 3-regular graph topology, which has one tensor in each edge, and each tensor has rank 2 (this is for demonstration purpose, OMEinsumContractionOrders has not such constraint).
Then we optimize the path decomposition for the sample tensor network: