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

Add get_statevector support #95

Merged
merged 5 commits into from
Jun 1, 2023
Merged

Conversation

dakk
Copy link
Contributor

@dakk dakk commented May 27, 2023

Summary

from qiskit import QuantumCircuit
from qiskit_braket_provider import BraketLocalBackend

backend = BraketLocalBackend(name="default")

q_c = QuantumCircuit(2)
q_c.x(0)
q_c.cx(0, 1)

r = backend.run(q_c, shots=0).result()
print (r.get_statevector())

@CLAassistant
Copy link

CLAassistant commented May 27, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@kshitijc kshitijc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change @dakk! Looks great! 🙌 Could you please:

  • Fix the failing lint check
  • Add an example here along with documentation detailing this use case

feature: add notebook how to run on local
@dakk
Copy link
Contributor Author

dakk commented May 31, 2023

Thank you for this change @dakk! Looks great! raised_hands Could you please:

* Fix the failing lint check

* Add an example [here](https://github.com/qiskit-community/qiskit-braket-provider/tree/main/docs/how_tos) along with documentation detailing this use case

Lint fixed and add a simple notebook for local simulations and statevector calculation. Let me know if it is ok

@IceKhan13
Copy link
Member

@dakk there is still one linter error. Check details on CI.

Basically in braket backend class circuits which has type List[Circuit] and you trying to assign type map to it :)
Make sure types are matched and we are good to do :)

@dakk
Copy link
Contributor Author

dakk commented May 31, 2023

@dakk there is still one linter error. Check details on CI.

Basically in braket backend class circuits which has type List[Circuit] and you trying to assign type map to it :) Make sure types are matched and we are good to do :)

Sorry for that, now should be fixed; I surrounded map with list, so List as type is correct. I've some troubles with running mypy on my computer

@@ -0,0 +1,128 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to merge with this how-to, since the primary motivation is to show how to retrieve a specific result (state vector) here?

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'm not sure about that; the pull add statevector to LocalBackend only, while 2_how_to_retrieve_results_from_backend.ipynb uses AWSBraketProvider backends. LocalBackend is never used in the HOW-TOs, so I thought a new notebook would be a fair solution. Let me know if these arguments makes sense also for you, otherwise I can integrate the code in the existing notebook

Copy link
Collaborator

@kshitijc kshitijc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @dakk! 🚀

@kshitijc kshitijc merged commit 598a5e2 into qiskit-community:main Jun 1, 2023
@dakk dakk deleted the get_statevector branch June 1, 2023 18:22
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.

4 participants