-
Notifications
You must be signed in to change notification settings - Fork 1
Circuit extraction from GraphState #46
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
base: mf
Are you sure you want to change the base?
Conversation
Reason: Sync with latest updates from mf
|
I changed the base branch from |
| depth: int, | ||
| rng: np.random.Generator | None = None, | ||
| edge_p: float = 0.5, | ||
| angle_list: list | None = None, |
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 use an appropriate collections.abc stuff rather than list .
| depth: int, | ||
| rng: np.random.Generator | None = None, | ||
| edge_p: float = 0.5, | ||
| angle_list: list | None = None, |
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.
_list is unnecessary because it's obvious that it should be list from the annotation.
| generated MBQC circuit | ||
| """ | ||
| if rng is None: | ||
| rng = np.random.default_rng() |
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.
MEMO: it's better to cache rng as in graphix, because PRNG is designed to reduce correlations between samples drawn from the same generator instance.
| self.pivot(*pair) | ||
| del pair | ||
| continue | ||
| if u := self._extract_xz_node(): |
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.
is None is preferable because 0 is also falthy.
| assert _is_close_angle(result_basis.angle, ref_angle) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("plane", [Plane.XY, Plane.YZ, Plane.XZ]) |
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.
You can directly iterate Plane as list(Plane) .
| dict[int, int] | ||
| inner index to node index mapping. | ||
| """ | ||
| return self.__inner2nodes |
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.
Is it OK to expose internal states?
| n, m = M.shape | ||
| row_ops: List[Tuple[int,int]] = [] | ||
| pivot_row = 0 | ||
| for col in range(m): |
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.
Too complex.
| _process_frontier(d, frontier, circ) | ||
|
|
||
|
|
||
| def _gauss_elim(M: np.ndarray) -> Tuple[np.ndarray, List[Tuple[int,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.
Please respect PEP8.
| @@ -0,0 +1,161 @@ | |||
| from typing import Set, List, Tuple | |||
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.
Deprecated.
| def test_prune_non_cliffords( | ||
| zx_graph: ZXGraphState, | ||
| initial_zxgraph: tuple[range, set[tuple[int, int]]], | ||
| measurements: list[tuple[int, Plane, float]], |
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.
ABC please.
Before submitting, please check the following:
pytest)ruffmypyandpyrightmake htmlin./docs/- you may need to install dependency for sphinx docs, seedocs/requirements.txt.)Then, please fill in below:
Context (if applicable):
Implement circuit extraction algorithm in Backens et al (2021)
Description of the change:
Related issue:
#32