-
-
Notifications
You must be signed in to change notification settings - Fork 139
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
The required specific pattern for multivariate extrapolation does not allow | ||
a user to provide a choice of which layers to fold. If you would prefer to | ||
use a multivariate extrapolation method for unitary | ||
folding, use the functions available in `mitiq/lre` instead. |
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.
When this PR is close to being merged, replace mitiq/lre
with the seealso
directive from Sphinx.
https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-seealso
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2347 +/- ##
==========================================
+ Coverage 98.22% 98.25% +0.02%
==========================================
Files 87 89 +2
Lines 4056 4115 +59
==========================================
+ Hits 3984 4043 +59
Misses 72 72 ☔ View full report in Codecov by Sentry. |
degree: int, | ||
fold_multiplier: int, | ||
num_chunks: int = 1, | ||
) -> list[tuple[int]]: |
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.
To do: Understand this List comprehension has incompatible type List[Tuple[Any, ...]]; expected List[Tuple[int]]
https://realpython.com/python-type-checking/
https://mypy.readthedocs.io/en/stable/kinds_of_types.html#tuple-types
https://mypy.readthedocs.io/en/stable/builtin_types.html
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.
tuple[int]
is the type of a tuple with only one element. If you want the tuple to have an arbitrary number of integer elements, then you want to type it astuple[int, ...]
- The
Any
is because mypy can't infer that the tuple elements generated here are integer. It should go away after fix 1. - Instead of built-in types
list
andtuple
, it's recommended to useList
andTuple
from the typing module, i.e.,from typing import List, Tuple
and thenList[Tuple[int, ...]]
input_circuit: cirq.Circuit, | ||
degree: int, | ||
fold_multiplier: int, | ||
num_chunks: int = 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.
It would be better to use the default value as None
for the parameter num_chunks
. Making changes to this currently leads to the circuit getting chunked into 1 layer when I use the default value . Figure this out; make changes.
folding_method: Callable[ | ||
[QPROGRAM, float], QPROGRAM | ||
] = fold_gates_at_random, | ||
): |
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.
forgot the return type for this function. mypy
caught this as well.
mitiq/lre/multivariate_scaling/layerwise_folding.py:128: error: Function is missing a return type annotation [no-untyped-def]
Fixes #2307
Description
License
Before opening the PR, please ensure you have completed the following where appropriate.