Qiskit / qiskit-tutorials

A collection of Jupyter notebooks showing how to use the Qiskit SDK
Apache License 2.0
2.3k stars 1.29k forks source link

Add primitives tutorial #1385

Closed tula3and closed 1 year ago

tula3and commented 1 year ago

Summary

Added a tutorial related to Quantum Primitives.

Co-authored-by: Vishal Bajpe @mrvee-qC-bee Co-authored-by: Ikko Hamamura @ikkoham

Details and comments

A part of description and codes is based on lab 1 notebook of the IBM Quantum Challenge 2022.

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

ikkoham commented 1 year ago

Related to https://github.com/Qiskit/qiskit-terra/issues/10668

woodsp-ibm commented 1 year ago

I know you have the selection guide towards the end, but I wonder if it answers the question I see from most new users how do I set the backend? The way things work now is that a provider supplies primitives, like it supplied backends before. Not all providers/services have different backends that make such a selection meaningful in general. The runtime primitive you can choose. the reference and Aer not. The BackendEstimator/Sampler you can but these are really for legacy provider support and would not expected to be as performant at all as using a primitive from the provider, where it exists. I wonder if some section, more towards the front, stating this aspect would help.

Often the question of what primitive is addressed by what you want to do. If you are starting an experiment, where you would like an ideal outcome like you would get from using statevector simulator in the past, then choose the reference or Aer simulator primitives - care is needed since the defaults for ref is ideal but Aer needs to be configured that way. If you then want to see how sampling noise (shots) impacts things the former can be configured to do this and you can also consider the runtime simulator. Adding device noise to a simulator might be the next step. Aer sim you can do this and the runtime one too. The runtime sim you can use some of the noise mitigation techniques to see how they perform too ahead say finally running on a real device. So in my mind the selection can be driven this way - i.e. this thought process can be influencing your path down the above chart.

mrvee-qC-bee commented 1 year ago

I think this is a great suggestion @woodsp-ibm! Will try to formulate an additional section something along those lines so that the content flows down logically to the selections part at the end. @ikkoham @tula3and what do you guys think? I can share a draft along those lines to you guys!

ikkoham commented 1 year ago

In my mind, the correspondence is as follows.

Reference in Terra: BasicAer
Aer primitives with `approximation=False`: PauliExpectation with Aer
Aer primitives with `approximation=True`:  AerPauliExpectation
BackendPrimitives: no error mitigation, but it can use external providers.
RuntimePrimitives: various error mitigation and suppression options, but provider is restricted (IBM devices including simulator)

How is BasicAer placed in your workflow?

Eric-Arellano commented 1 year ago

Thanks for working on this! As shown by the emoji reactions, folks are definitely excited about this :)

We're archiving this repository very soon and moving the tutorials over to qiskit-terra and qiskit-algorithms to build them directly in the documentation directly.

I believe this should be moved to qiskit-terra. Could you please reopen this PR over there?