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

Merge dev into master for v0.29 release #711

Merged
merged 51 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
5743fa5
Development branch
josh146 Nov 15, 2022
39ca8c1
Merge branch 'master' into dev
actions-user Nov 18, 2022
17fdcb4
Merge branch 'master' into dev
actions-user Nov 21, 2022
47e83e1
Merge branch 'master' into dev
actions-user Nov 21, 2022
12ef0b8
Merge branch 'master' into dev
actions-user Nov 22, 2022
ecad024
Merge branch 'master' into dev
actions-user Nov 23, 2022
b0fb42b
Merge branch 'master' into dev
actions-user Nov 25, 2022
f39ee3f
Merge branch 'master' into dev
actions-user Nov 28, 2022
00becee
Merge branch 'master' into dev
actions-user Nov 28, 2022
3685225
Merge branch 'master' into dev
actions-user Nov 29, 2022
ce0d527
Merge branch 'master' into dev
actions-user Dec 1, 2022
8a86295
Merge branch 'master' into dev
actions-user Dec 2, 2022
7a323e1
Merge branch 'master' into dev
actions-user Dec 5, 2022
289baab
Merge branch 'master' into dev
actions-user Dec 7, 2022
b91874b
Merge branch 'master' into dev
actions-user Dec 9, 2022
9c92f0e
Merge branch 'master' into dev
actions-user Dec 10, 2022
1d32d2b
Merge branch 'master' into dev
actions-user Dec 12, 2022
8c25d7d
Merge branch 'master' into dev
actions-user Dec 12, 2022
222e6a6
Merge branch 'master' into dev
actions-user Dec 16, 2022
a8284e3
Bumped requirement package versions (#667)
rashidnhm Dec 19, 2022
ccfcf45
Merge dev in master following v0.28.0 release of PennyLane (#671) (#672)
rashidnhm Dec 21, 2022
808b1d8
Merge branch 'master' into dev
rashidnhm Dec 21, 2022
00a7c8c
Merge branch 'master' into dev
actions-user Jan 3, 2023
bf00d71
Merge branch 'master' into dev
actions-user Jan 4, 2023
cc47e89
Merge branch 'master' into dev
actions-user Jan 5, 2023
b3f7f3e
Merge branch 'master' into dev
actions-user Jan 5, 2023
9316a8f
Merge branch 'master' into dev
actions-user Jan 18, 2023
eb7a990
Merge branch 'master' into dev
actions-user Jan 20, 2023
595b898
Merge branch 'master' into dev
actions-user Jan 23, 2023
03ee056
Merge branch 'master' into dev
actions-user Jan 23, 2023
76d7343
Merge branch 'master' into dev
actions-user Jan 30, 2023
5281bd8
Merge branch 'master' into dev
actions-user Feb 3, 2023
dadd39c
Merge branch 'master' into dev
actions-user Feb 3, 2023
a8ab874
Merge branch 'master' into dev
actions-user Feb 6, 2023
b39a0e7
Merge branch 'master' into dev
actions-user Feb 6, 2023
4f65f43
Merge branch 'master' into dev
actions-user Feb 10, 2023
673e059
Merge branch 'master' into dev
actions-user Feb 14, 2023
34b6c43
Merge branch 'master' into dev
actions-user Feb 21, 2023
3b40e58
Merge branch 'master' into dev
actions-user Feb 21, 2023
8356cca
Update chemical reactions demo to use pyscf for openshell H3 (#704)
soranjh Feb 21, 2023
10d6d86
Change ibm device in Quantum volume (#703)
rmoyard Feb 22, 2023
ab34e2a
Update demos to remove warnings (#705)
mudit2812 Feb 22, 2023
e8811cd
Update classical shadows (#708)
rmoyard Feb 23, 2023
942cbb5
Update SPSA demo to count circuit executions manually. (#706)
dwierichs Feb 24, 2023
c2bcccb
Merge branch 'master' into dev
actions-user Feb 24, 2023
62295af
Merge branch 'master' into dev
actions-user Feb 28, 2023
8e7acb7
bump requirements
albi3ro Feb 28, 2023
18552f0
oops requirements
albi3ro Feb 28, 2023
8d5db17
trigger ci
albi3ro Feb 28, 2023
696922f
fix rendering issue
albi3ro Feb 28, 2023
9e9a070
Update requirements.txt
albi3ro Feb 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 73 additions & 75 deletions demonstrations/quantum_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,38 +397,38 @@ def qv_circuit_layer(num_qubits):
#
# .. code-block:: none
#
# 0: ─╭SWAP─╭U(M0)─╭U(M1)─╭SWAP───────╭U(M2)─┤
# 1: ─SWAP─╰U(M0)─╰U(M1)─│─────╭SWAP─╰U(M2)─┤
# 2: ────────────────────╰SWAP─╰SWAP────────┤
# 3: ────────────────────────────────────────┤
# 4: ────────────────────────────────────────┤
# M0 =
# [[-0.17514647+0.00759447j 0.11975927+0.16007614j -0.41793925+0.49643728j
# 0.62304058-0.34640531j]
# [-0.73367896-0.58079555j -0.11348577+0.00751965j -0.02640159-0.15592112j
# -0.19507153-0.21998821j]
# [ 0.02988983+0.09364586j -0.74053162+0.55032455j 0.31350059-0.01305651j
# 0.16283233-0.11885036j]
# [-0.13103809-0.25850305j 0.18298996+0.2497364j 0.34879438+0.57771772j
# -0.02385446+0.60346274j]]
# M1 =
# [[ 0.14296171+0.28087257j -0.5985737 -0.27489922j -0.43838149+0.10344812j
# 0.04022491+0.51216658j]
# [-0.21538853+0.02728431j -0.24776721-0.57146257j 0.60975755+0.36241573j
# 0.21787038-0.11953391j]
# [-0.24405375+0.05780278j -0.11688629-0.17397518j -0.51628349-0.11381455j
# 0.44143429-0.64714776j]
# [-0.750841 -0.47630904j -0.28666068+0.22820556j -0.09459735+0.07429451j
# -0.17243398+0.17582253j]]
# M2 =
# [[-0.63733359+1.91519046e-01j -0.49615702+9.79920998e-05j
# 0.06949634+4.54968771e-01j 0.21112196-2.33571716e-01j]
# [ 0.4774216 +5.19692450e-02j -0.2741782 -3.71778068e-01j
# 0.09817361+6.01972062e-01j -0.39517581+1.66741872e-01j]
# [ 0.14401687-1.53582182e-01j 0.51636466-1.58216631e-01j
# 0.43804144+3.62586089e-01j 0.4473567 -3.74872915e-01j]
# [ 0.51670588+1.23210608e-01j -0.48982566-9.40288988e-02j
# -0.19210465-2.36457367e-01j 0.53202679-3.05278186e-01j]]
# 0: ─╭SWAP───────╭U(M0)─╭SWAP───────╭U(M1)─╭U(M2)─┤
# 1: ─│─────╭SWAP─╰U(M0)─╰SWAP─╭SWAP─╰U(M1)─╰U(M2)─┤
# 2: ─╰SWAP─╰SWAP──────────────╰SWAP───────────────┤
# 3: ──────────────────────────────────────────────┤
# 4: ──────────────────────────────────────────────┤
# M0 =
# [[ 0.22234537+0.12795769j 0.24613682-0.34470179j 0.58179809-0.36478045j
# -0.16337007-0.50650086j]
# [-0.08840637-0.42456216j -0.01961572+0.35189839j 0.4214659 +0.31514336j
# -0.63733039+0.06764003j]
# [ 0.28919627-0.23577761j -0.11249786-0.67687982j 0.22914826+0.37205064j
# 0.12755164+0.42749545j]
# [ 0.59999195+0.49689511j -0.29294024+0.37382355j 0.23724315-0.06544043j
# -0.039832 +0.3246437j ]]
# M1 =
# [[ 0.11583153-0.3628563j 0.55797708+0.48315028j -0.22400838-0.264741j
# -0.34856401+0.26149824j]
# [-0.04549494-0.25884483j 0.00258749-0.20351027j -0.26326583-0.70408962j
# 0.33442905-0.46109931j]
# [-0.46824254-0.14274112j -0.00491681+0.61278881j -0.02506472+0.26582603j
# 0.54135395-0.14312156j]
# [ 0.73672445-0.05881259j 0.19534118+0.01057264j -0.29145879+0.398047j
# 0.33955583-0.23837031j]]
# M2 =
# [[-0.33352575+0.21982221j -0.29128941-0.51347253j 0.63543764-0.11913356j
# 0.27186717+0.00704727j]
# [-0.22330473+0.02289549j 0.1997405 -0.47316218j -0.23040621-0.14078015j
# -0.47922028-0.61909121j]
# [-0.00705247+0.82724695j 0.52220719+0.02527864j -0.05490671-0.04899343j
# 0.03167901+0.18935341j]
# [ 0.23396138-0.22566431j 0.32400589+0.09694607j 0.54666955-0.45261179j
# -0.48177768+0.2101061j ]]


##############################################################################
Expand Down Expand Up @@ -510,19 +510,19 @@ def heavy_output_set(m, probs):
#
# .. code-block:: none
#
# State Probability
# 000 0.0157
# 001 0.0200
# 010 0.0026
# 011 0.2765
# 100 0.0175
# 101 0.4266
# 110 0.0045
# 111 0.2365
# State Probability
# 000 0.0559
# 001 0.3687
# 010 0.0326
# 011 0.0179
# 100 0.0550
# 101 0.3590
# 110 0.1103
# 111 0.0005
#
# Median is 0.0188
# Probability of a heavy output is 0.9596
# Heavy outputs are ['001', '111', '011', '101']
# Median is 0.0554
# Probability of a heavy output is 0.8939
# Heavy outputs are ['000', '110', '101', '001']
#

##############################################################################
Expand All @@ -531,7 +531,7 @@ def heavy_output_set(m, probs):
# ~~~~~~~~~~~~~~~~~~~~~~~~
#
# Now it's time to run the protocol. First, let's set up our hardware
# device. We'll use a simulated version of the 5-qubit IBM Ourense as an example
# device. We'll use a simulated version of the 5-qubit IBM Lima as an example
# --- the reported quantum volume according to IBM is :math:`V_Q=8`, so we
# endeavour to reproduce that here. This means that we should be able to run our
# square circuits reliably on up to :math:`\log_2 V_Q =3` qubits.
Expand All @@ -551,13 +551,10 @@ def heavy_output_set(m, probs):
#
# .. note::
#
# In the time since the original release of this demo, the Ourense device is
# no longer available from IBM Q. However, we leave the original results for
# expository purposes, and note that the methods are applicable in general.
# Users can get a list of available IBM Q backends by importing IBM Q,
# specifying their provider and then calling: ``provider.backends()``
#
dev_ourense = qml.device("qiskit.ibmq", wires=5, backend="ibmq_bogota")
dev_lima = qml.device("qiskit.ibmq", wires=5, backend="ibmq_lima")

##############################################################################
#
Expand All @@ -567,18 +564,18 @@ def heavy_output_set(m, probs):
import matplotlib.pyplot as plt
import networkx as nx

ourense_hardware_graph = nx.Graph(dev_ourense.backend.configuration().coupling_map)
lima_hardware_graph = nx.Graph(dev_lima.backend.configuration().coupling_map)

nx.draw_networkx(
ourense_hardware_graph,
lima_hardware_graph,
node_color="cyan",
labels={x: x for x in range(dev_ourense.num_wires)},
labels={x: x for x in range(dev_lima.num_wires)},
)


##############################################################################
#
# .. figure:: ../demonstrations/quantum_volume/ourense.svg
# .. figure:: ../demonstrations/quantum_volume/lima.svg
# :align: center
# :width: 75%
#
Expand All @@ -589,16 +586,16 @@ def heavy_output_set(m, probs):
# to make some adjustments when non-connected qubits need to interact.
#
# To actually perform the simulations, we'll need to access a copy of the
# Ourense noise model. Again, we won't be running on Ourense directly ---
# Lima noise model. Again, we won't be running on Lima directly ---
# we'll set up a local device to simulate its behaviour.
#

from qiskit.providers.aer import noise

noise_model = noise.NoiseModel.from_backend(dev_ourense.backend)
noise_model = noise.NoiseModel.from_backend(dev_lima.backend)

dev_noisy = qml.device(
"qiskit.aer", wires=dev_ourense.num_wires, shots=1000, noise_model=noise_model
"qiskit.aer", wires=dev_lima.num_wires, shots=1000, noise_model=noise_model
)

##############################################################################
Expand All @@ -609,7 +606,7 @@ def heavy_output_set(m, probs):
# qubit placement and routing techniques [#sabre]_ in order to fit the circuits
# on the hardware graph in the best way possible.

coupling_map = dev_ourense.backend.configuration().to_dict()["coupling_map"]
coupling_map = dev_lima.backend.configuration().to_dict()["coupling_map"]

dev_noisy.set_transpile_args(
**{
Expand Down Expand Up @@ -697,24 +694,24 @@ def heavy_output_set(m, probs):
# .. code-block:: none
#
# Ideal mean probabilities:
# m = 2: 0.797979 above threshold.
# m = 3: 0.844052 above threshold.
# m = 4: 0.841203 above threshold.
# m = 5: 0.856904 above threshold.
# m = 2: 0.801480 above threshold.
# m = 3: 0.853320 above threshold.
# m = 4: 0.832995 above threshold.
# m = 5: 0.858370 above threshold.
#
# Device mean probabilities:
# m = 2: 0.773760 above threshold.
# m = 3: 0.794875 above threshold.
# m = 4: 0.722860 above threshold.
# m = 5: 0.692935 above threshold.
# m = 2: 0.765920 above threshold.
# m = 3: 0.773985 above threshold.
# m = 4: 0.674380 above threshold.
# m = 5: 0.639500 below threshold.

##############################################################################
#
# We see that the ideal probabilities are well over 2/3. In fact, they're quite
# close to the expected value of :math:`(1 + \ln 2)/2`, which we recall from
# above is :math:`\approx 0.85`. For this experiment, we see that the device
# probabilities are also above the threshold. But it isn't enough that just the
# mean of the heavy output probabilities is greater than 2/3. Since we're
# probabilities are also above the threshold (except one). But it isn't enough
# that just the mean of the heavy output probabilities is greater than 2/3. Since we're
# dealing with randomness, we also want to ensure these results were not just a
# fluke! To be confident, we also want to be above 2/3 within 2 standard
# deviations :math:`(\sigma)` of the mean. This is referred to as a 97.5%
Expand Down Expand Up @@ -766,13 +763,14 @@ def heavy_output_set(m, probs):
label="2σ",
)

fig.suptitle("Heavy output distributions for (simulated) Ourense QPU", fontsize=18)
fig.suptitle("Heavy output distributions for (simulated) Lima QPU", fontsize=18)
plt.legend(fontsize=14)
plt.tight_layout()


##############################################################################
#
# .. figure:: ../demonstrations/quantum_volume/ourense_heavy_output_distributions.svg
# .. figure:: ../demonstrations/quantum_volume/lima_heavy_output_distributions.svg
# :align: center
# :width: 90%
#
Expand All @@ -795,16 +793,16 @@ def heavy_output_set(m, probs):
#
# .. code-block:: none
#
# m = 2: 0.714590 above threshold.
# m = 3: 0.737770 above threshold.
# m = 4: 0.659562 below threshold.
# m = 5: 0.627701 below threshold.
# m = 2: 0.706039 above threshold.
# m = 3: 0.714836 above threshold.
# m = 4: 0.608109 below threshold.
# m = 5: 0.571597 below threshold.
#

##############################################################################
#
# We see that we are :math:`2\sigma` above the threshold only for :math:`m=2`,
# and :math:`m=3`. Thus, we find that the quantum volume of our simulated Ourense is
# and :math:`m=3`. Thus, we find that the quantum volume of our simulated Lima is
# :math:`\log_2 V_Q = 3`, or :math:`V_Q = 8`, as expected.
#
# This framework and code will allow you to calculate the quantum volume of many
Expand All @@ -831,7 +829,7 @@ def heavy_output_set(m, probs):
# number of qubits continues to increase and error rates are getting lower,
# both of which imply that our square circuits will be growing in both width and
# depth as time goes on. Eventually they will reach a point where they are no
# longer classical simulable and we will have to design new benchmarks.
# longer classical simulable, and we will have to design new benchmarks.
#
# Another limitation is that the protocol only looks at one type of circuit,
# i.e., square circuits. It might be the case that a processor has very few
Expand Down
Loading