-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Move GateTabulation and friends to cirq-core as requested in #4461 #4602
Conversation
Yes, looking at finishing that right now.
|
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation.py
Outdated
Show resolved
Hide resolved
cirq-google/cirq_google/optimizers/convert_to_sycamore_gates.py
Outdated
Show resolved
Hide resolved
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.
Looking good. Left a final round of comments and we should be ready to merge after this. Thanks for the iterations!
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation.py
Outdated
Show resolved
Hide resolved
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation.py
Outdated
Show resolved
Hide resolved
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation.py
Outdated
Show resolved
Hide resolved
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation.py
Outdated
Show resolved
Hide resolved
cirq-google/cirq_google/optimizers/two_qubit_gates/gate_compilation_test.py
Outdated
Show resolved
Hide resolved
cirq-core/cirq/transformers/heuristic_decompositions/__init__.py
Outdated
Show resolved
Hide resolved
@@ -0,0 +1 @@ | |||
cirq.TwoQubitGateTabulation(np.array([[(1+0j), 0j, 0j, 0j], [0j, (6.123233995736766e-17+0j), -1j, 0j], [0j, -1j, (6.123233995736766e-17+0j), 0j], [0j, 0j, 0j, (0.8660254037844387-0.49999999999999994j)]], dtype=np.complex128), np.array([[0.7853981633974483, 0.7853981633974483, 0.1308996938995748], [0.5455546451806152, 0.4274250500660468, 1.1102230246251565e-16], [0.482263980185593, 0.15541244226118112, -0.0], [0.08994436657892213, 0.0688663429298958, -0.0], [0.5337019863142523, 0.31800967733278185, -0.2565859360625904], [0.48438278888761155, 0.39121774851710633, 0.28728266960007875]], dtype=np.float64), [[],[(np.array([[(-0.8113361037323902+0.388228151720065j), (0.38855300559639544-0.20009795309891054j)], [(-0.38855300559639544-0.20009795309891054j), (-0.8113361037323902-0.388228151720065j)]], dtype=np.complex128), np.array([[(-0.15500592487333173-0.5209557609876208j), (-0.6259723589563565+0.5592288119996914j)], [(0.6259723589563565+0.5592288119996914j), (-0.15500592487333173+0.5209557609876208j)]], dtype=np.complex128))],[(np.array([[(-0.7591335658137299-0.5262321684934362j), (0.37132129473675946+0.09442685090928131j)], [(-0.37132129473675946+0.09442685090928131j), (-0.7591335658137299+0.5262321684934362j)]], dtype=np.complex128), np.array([[(0.004722472920167423+0.9809944588837683j), (0.18002103957975657+0.07224953423714474j)], [(-0.18002103957975657+0.07224953423714474j), (0.004722472920167423-0.9809944588837683j)]], dtype=np.complex128))],[(np.array([[(-0.0897362442086916+0.02445105905520244j), (-0.8503296766825128-0.5179662084918382j)], [(0.8503296766825128-0.5179662084918382j), (-0.0897362442086916-0.02445105905520244j)]], dtype=np.complex128), np.array([[(0.7441127742234152+0.6642425418602642j), (0.009545063892332065+0.07061810374004159j)], [(-0.009545063892332065+0.07061810374004159j), (0.7441127742234152-0.6642425418602642j)]], dtype=np.complex128))],[(np.array([[(-0.8113361037323902+0.388228151720065j), (0.38855300559639544-0.20009795309891054j)], [(-0.38855300559639544-0.20009795309891054j), (-0.8113361037323902-0.388228151720065j)]], dtype=np.complex128), np.array([[(-0.15500592487333173-0.5209557609876208j), (-0.6259723589563565+0.5592288119996914j)], [(0.6259723589563565+0.5592288119996914j), (-0.15500592487333173+0.5209557609876208j)]], dtype=np.complex128)),(np.array([[(-0.8113361037323902+0.388228151720065j), (0.38855300559639544-0.20009795309891054j)], [(-0.38855300559639544-0.20009795309891054j), (-0.8113361037323902-0.388228151720065j)]], dtype=np.complex128), np.array([[(-0.15500592487333173-0.5209557609876208j), (-0.6259723589563565+0.5592288119996914j)], [(0.6259723589563565+0.5592288119996914j), (-0.15500592487333173+0.5209557609876208j)]], dtype=np.complex128))],[(np.array([[(0.41295648139511504-0.17280776715854063j), (0.5430881450957462-0.7103940362502399j)], [(-0.5430881450957462-0.7103940362502399j), (0.41295648139511504+0.17280776715854063j)]], dtype=np.complex128), np.array([[(0.19013479709876246+0.4941656851052965j), (-0.6469746262664201+0.5487010730480224j)], [(0.6469746262664201+0.5487010730480224j), (0.19013479709876246-0.4941656851052965j)]], dtype=np.complex128)),(np.array([[(0.41295648139511504-0.17280776715854063j), (0.5430881450957462-0.7103940362502399j)], [(-0.5430881450957462-0.7103940362502399j), (0.41295648139511504+0.17280776715854063j)]], dtype=np.complex128), np.array([[(0.19013479709876246+0.4941656851052965j), (-0.6469746262664201+0.5487010730480224j)], [(0.6469746262664201+0.5487010730480224j), (0.19013479709876246-0.4941656851052965j)]], dtype=np.complex128))]], 0.49, 'Fraction of Weyl chamber reached with 2 gates: 0.600\nFraction of Weyl chamber reached with 2 gates and 3 gates(same single qubit): 1.000', ()) |
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.
Why are the _inward
files needed here? IIUC, Both TwoQubitGateTabulation.repr_inward
and TwoQubitGateTabulation.json_inward
are not needed here right now and should be removed.
The _inward
files would need to be added to cirq-google
when we remove the deprecated classes after the deprecation cycle is over so that we can continue to support deserialization of the old GateTabulation
type into the newly introduced TwoQubitGateTabulation
type.
See https://quantumai.google/cirq/dev/serialization#removing_a_serializable_value for more details.
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 see, removed the files from the new directory. For some reason, the cirq-google/cirq_google/json_test_data contains identical .repr / .json and .repr_inward / .json_inward for this and many other classes, which is quite confusing. Should it be cleaned up?
…tests for GateTabulation, they might not be handling deprecation correctly; remove extra import
) | ||
|
||
|
||
# pylint: enable=missing-raises-doc |
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.
Now that we have the copyright in place, this line is not needed. Please delete.
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.
Done.
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.
LGTM % two final nits. Please fix the nits and we'll merge.
Thanks a lot for all the iterations! The final outcome looks great :)
@Ashalynd Please fix the lint checks |
done |
…ib#4461 (quantumlib#4602) - Adds `cirq. TwoQubitGateTabulation`, `cirq.TwoQubitGateTabulationResult`, and `cirq.two_qubit_gate_product_tabulation` public top level objects to Cirq. - TwoQubitGateTabulation is heuristic compilation technique for decomposing any 2q unitary to a given target 2q gate + single qubit rotations.
…ib#4461 (quantumlib#4602) - Adds `cirq. TwoQubitGateTabulation`, `cirq.TwoQubitGateTabulationResult`, and `cirq.two_qubit_gate_product_tabulation` public top level objects to Cirq. - TwoQubitGateTabulation is heuristic compilation technique for decomposing any 2q unitary to a given target 2q gate + single qubit rotations.
…ib#4461 (quantumlib#4602) - Adds `cirq. TwoQubitGateTabulation`, `cirq.TwoQubitGateTabulationResult`, and `cirq.two_qubit_gate_product_tabulation` public top level objects to Cirq. - TwoQubitGateTabulation is heuristic compilation technique for decomposing any 2q unitary to a given target 2q gate + single qubit rotations.
Fixes #4461