-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Noise Scaling for LRE #2347
base: main
Are you sure you want to change the base?
Noise Scaling for LRE #2347
Conversation
c40d58d
to
63297af
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2347 +/- ##
==========================================
+ Coverage 98.22% 98.34% +0.11%
==========================================
Files 87 89 +2
Lines 4056 4099 +43
==========================================
+ Hits 3984 4031 +47
+ Misses 72 68 -4 ☔ View full report in Codecov by Sentry. |
ValueError: | ||
When the degree for the multinomial is not >= to 1. | ||
ValueError: | ||
When the fold multiplier to scale the circuit is not >= to 1. | ||
ValueError: | ||
When the number of chunks for a large circuit is 0. | ||
ValueError: | ||
When the number of chunks in a circuit is greater than the number | ||
of layers in the input circuit. |
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.
All of these ValueError
messages could be listed as a bullet list. Attempts to do so resulted in build errors.
|
||
Raises: | ||
UnfoldableCircuitError: | ||
* If the circuit has intermediate measurements. |
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.
Does it make sense to put the Raises
content here? My impression is that these comments should be local to the function in which they are originally being raised from (in this case, _check_foldable
.
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'll search around for what the usual convention for this is.
Anyway, I need to figure out how to raise errors for a public function when private functions also raise other errors. #2347 (comment)
|
||
def _get_chunks( | ||
input_circuit: Circuit, num_chunks: Optional[int] = None | ||
) -> List[Circuit]: |
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.
Side note: Are we still supporting versions of Python that wouldn't allow -> list[Circuit]
vs. List[Circuit]
?
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 is a good question. Which versions of python did you have in mind? I know there's an open issue to drop 3.9 once we add support for 3.12.
The validate workflow only runs for python 3.11 which is used for type checking by mypy.
mitiq/.github/workflows/build.yml
Lines 25 to 32 in 837ea83
python-version: "3.11" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
make install requirements | |
- name: Check types with mypy | |
run: make check-types |
From what I could find, 3.9 uses list[Circuit]
as a type alias and List[Circuit]
for type annotations. Same with 3.10.
|
||
""" | ||
if degree < 1: | ||
raise ValueError("Multinomial degree not >= to 1.") |
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 would word these conditions in a way that makes parsing the error a bit easier for the user. For instance:
raise ValueError("Multinomial degree must be greater than 1.")
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.
We do want to allow degree = 1
as well.
Fixes #2307
Description
License
Before opening the PR, please ensure you have completed the following where appropriate.