Skip to content
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

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

doug-q
Copy link
Contributor

@doug-q doug-q commented Aug 29, 2023

Fixes #142

@doug-q doug-q requested a review from cqc-melf as a code owner August 29, 2023 07:44
@doug-q doug-q force-pushed the feature/TKT-3333-transpile-aer branch from 72ce941 to 4cdd47f Compare August 29, 2023 07:47
@doug-q doug-q changed the title TKET-3333: AerUnitaryBackend: call transpile before run AerUnitaryBackend: call transpile before run (#167) Aug 29, 2023
@doug-q doug-q changed the title AerUnitaryBackend: call transpile before run (#167) AerUnitaryBackend: call transpile before run (#142) Aug 29, 2023
@doug-q doug-q force-pushed the feature/TKT-3333-transpile-aer branch 2 times, most recently from 3a05202 to 1d1825c Compare August 31, 2023 08:41
@doug-q doug-q requested a review from cqc-alec September 6, 2023 08:16
@doug-q doug-q force-pushed the feature/TKT-3333-transpile-aer branch 2 times, most recently from e285460 to fb02825 Compare September 6, 2023 09:30

compiled_circ = backend.get_compiled_circuit(circ, optimisation_level=0)
# using optimisation_level >= 1 does not raise an error
backend.run_circuit(compiled_circ)
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

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.

@@ -107,15 +106,6 @@ def test_unitary() -> None:
assert np.allclose(u, u2)


def test_cancel() -> None:
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@doug-q doug-q force-pushed the feature/TKT-3333-transpile-aer branch 3 times, most recently from a5f092b to b2c7adb Compare September 7, 2023 09:06
@doug-q doug-q force-pushed the feature/TKT-3333-transpile-aer branch from b2c7adb to 4fb4f0a Compare September 7, 2023 09:06
@cqc-melf cqc-melf removed their request for review September 11, 2023 10:08
@doug-q doug-q requested a review from cqc-alec September 20, 2023 09:41
@doug-q doug-q merged commit de74ab3 into develop Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AerUnitaryBackend] Call transpile() before run()
2 participants