-
Notifications
You must be signed in to change notification settings - Fork 13
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
[WIP] Introduce partitioned_contract
#97
base: main
Are you sure you want to change the base?
Conversation
…tion_sequence_to_graph
…t being a vector of inds
…ed_minswap_inds_ordering
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #97 +/- ##
===========================================
- Coverage 79.64% 68.75% -10.89%
===========================================
Files 64 69 +5
Lines 3507 4276 +769
===========================================
+ Hits 2793 2940 +147
- Misses 714 1336 +622
|
@@ -335,6 +328,97 @@ function _rem_vertex!( | |||
return U | |||
end | |||
|
|||
function _update_cache_w_low_rank_projector!( | |||
::Algorithm"direct_eigen", | |||
alg_graph::_DensityMartrixAlgGraph, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed this should be _DensityMatrixAlgGraph
, not _DensityMartrixAlgGraph
. Also I think it's best to remove the underscore.
@@ -22,6 +22,8 @@ function approx_itensornetwork( | |||
partition_wo_deltas = _contract_deltas_ignore_leaf_partitions( | |||
binary_tree_partition; root=root | |||
) | |||
density_matrix_alg = | |||
alg isa Algorithm"density_matrix_direct_eigen" ? "direct_eigen" : "qr_svd" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like the main use for Algorithm"density_matrix_direct_eigen"
is this selection of the density_matrix_alg
. Maybe simpler to just make density_matrix_alg
a keyword argument directly and remove Algorithm"density_matrix_direct_eigen"
.
@@ -5,7 +5,7 @@ with the same binary tree structure. `root` is the root vertex of the | |||
pre-order depth-first-search traversal used to perform the truncations. | |||
""" | |||
function approx_itensornetwork( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget why this was called approx_itensornetwork
. Can this just be contract
? It seems like it is just called from contract
anyway.
kwargs..., | ||
) | ||
sequence = _partitioned_contraction_sequence( | ||
tn; nvertices_per_partition=nvertices_per_partition, backend=backend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tn; nvertices_per_partition=nvertices_per_partition, backend=backend | |
tn; nvertices_per_partition, backend |
In the more recent versions of Julia, you don't have to repeat the argument if it has the same name as the keyword in a keyword argument.
Sorry for the very long delay in reviewing this, finally finding some time to take a look. In terms of the API, instead of the function contract(
alg::Algorithm"partitioned_contract",
tn::AbstractITensorNetwork;
sequence,
backend::String="KaHyPar",
kwargs...,
)
[[[1, 2, 3], [4, 5, 6]], [7, 8, 9, 10]] This would complement the version that accepts |
This PR is mainly used for discussion. We need to break it into pieces to merge.
APIs:
Given a partition
par
and its partial contraction treecontraction_tree
, the function below performs the approximate contraction based on given parameters:ansatz
: can bemps
orcomb
approx_itensornetwork_alg
: can bedensity_matrix
orttn_svd
linear_ordering_alg
: can betop_down
orbottom_up
. This denotes the heuristic used to choose the MPS site ordering.Instead of passing a partition and a contraction tree, one can also passing a
contraction_sequence
, which is a nested vector of ITensors.par
andcontraction_tree
will then be produced internally.One can also choose to let the package generate the partition and the contraction tree automatically. Given
tn
, the function below will generate apar
andcontraction_tree
based on the recursive bisection algorithm, with each partition having approximatelynvertices_per_partition
number of vertices.Organization of the PR
examples/partitioned_contract
contains codes to benchmark the algorithm. The implementations contain experiments on top of 3D grids, random regular graphs, and random quantum circuits.src/contract.jl
includes the new API forcontract
.src/mincut.jl
includes a new algorithm/heuristic for generating the binary tree structure and path graph structure. In particular, the existing algorithm is a bottom-up greedy algorithm, and another greedy top-down algorithm based on recursive bisection is added. The top-down algorithm is standard since recursive bisection is a common algorithm. For now it is unclear which one is better.src/partitioned_contract/partitioned_contract.jl
includes the implementations ofpartitioned_contract