-
Notifications
You must be signed in to change notification settings - Fork 1
Non-Clifford Removal #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
74 commits
Select commit
Hold shift + click to select a range
abb9fa4
:white_check_mark: Add tests for convert_to_phase_gadget
5ef6d90
:sparkles: Add convert_to_phase_gadget to ZXGraphState
ecd81a0
:art: Add diagramatic representation for each tests in convert_to_pha…
d15f954
:white_check_mark: Add tests for merge_yz_to_xy
912cc8a
:art: Add merge_yz_to_xy
eb6f70e
:art: Improve tests' readability
260577a
:white_check_mark: Add tests for merge_yz_nodes
0777029
:art: Add merge_yz_nodes
735b32d
:recycle: Refactor test codes
85a79bb
:white_check_mark: Add tests for prune_non_clifford
d8d07e6
:sparkles: Add prune_non_clifford to ZXGraphState
31fc41d
:art: Apply ruff check
6d196b5
:pencil2: Fix typo
7e7a73d
:bug: Fix merge_yz_to_xy & merge_yz_nodes
fdf0aa4
:sparkles: Add get_random_gflow_circ
9a7c3a7
:sparkles: Add an example for Clifford/non-Clifford removal
60593b5
Merge branch 'mf' into non-Clifford-removal
d8520fe
:bug: Fix _angle_check
eab5787
:bug: Fix test_local_complement in test_euler.py
0c25e60
:bug: Fix update rule
39cb744
:bug: Add property method
6cb9263
:art: Apply ruff
0e7357a
:white_check_mark: Add pivot tests for euler.py
c638d4f
Merge branch 'mf' into non-Clifford-removal
6e29aa4
:sparkles: Add measurement_actions in test_zxgraphstate
4dc91c6
:sparkles: Add plane_combinations in test_zxgraphstate
d806447
:sparkles: Add rng in test_zxgraphstate
16e2c10
:sparkles: Add doc in plane_combinations
3e41c7e
:art: Change typehints
790fc5a
:bug: Fix bug in _test
abf22bd
:art: Fix test_local_complement_with_no_edge
03b514c
:art: Fix test_local_complement_on_output_node
0ab74be
:art: Fix test_local_complement_with_two_nodes_graph
215adbd
:art: Fix test_local_complement_with_minimal_graph
f9e41c3
:art: Fix test_local_complement_4_times
8161140
:construction: Migrate local_complement & pivot into new version
fe1bd6d
:art: Fix lc & import
f826a84
:fire: Remove old local_complement, pivot, remove_clifford
7d5a8d9
:art: Fix typehints in test
45dfbc8
:recycle: Refactor test_zxgraphstate
44131ec
:fire: Delete unneccesary tests
9abe2cd
:art: Fix measurement action readability
81001bc
:art: Rename get_random_gflow_circ into random_circ
1e8870d
:art: Fix typehints for random_circ
b7b0a8c
:fire: Remove unnecessary del sentences
27e56f9
:art: Rename prune_non_cliffords method into full_reduce
cf8892b
:art: Format docstring
d0cfd88
:recycle: Merge if block into while block
e67f8a0
:recycle: Refactor check conditions
50af11d
:art: Migrate from get_random_gflow_circ to random_circ
e4c0e0e
:memo: Fix docstrings
8802575
:bug: Fix typehint in random_objects
7df1c8f
:art: Fix typehints
30bcf55
:art: Rewrite angle condition with _is_close_angle
3b29d82
:art: Improve readability
3d277ef
:white_check_mark: Add corner case for test_remove_clifford
aafe3fb
:art: Apply ruff
22861f0
:recycle: Refactor test_zxgraphstate
faaba1a
:zap: Improve performance for merge_yz_nodes
af2aba8
:memo: Fix docstrings
611f142
:art: Integrate the term 'vertex' into 'node'
a0baef7
:fire: Remove _update_new_measurement method
4fb8a61
:art: Simplify
69e12f4
:art: Apply ruff
63a6526
:art: Improve docstrings and variable name
1655757
:bug: Fix bug in _remove_clifford
ddd4c6f
:recycle: Refactor merge_yz_nodes
3576a63
:recycle: Refactor _extract_yz_adjacent_pair
6bf9946
:fire: Delete an uneccesary line
dc7375b
:recycle: Refactor ZXGraphState
0927f1c
:recycle: Refactor ZXGraphState
7421cbd
:bug: Fix bug in merge_yz_to_xy
b3cb2c7
:bug: Fix bug when referencing _clifford_rules
b02df26
:truck: Rename
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| """Basic example of simplifying a ZX-diagram. | ||
|
|
||
| By using the `full_reduce` method, | ||
| we can remove all the internal Clifford nodes and some non-Clifford nodes from the graph state, | ||
| which generates a simpler ZX-diagram. | ||
| This example is a simple demonstration of the simplification process. | ||
| """ | ||
|
|
||
| # %% | ||
| from copy import deepcopy | ||
|
|
||
| import numpy as np | ||
|
|
||
| from graphix_zx.circuit import circuit2graph | ||
| from graphix_zx.random_objects import random_circ | ||
| from graphix_zx.visualizer import visualize | ||
| from graphix_zx.zxgraphstate import ZXGraphState | ||
|
|
||
| # %% | ||
| circ = random_circ(4, 4) | ||
| graph, flow = circuit2graph(circ) | ||
| zx_graph = ZXGraphState() | ||
| zx_graph.append(graph) | ||
|
|
||
| visualize(zx_graph) | ||
| print("node | plane | angle (/pi)") | ||
| for node in zx_graph.input_nodes: | ||
| print(f"{node} (input)", zx_graph.meas_bases[node].plane, zx_graph.meas_bases[node].angle / np.pi) | ||
| for node in zx_graph.physical_nodes - zx_graph.input_nodes - zx_graph.output_nodes: | ||
| print(node, zx_graph.meas_bases[node].plane, zx_graph.meas_bases[node].angle / np.pi) | ||
|
|
||
| # %% | ||
| zx_graph_smp = deepcopy(zx_graph) | ||
| zx_graph_smp.full_reduce() | ||
|
|
||
| visualize(zx_graph_smp) | ||
| print("node | plane | angle (/pi)") | ||
| for node in zx_graph.input_nodes: | ||
| print(f"{node} (input)", zx_graph.meas_bases[node].plane, zx_graph.meas_bases[node].angle / np.pi) | ||
| for node in zx_graph_smp.physical_nodes - zx_graph.input_nodes - zx_graph_smp.output_nodes: | ||
| print(node, zx_graph_smp.meas_bases[node].plane, zx_graph_smp.meas_bases[node].angle / np.pi) | ||
|
|
||
| # %% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.