Closed isaacdevlugt closed 1 week ago
👋 Hey, looks like you've updated some demos!
🐘 Don't forget to update the dateOfLastModification
in the associated metadata files so your changes are reflected in Glass Onion (search and recommendations).
Please hide this comment once the field(s) are updated. Thanks!
Thank you for opening this pull request.
You can find the built site at this link.
Deployment Info:
1104
acca28200bb04bfd3a7b64cca7cc6a60681a5d83
(The Deployment SHA
refers to the latest commit hash the docs were built from)Note: It may take several minutes for updates to this pull request to be reflected on the deployed site.
Nice work @isaacdevlugt! Just a general comment but I'd just like to highlight something that is distinctly neat about using PL over using Qiskit: You don't need to swap between Estimator and Sampler in order to get what you want.
E.g. in Qiskit if you had some circuit and you wanted both the expectation value and the counts (admittedly, this is a bit of a contrived example), you would need to initialize Estimator and Sampler, and then write a lot of repeated, syntactically complicated code (e.g. expval = estimator.run()[0].data.evs anyone?) to do so. In Pennylane? Easy as
return qml.expval(obs), qml.counts(obs)
. Syntactic sugar like this is always nice IMO.
Okay this is interesting! I tried to get this to work, and you can actually extract more than just counts
from Sampler
:
from qiskit.primitives import StatevectorSampler
sampler = StatevectorSampler()
job_sampler = sampler.run([qc], shots=1024)
result_sampler = job_sampler.result()[0].data.meas.expectation_values(operators) # or call get_counts()
print(result_sampler)
[0.984375 0.96484375 0.96289062]
Okay this is interesting! I tried to get this to work, and you can actually extract more than just
counts
fromSampler
:from qiskit.primitives import StatevectorSampler sampler = StatevectorSampler() job_sampler = sampler.run([qc], shots=1024) result_sampler = job_sampler.result()[0].data.meas.expectation_values(operators) # or call get_counts() print(result_sampler)
[0.984375 0.96484375 0.96289062]
Previously you were working with SamplerV1, which didn't have this functionality. SamplerV2 has this functionality though so that's why you're seeing a difference.
We're nearly ready to :shipit:, just need to figure out that pesky figure alignment 🤔
Another question I have is about emoji in section titles.
I don't recall ever using this approach in PennyLane Demos. Am I missing something, @isaacdevlugt ?
Also, removing them might help with some of the rendering issues for the time being.
Title: How to use Qiskit 1.0 with PL
Shortcut: https://app.shortcut.com/xanaduai/story/63358/how-to-how-to-use-qiskit-1-0-with-pennylane