-
Notifications
You must be signed in to change notification settings - Fork 12
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
AerUnitaryBackend: call transpile before run (#142) #167
Conversation
72ce941
to
4cdd47f
Compare
3a05202
to
1d1825c
Compare
e285460
to
fb02825
Compare
tests/backend_test.py
Outdated
|
||
compiled_circ = backend.get_compiled_circuit(circ, optimisation_level=0) | ||
# using optimisation_level >= 1 does not raise an error | ||
backend.run_circuit(compiled_circ) |
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.
Would be nice to have some sort of assertion in the test to check we got the expected result.
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 agree, do you have a suggestion? Otherwise I'll comment that we are testing that run_circuit doesn't throw
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.
Something like:
r = backend.run_circuit(compiled_circ)
u = r.get_unitary()
assert np.isclose(u[62:64, 62:64], np.asarray([[0., 1.].[1., 0.]]))
I think (may have got the syntax wrong, please check). I.e. check that the lower-right 2x2 submatrix of the unitary is the matrix of the X gate.
tests/qiskit_backend_test.py
Outdated
@@ -107,15 +106,6 @@ def test_unitary() -> None: | |||
assert np.allclose(u, u2) | |||
|
|||
|
|||
def test_cancel() -> 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.
Why was this test deleted?
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.
Awkward. Bad merge, although I don't understand how. Will revert.
a5f092b
to
b2c7adb
Compare
b2c7adb
to
4fb4f0a
Compare
Fixes #142