You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demonstrations_v2/tutorial_dqi/demo.py
+61-42Lines changed: 61 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@
38
38
where :math:`\mathbf{b_i}` is the :math:`i`-th row of matrix :math:`B`. You can verify that this
39
39
function represents the number of satisfied equations minus the number of unsatisfied ones by
40
40
considering that when the equation is satisfied, the exponent
41
-
:math:`v_i+\mathbf{b_i}\cdot\mathbf{x}` is always even, and that it is odd in the opposite case.
41
+
:math:`v_i+\mathbf{b_i}\cdot\mathbf{x}` is always even, and odd in the opposite case.
42
42
43
43
Let’s define the conditions for our specific max-XORSAT problem and visualize the objective
44
44
function in a histogram when randomly sampling bit strings :math:`\mathbf{x}` from a uniform distribution.
@@ -104,7 +104,7 @@ def objective_function(x):
104
104
# :class: note
105
105
#
106
106
# The `Hadamard transform <https://lucatrevisan.github.io/teaching/cs259q-12/lecture07b.pdf>`__ can be thought of as a version of the discrete Fourier transform. You have likely used it
107
-
# several times when applying a Hadamard gate at the beginning of a circuit to prepare an equal superposition of all basis states.
107
+
# several times when applying a layer of Hadamard gates at the beginning of a circuit to prepare an equal superposition of all basis states.
108
108
# For :math:`n` qubits and a basis state :math:`|\mathbf{x}\rangle`, we can write the
109
109
# transformation as
110
110
#
@@ -123,7 +123,7 @@ def objective_function(x):
123
123
# where the coefficients :math:`w_k` are carefully chosen (see Section 8.1 of [#Jordan2024]_ for more about this result).
124
124
#
125
125
# The DQI algorithm for solving the max-XORSAT problem involves three qubit registers: a weight, an
126
-
# error, and a syndrome register, with dimensions :math:`\left \lceil \log_{2} \ell \right \rceil`,
126
+
# error, and a syndrome register, with dimensions :math:`\left \lceil \log_{2} (\ell+1) \right \rceil`,
127
127
# :math:`m`, and :math:`n`, respectively. The algorithm’s steps are outlined below and summarized in Figure 1.
128
128
#
129
129
# 1. **Embed weight coefficients:** prepare the state :math:`\sum_{k=0}^{\ell} w_k|k\rangle` in the
@@ -161,10 +161,10 @@ def objective_function(x):
161
161
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
162
#
163
163
# We are going to prepare the superposition :math:`\sum_{k=0}^{\ell} w_k|k\rangle`. As previously stated,
164
-
# the weight register is made up of :math:`\left \lceil \log_{2} \ell \right \rceil` qubits, which means
164
+
# the weight register is made up of :math:`\left \lceil \log_{2} (\ell+1) \right \rceil` qubits, which means
165
165
# that the index :math:`k` is being binary encoded. The coefficients :math:`w_k` are chosen such that
166
166
# they maximize the number of satisfied linear equations. These optimal weights are the components
167
-
# of the principal eigenvector of an :math:`(\ell+1)\times(\ell+1)` symmetric tridiagonal matrix [#Jordan2024]_:
167
+
# of the principal eigenvector of an :math:`(\ell+1)\times(\ell+1)` symmetric tridiagonal matrix:
168
168
#
169
169
# .. math::
170
170
#
@@ -183,8 +183,7 @@ def objective_function(x):
183
183
# in this step.
184
184
#
185
185
# In this demo, we will use a polynomial of degree :math:`2` for a reason that will become clear during
186
-
# the decoding step. For now, you might be wondering if :math:`\left \lceil \log_{2} 2\right \rceil=1`
187
-
# qubit will be enough to encode :math:`k=0,1,2`. Well, let’s examine what we obtain for the
186
+
# the decoding step. For now, let’s examine what we obtain for the
0 commit comments