Modify apply_unitary and unitary to take in numpy unitary matrix.#7419
Modify apply_unitary and unitary to take in numpy unitary matrix.#7419pavoljuhas merged 11 commits intoquantumlib:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
daxfohl
left a comment
There was a problem hiding this comment.
Nice, this cleans up a lot. Beyond the one code comment, I think has_unitary should also be modified to return True for plain arrays in this PR for consistency.
|
Also note there are utilities in the |
thanks! this is really helpful |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7419 +/- ##
==========================================
- Coverage 98.69% 98.68% -0.01%
==========================================
Files 1112 1112
Lines 97957 97965 +8
==========================================
Hits 96679 96679
- Misses 1278 1286 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
daxfohl
left a comment
There was a problem hiding this comment.
One small change in mixture_protocol_test if you don't mind, and two other comments I just left for awareness for the final reviewer.
daxfohl
left a comment
There was a problem hiding this comment.
lgtm if anyone from core wants to do a final review
|
@vtomole could you please take a look? Thanks! |
pavoljuhas
left a comment
There was a problem hiding this comment.
LGTM with one small suggestion. Thank you for fixing this!
…antumlib#7419) Addressing issue: quantumlib#7050 TESTED=Ran following tests for files affected. ``` check/pytest-changed-files check/pytest check/format-incremental --apply check/pylint-changed-files ```
…antumlib#7419) Addressing issue: quantumlib#7050 TESTED=Ran following tests for files affected. ``` check/pytest-changed-files check/pytest check/format-incremental --apply check/pylint-changed-files ```
The unitary_protocol returns `val._unitary_()` unchecked and thus does not guarantee the output of `cirq.unitary(val)` is unitary. Here we lift an extra check for `cirq.unitary(np_array)` so that `unitary(unitary(val))` does not fail if `unitary(val)` works. Resolves quantumlib#7572 Follow-up to quantumlib#7419
The unitary_protocol returns `val._unitary_()` unchecked and thus does not guarantee the output of `cirq.unitary(val)` is unitary. Here we lift an extra check for `cirq.unitary(np_array)` so that `unitary(unitary(val))` does not fail if `unitary(val)` works. Resolves quantumlib#7572 Follow-up to quantumlib#7419
Addressing issue: #7050
TESTED=Ran following tests for files affected.