Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

Commit 18ad503

Browse files
author
Ilia Lazarev
committed
Imrove Step by step circuit explanation #16
1 parent eeac818 commit 18ad503

File tree

1 file changed

+68
-53
lines changed

1 file changed

+68
-53
lines changed

manuscript.tex

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
219219
\caption{
220220
Quantum circuit for the quantum parallelized Hamming distance calculating between all pairs of binary vectors from two sets ${X}$ and ${Y}$ encoded \cite{trugenberger2001} in $X$ and $Y$ quantum registers respectively.
221221
First, we encoded information about pairwise different qubits in a quantum state of the $X$-register with applying the CNOT gates.
222-
Second, Hamming distance values are extracted into the amplitudes of superposition with the controled rotation around $z$-axis gate and Hadamard gates.
222+
Second, Hamming distance values are extracted into the amplitudes of superposition with the controled rotation around $z$-axis gate~(\ref{eq:controled_rotation}) and Hadamard gates.
223223
Finally, a quantum state of the $X$-register returned to the initial basis for information retrieval.
224224
}
225225
\label{fig:qcircuit}
@@ -255,12 +255,12 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
255255
Meanwhile, during the procedure it stores the differences between input vectors and cluster states.
256256

257257
Let us assume we have $k$ input vectors and $l$ cluster states.
258-
The $i$th input vector and $j$th cluster vector are respectively denoted as $\left| X_i \right\rangle$, $\left| Y_j \right\rangle$.
258+
The $i$th input vector and $j$th cluster vector are respectively denoted as $\left| x_i \right\rangle$, $\left| y_j \right\rangle$.
259259
The registers $\left| X \right\rangle$ and $\left| Y \right\rangle$ are initialized to store the input vectors and cluster vectors according to
260260
%
261261
\begin{align}
262-
\left| X \right\rangle & = \frac{1}{\sqrt{k}} \sum\limits_{i=1}^{k} \left| X_i \right\rangle, \\
263-
\left| Y \right\rangle& = \frac{1}{\sqrt{l}} \sum\limits_{j=1}^{l} \left| Y_j \right\rangle .
262+
\left| X \right\rangle & = \frac{1}{\sqrt{k}} \sum\limits_{i=1}^{k} \left| x_i \right\rangle, \\
263+
\left| Y \right\rangle& = \frac{1}{\sqrt{l}} \sum\limits_{j=1}^{l} \left| y_j \right\rangle .
264264
\label{eq:encodnig}
265265
\end{align}
266266
%
@@ -276,28 +276,26 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
276276
%
277277
where $\left| a \right\rangle$ is an auxiliary qubit in the state $\left| 0 \right\rangle$ initially.
278278

279-
Given this initial state we may begin the processing of the problem. We start by applying a CNOT gate between $\left| X \right\rangle$ and $\left| Y \right\rangle$
279+
Given this initial state we may begin the processing of the problem. We start by applying a CNOT gate on $\left| x^{(\alpha)} y^{(\alpha)} \right\rangle$ and $\alpha = 1 \dots n$
280280

