-
Notifications
You must be signed in to change notification settings - Fork 21
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
Enable efficient contraction order simulation #166
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #166 +/- ##
==========================================
+ Coverage 75.52% 75.89% +0.37%
==========================================
Files 34 34
Lines 5569 5638 +69
==========================================
+ Hits 4206 4279 +73
+ Misses 1363 1359 -4 ☔ View full report in Codecov by Sentry. |
op = op.reshape( | ||
[ | ||
2, | ||
] | ||
* (2 * op_dim) | ||
) |
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.
use black -l 120
?
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.
Yes. If I left this like op = op.reshape([2,] * (2 * op_dim)
, cannot pass the check for black.
graphix/sim/tensornet.py
Outdated
|
||
Parameters | ||
---------- | ||
indices (optional): list of int | ||
target qubit indices. Default is the MBQC output nodes (self.default_output_nodes). | ||
skip : bool |
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.
argument name skip
is way too generic and very difficult to understand. Consider making it skip_tn_simp
or restructure. Also, why/who/when do we want to skip the simplification?
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.
This option is not that essential, so I removed skip
.
graphix/sim/tensornet.py
Outdated
def to_statevector(self, indices=None, **kwagrs): | ||
"""Retrieve the statevector from the tensornetwork. | ||
This method tends to be slow however we plan to parallelize this. | ||
def to_statevector(self, skip=False, **kwagrs) -> NDArray: |
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.
Please add very detailed description (100+ words, with equations and diagrams) to this method as this is rather uncommon way to use TN (for most people, at least afaik).
Is this proven to work for any case or are there limitations? worth pointing out we're NOT performing the intermediate measurements according to probability distribution? what is the expected space/time cost compared to statevector sim?
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 added that based on notes and discussion in #92 .
@nabe98 can you paste benchmarking result (plot) on this page? |
OK. |
@shinich1 |
Before submitting, please check the following:
tox
)black
andisort
pyproject.toml
for configurationsThen, please fill in below:
Context (if applicable):
Description of the change:
Enabled TN contraction based state vector simulator, which is more efficient compared with pure state-vector simulation.
Related issue:
#92
also see that checks (github actions) pass.
If lint check keeps failing, try installing black==22.8.0 as behavior seems to vary across versions.