Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 17, 2023
2 parents 6b6c45d + 56d3574 commit 77dd532
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
"authors": [
{
"id": "matthew_beach"
},
{
"id": "josh_izaac"
},
{
"id": "thomas_bromley"
}
],
"dateOfPublication": "2023-10-16T00:00:00+00:00",
Expand Down Expand Up @@ -41,4 +35,4 @@
"logo": "/_static/hardware_logos/aws.png"
}
]
}
}
2 changes: 0 additions & 2 deletions demonstrations/getting_started_with_hybrid_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,5 +386,3 @@ def circuit(params):
# About the author
# ----------------
# .. include:: ../_static/authors/matthew_beach.txt
# .. include:: ../_static/authors/thomas_bromley.txt
# .. include:: ../_static/authors/josh_izaac.txt
32 changes: 16 additions & 16 deletions demonstrations/tutorial_quantum_circuit_cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
PennyLane. This method was first introduced in [#Peng2019]_.
Thereafter, we discuss the theoretical basis on randomized circuit
cutting with two-designs and demonstrate the resulting improvement in
performance compared to Pauli measurement based circuit cutting for an
performance compared to Pauli measurement-based circuit cutting for an
instance of Quantum Approximate Optimization Algorithm (QAOA).
Expand Down Expand Up @@ -83,11 +83,11 @@
The above equation can be implemented as a quantum circuit on a quantum
computer. To do this, each term :math:`Tr(\rho O_i)\rho_i` in the equation
is broken into two parts. The first part, :math:`Tr(\rho O_i)` is the
expectation of the observable :math:`O_i` when the system is in the state
expectation of the observable :math:`O_i` when the system is in the state
:math:`\rho`. Let's call this first circuit subcircuit-:math:`u`.
The second part, :math:`\rho_i` is initialization or preparation of the
eigenstate, :math:`\rho_i`. Let's call this Second circuit subcircuit-:math:`v`.
The above equation shows how we can recover a quantum state after a is cut made
The above equation shows how we can recover a quantum state after a cut is made
on one of its qubits as shown in figure 1. This forms the core of quantum
circuit cutting.
Expand Down Expand Up @@ -235,12 +235,12 @@ def circuit(x):
# circuit graph is replaced with ``MeasureNode`` and ``PrepareNode`` pairs as
# shown in figure 2. The ``MeasureNode`` is the point on the cut qubit that
# indicates where to measure the observable :math:`O_i` after cut. On the other
# hand, the ``PrepareNode`` is the point on the cut qubit that indicates Where
# hand, the ``PrepareNode`` is the point on the cut qubit that indicates where
# to initialize the state :math:`\rho` after cut.
# Both ``MeasureNode`` and ``PrepareNode`` are placeholder
# operations that allow us to cut the quantum circuit graph and then iterate
# over measurements of Pauli observables and preparations of their corresponding
# eigenstates configurations at cut locations.
# eigenstate configurations at cut locations.

###################################################################
# .. figure:: ../demonstrations/quantum_circuit_cutting/MeasurePrepareNodes.png
Expand Down Expand Up @@ -325,12 +325,12 @@ def circuit(x):
# cutting. Our description of this method will be based on the recently
# published work [#Lowe2022]_.
#
# The key idea behind this approach is to use measurements in an entagled
# The key idea behind this approach is to use measurements in an entangled
# basis that is based on a unitary 2-design to get more information about
# the state with fewer measurements compared to single qubit Pauli
# the state with fewer measurements compared to single-qubit Pauli
# measurements.
#
# The concept of 2-designs is simple — a unitary 2-design is finite
# The concept of 2-designs is simple — a unitary 2-design is a finite
# collection of unitaries such that the average of any degree 2 polynomial
# function of a linear operator over the design is exactly the same as the
# average over Haar random measure. For further explanation of this measure read
Expand All @@ -343,7 +343,7 @@ def circuit(x):
#
# .. math:: \frac{1}{L} \sum_{l=1}^{L} P(U_l) = \int_{\mathcal{U}(d)} P (U) d\mu(U)~.
#
# The elemements of the Clifford group over the qubits being cut are an
# The elements of the Clifford group over the qubits being cut are an
# example of a 2-design. We don’t have a lot of space here to go into too
# many details. But fear not - there is an `entire
# demo <https://pennylane.ai/qml/demos/tutorial_unitary_designs.html>`__
Expand All @@ -357,7 +357,7 @@ def circuit(x):
#
# If :math:`k` qubits are being cut, then the dimensionality of the
# Hilbert space is :math:`d=2^{k}`. The key idea of Randomized Circuit Cutting
# is to employ two different quantum channels with probabilities such that together
# is to employ two different quantum channels with probabilities such that together
# they comprise a resolution of Identity. In the randomized measurement circuit
# cutting procedure, we trace out the :math:`k` qubits and prepare a random basis
# state with probability :math:`d/(2d+1)`. For a linear operator
Expand All @@ -366,7 +366,7 @@ def circuit(x):
#
# .. math:: \Psi_{1}(X) = \textrm{Tr}(X)\frac{\mathbf{1}}{d}~.
#
# Otherwise, we perform measure-and-prepare protocol based on
# Otherwise, we perform a measure-and-prepare protocol based on
# a unitary 2-design (e.g. a random Clifford) with probability
# :math:`(d+1)/(2d+1)`, corresponding to the channel
#
Expand Down Expand Up @@ -408,7 +408,7 @@ def circuit(x):
# `Quantum Approximate Optimization
# Algorithm <https://pennylane.ai/qml/demos/tutorial_qaoa_intro.html>`__
# (QAOA). In its simplest form, QAOA concerns itself with finding a
# lowest energy state of a *cost hamiltonian* :math:`H_{\mathcal{C}}`:
# lowest energy state of a *cost Hamiltonian* :math:`H_{\mathcal{C}}`:
#
# .. math:: H_\mathcal{C} = \frac{1}{|E|} \sum _{(i, j) \in E} Z_i Z_j
#
Expand Down Expand Up @@ -686,7 +686,7 @@ def make_kraus_ops(num_wires: int):


######################################################################
# Verify that we get expected values:
# Verify that we get the expected values:
#

print(f"Cut size: k={k}")
Expand All @@ -696,12 +696,12 @@ def make_kraus_ops(num_wires: int):
fig.set_size_inches(12, 6)

######################################################################
# You may have noticed that both generarated tapes have the same size as
# You may have noticed that both generated tapes have the same size as
# the original ``tape``. It may seem that no circuit cutting actually took
# place. However, this is just an artifact of the way we chose to
# represent **classical communication** between subcircuits.
# Measure-and-prepare channels at work here are more naturally implemented
# on a mixed-state simulator. On a real quantum device however,
# on a mixed-state simulator. On a real quantum device, however,
# introducing a classical communication step is equivalent to separating
# the circuit into two.
#
Expand All @@ -712,7 +712,7 @@ def make_kraus_ops(num_wires: int):
device = qml.device("default.mixed", wires=tape.wires)

######################################################################
# We only need a single run each of the two generated tapes, ``tape0`` and
# We only need a single run for each of the two generated tapes, ``tape0`` and
# ``tape1``, collecting the appropriate number of samples. NumPy can
# take care of this for us - we let ``np.choice`` make our decision on
# which tape to run for each shot:
Expand Down

0 comments on commit 77dd532

Please sign in to comment.