281-
\begin{align}
282-
| \psi_1 \rangle & =
283-
\mathrm{CNOT} (Y,X)| \psi_0 \rangle \nonumber \\
284-
& =
281+
\begin{equation}
282+
| \psi_1 \rangle =
285283
\frac{1}{\sqrt{kl}} \sum_{i, j=1}^{k}
286284
| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \rangle
287285
| y^{(1)}_j, \dots, y^{(n)}_j \rangle
288286
| 0 \rangle
289-
\end{align}
287+
\end{equation}
290288
%
291-
where $d^\alpha_{ij} = \mathrm{CNOT}(y^\alpha_i, x^\alpha_j)$, $\alpha = 1 \dots n$, and $i,j$ are the qubit indexes in the registers.
289+
where $d^{(\alpha)}_{ij} = \mathrm{CNOT}(y^{(\alpha)}_i, x^{(\alpha)}_j)$, and $\alpha = 1 \dots n$ is the qubit index in the register.
292290
At this stage of the computation the $\left| X \right\rangle$ no longer stores the input vectors,
293291
instead it stores the information about pairwise different qubits between the input vector $\{X\}$ and cluster vector $\{Y\}$.
294292
Next, for each pair $\{X\}$ and $\{Y\}$, the accumulated information of all the differences is projected onto the amplitude of the superposed state.
295293
This is achieved by applying the Hadamard gate on auxiliary qubit,
296294
followed by a controlled rotation around $z$-axis gate on $\left| Xa \right\rangle$ defined as
297295
%
298296
\begin{equation}
299-
\label{eq:control_phase_rotation}
300-
R_{(X,a)}(\phi) =
297+
\label{eq:controled_rotation}
298+
C_{R_z}(\phi) =
301299
\begin{pmatrix}
302300
1 & 0 & 0 & 0 \\
303301
0 & e^{-i \frac \phi 2} & 0 & 0 \\
@@ -312,46 +310,57 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
312310
After the first Hadamard on the ancilla qubit the state is
313311
%
314312
\begin{equation}
315-
\left| \psi_2 \right\rangle = H_a\left| \psi_1 \right\rangle =
313+
\left| \psi_2 \right\rangle =
316314
\frac{1}{\sqrt{kl}}\sum\limits_{i, j=1}^{k}
317-
\left| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \right\rangle
318-
\left| y^{(1)}_j, \dots, y^{(n)}_j \right\rangle
315+
\left| d_{ij} \right\rangle
316+
\left| y_j \right\rangle
319317
\dfrac{(\left| 0 \right\rangle + \left| 1 \right\rangle)}{\sqrt{2}} .
320318
\end{equation}
321319
%
322-
Applying the controlled rotation around $z$-axis gate the state then becomes
320+
Applying the controlled rotation around $z$-axis gate on $\left| x^{(\alpha)} a \right\rangle$ where $\alpha = 1\dots n$ and the state then becomes
323321
%
324322
\begin{multline}
325-
\left| \psi_3 \right\rangle = R_{(X,a)}\left(\dfrac{\pi}{n}\right)\left| \psi_2 \right\rangle
326-
\\ = \dfrac{1}{\sqrt{2kl}}
327-
\sum\limits_{i, j=1}^{k}
328-
\left| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \right\rangle
329-
\left| y^{(1)}_j, \dots, y^{(n)}_j \right\rangle
330-
\left| 0 \right\rangle
331-
\\ + \dfrac{1}{\sqrt{2kl}}
332-
\sum\limits_{i, j=1}^{k}
333-
\exp\left(\dfrac{-i \pi}{n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
334-
\left| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \right\rangle
335-
\\ \times \left| y^{(1)}_j, \dots, y^{(n)}_j \right\rangle
336-
\left| 1 \right\rangle
323+
\left| \psi_3 \right\rangle
324+
= \dfrac{1}{\sqrt{2kl}} \sum\limits_{i, j=1}^{k}
325+
\exp\left(
326+
\dfrac{-i \pi}{2n}
327+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
328+
\right)
329+
\left| d_{ij} \right\rangle
330+
\left| y_j \right\rangle
331+
\left| 0 \right\rangle \\
332+
+ \dfrac{1}{\sqrt{2kl}} \sum\limits_{i, j=1}^{k}
333+
\exp\left(
334+
\dfrac{i \pi}{2n}
335+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
336+
\right)
337+
\left| d_{ij} \right\rangle
338+
\left| y_j \right\rangle
339+
\left| 1 \right\rangle
337340
\end{multline}
338341
%
339342
Applying another Hadamard on the ancilla qubit we obtain
340343
%
341344
\begin{multline}
342345
\left| \psi_4 \right\rangle =
343346
\frac{1}{\sqrt{kl}}\sum\limits_{i, j=1}^{k}
344-
\exp \left(\dfrac{-i \pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
345-
\\ \times
346-
\left[ \cos\left(\dfrac{\pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
347-
\left| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \right\rangle
348-
\left| y^{(1)}_j, \dots, y^{(n)}_j \right\rangle
349-
\left| 0 \right\rangle\right.
350-
\\+
351-
\left. i \sin\left(\dfrac{\pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
352-
\left| d^{(1)}_{ij}, \dots, d^{(n)}_{ij} \right\rangle
353-
\left| y^{(1)}_j, \dots, y^{(n)}_j \right\rangle
354-
\left| 1 \right\rangle\right] .
347+
\left[
348+
\cos\left(
349+
\dfrac{\pi}{2n}
350+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
351+
\right)
352+
\left| d_{ij} \right\rangle
353+
\left| y_j \right\rangle
354+
\left| 0 \right\rangle\right.
355+
\\+
356+
\left. i \sin\left(
357+
\dfrac{\pi}{2n}
358+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
359+
\right)
360+
\left| d_{ij} \right\rangle
361+
\left| y_j \right\rangle
362+
\left| 1 \right\rangle
363+
\right] .
355364
\end{multline}
356365
%
357366
This completes the step for projecting differences between pairs of $\{X\}$ and $\{Y\}$ onto the amplitude of the auxiliary qubit.
@@ -363,19 +372,25 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
363372
At this stage, the information regarding the differences between pairs of $\{X\}$ and $\{Y\}$ \hl{encoded in the amplitudes, in order to extract the Hamming distances between the relevant $\left| x_i \right\rangle$, $\left| y_j \right\rangle$ we return to our initial basis} for register $\left| X \right\rangle$ by applying pairwise CNOT gates:
364373
%
365374
\begin{multline}
366-
\left| \psi_f \right\rangle =
367-
\mathrm{CNOT} (Y,X)\left| \psi_4 \right\rangle \\=
375+
\left| \psi_f \right\rangle =
368376
\frac{1}{\sqrt{kl}}\sum\limits_{i, j=1}^{k}
369-
\exp \left(\dfrac{-i \pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
370-
\left[ \cos\left(\dfrac{\pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
371-
\left| X_i \right\rangle
372-
\left| Y_j \right\rangle
377+
\left[
378+
\cos\left(
379+
\dfrac{\pi}{2n}
380+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
381+
\right)
382+
\left| x_i \right\rangle
383+
\left| y_j \right\rangle
373384
\left| 0 \right\rangle\right.
374385
\\+
375-
\left. i \sin\left(\dfrac{\pi}{2n}\sum\limits_{l=1}^n d^{(l)}_{ij} \right)
376-
\left| X_i \right\rangle
377-
\left| Y_j \right\rangle
378-
\left| 1 \right\rangle\right] .
386+
\left. i \sin\left(
387+
\dfrac{\pi}{2n}
388+
\sum\limits_{\alpha=1}^n d^{(\alpha)}_{ij}
389+
\right)
390+
\left| x_i \right\rangle
391+
\left| y_j \right\rangle
392+
\left| 1 \right\rangle
393+
\right] .
379394
\end{multline}
380395
%
381396
This makes $\{X\}$ store the input vectors again, as in the initial step
@@ -386,11 +401,11 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
386401
In this case, the biggest amplitude of the measurement result coincides with the smallest Hamming distance when the measurement result of the ancilla qubit is 0.
387402
If the ancilla qubit is 1, the smallest amplitude of the measurement result coincides with the smallest Hamming distance.
388403

389-
Measuring the Hamming distance of a particular pair of input vectors $\left| X_i \right\rangle$ and cluster vector $\left| Y_j \right\rangle$ consists of extracting the relevant amplitude from the subspace that those states form,
404+
Measuring the Hamming distance of a particular pair of input vectors $\left| x_i \right\rangle$ and cluster vector $\left| y_j \right\rangle$ consists of extracting the relevant amplitude from the subspace that those states form,
390405
this can be done using the following projection operator
391406
%
392407
\begin{align}
393-
\Pi_{i,j} = &\left| X_i \rangle\langle X_i \right| \otimes \left| Y_j \rangle\langle Y_j \right| \otimes I .
408+
\Pi_{i,j} = &\left| x_i \rangle\langle x_i \right| \otimes \left| y_j \rangle\langle y_j \right| \otimes I .
394409
\end{align}
395410
%
396411
Using the above projection operator, the subspace of the Hilbert space formed by a particular pair of input and cluster vectors can be traced out as
@@ -407,7 +422,7 @@ \subsection{Optimized quantum scheme for Hamming distance calculation}
407422
\end{align}
408423
%
409424
In order to reduce noise we average the measurement results over different states of the ancilla qubit,
410-
thus the measured Hamming distance between the input vector $\left| X_i \right\rangle$ and cluster vector $\left| Y_j \right\rangle$ is
425+
thus the measured Hamming distance between the input vector $\left| x_i \right\rangle$ and cluster vector $\left| y_j \right\rangle$ is
411426
%
412427
\begin{align}
413428
d_{i,j}^H & \propto 1 - \frac{1}{2}(a_0(x_i,y_j) + (1-a_1(x_i,y_j))) .

0 commit comments

Comments
 (0)