-
Notifications
You must be signed in to change notification settings - Fork 349
Adhoc now supports n>3, and new arguments #902
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
Conversation
Co-Authored-By: rogue-infinity <[email protected]>
@edoaltamura I hope we can continue the discussion/review here. We had some version conflicts in the way we were collaborating and got a lot of messy commits on the previous Pull Request. So I've closed it and started a fresh one here. I've updated the summary above according to the latest changes too |
The failed test is unrelated to the files I've edited and it's failing only on the MacOS 3.12, so I'm not sure how to proceed |
If I look at the nightly Actions here, where CI is run daily, I see what seem to be random failures and that includes an example of the unit test that failed here. I imagine if this was re-run it could pass - for instance last nights CI run passed ok. I re-started that failed job. lets see. (Update: I see it now passed ok) @edoaltamura I guess it would be good to look at these random failures to see if it can be figured why and hopefully update them. I created an issue around this as a reminder. |
Pull Request Test Coverage Report for Build 13952014968Details
💛 - Coveralls |
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.
Great work @RishiNandha! I've made a few (very small) suggestions. To avoid the syncing trouble you experienced when in-PR commits are merged, make sure you git-pull your local repo before working on it so that incoming changes are merged with your local copy of the code.
The main change needed is in the syntax of the docstring in the ad hoc main function - it should use Args:
like in the rest of the code so that the documentation builder can understand it and translate it to static HTML pages.
Re-running the MacOS job, which seems affected by #903. |
Summary
My previous pull request became messy due to bad version control from my side. So I've created a new one
This is related to #330
I have rewritten the ad_hoc dataset to work for n>3. I have also made some of the operations more efficient.
I'm also working on bringing more dataset generators to the repository, so I hope ad_hoc.py can still be kept around as the simpler one in the family now that it's been rewritten
Details and comments
The tensor products such as H^{(x)n} were written in n step loops, I've made them logn step loops. And similar other small optimizations such as precomputing Zi*Zj. This step also supports 3 types of entangelement now: linear/circular/full
The old implementation did an n-dimensional grid for generating random phase vectors. While this brought uniformity with small number of qubits, it was too much computational overhead for larger numbers. I've have added 2 more options of stratified sampling. The old method has been retained as the "grid" method as suggested so that old user codes don't behave differently now. The two other methods included are "hypercube" and "sobol". Docstring has been updated and can be referred to for more information on the methods
The old implementation had labelling done with parity() and majority() in n=2 and n=3 respectively. I've used an n-qubit Z matrix directly, which aligns better with the reference paper attached in the documentation and also relieves the constraint an n being 2 or 3.
Vectorized the labelling loop. This has given some performance gain. I have also given two options: the same "expectation" based labelling has been retained but also a "measurement" based labelling has been added
I've verified lint. @rogue-infinity has developed unittests for this revamped ad hoc dataset. They have been verified to pass