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
{{ message }}
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
We now introduce an optimized algorithm for calculating the matrix of Hamming distances \cite{trugenberger2001} between a sample vector and all cluster vectors at once.
205
-
This allows for a simple encoding of the classical information into a quantum register.
206
-
Initially we have two registers each with $n$ qubits in that we encode our set of binary vectors defined as
204
+
We now introduce an optimized algorithm for calculating the matrix of Hamming distances \cite{trugenberger2001} between a sample vector and all cluster vectors at once. This allows for a simple encoding of the classical information into a quantum register.
205
+
206
+
The overall procedure involves two registers of $n$ qubits each, denoted $\left| X \right\rangle$ and $\left| Y \right\rangle$, along with a single auxiliary qubit $\left| a \right\rangle$. During entire processing, the $\left| Y \right\rangle$ is used to store the cluster states, then at the beginning and at the end of the processing the $\left| X \right\rangle$ register stores the input vectors, while during the processing it stores the differences between input vectors and cluster states.
207
+
208
+
Now for this demonstration let us assume we have $k$ input vectors and $l$ cluster states. The $i$th input vector and $j$th cluster vector are respectively denoted as $\left| x_i \right\rangle$ and $\left| y_j \right\rangle$.
209
+
210
+
The registers $\left| X \right\rangle$ and $\left| Y \right\rangle$ will properly store input vectors and cluster vectors if initialized as follows.
where $\left| a \right\rangle$ is an auxiliary qubit in the state $\left| 0\right\rangle$ initially.
227
230
228
-
We then apply a CNOT gate between $\left| X \right\rangle$ and $\left| Y \right\rangle$
231
+
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$
229
232
230
233
\begin{equation}
231
234
\left| \psi_1 \right\rangle =
232
235
\mathrm{CNOT(Y,X)\left| \psi_0 \right\rangle} =
233
-
\sum\limits_{i, j}^{k}
236
+
\frac{1}{\sqrt{kl}} \sum\limits_{i, j}^{k}
234
237
\left| d^1_{ij}, \dots, d^n_{ij} \right\rangle
235
238
\left| y^1_j, \dots, y^n_j \right\rangle
236
239
\left| 0 \right\rangle
237
240
\end{equation}
238
241
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.
239
242
240
-
In the result, we encoded information about pairwise different qubits in $\{X\}$ and $\{Y\}$ into register $\left| X \right\rangle$.
243
+
In the result, at this stage of the computation the $\left| X \right\rangle$ no longer stores the input vectors, instead it stores the information about pairwise different qubits between the input vector $\{X\}$ and cluster vector $\{Y\}$.
241
244
242
245
243
-
After that we transfer information about distance between sample state and cluster state into the amplitude of the superposed state.
244
-
In order to make that we apply Hadamard gate on auxiliary qubit, then control phase gate on $\left| Xa \right\rangle$,
246
+
The next stage, for each pair $\{X\}$ and $\{Y\}$, an accumulated information of all the differences is projected into the amplitude of the superposed state. this is achieved by applying the Hadamard gate on auxiliary qubit, then control phase gate on $\left| Xa \right\rangle$,
Then we return to our initial basis for register $\left| X \right\rangle$ with applying the pairwise CNOT gates:
321
+
This completed the stage of projecting the differences between pairs of $\{X\}$ and $\{Y\}$ onto the amplitude of the auxiliary qubit. The process is done in the $x$-basis, which explains the surrounding Hadamard gates. There are two possible measurement outcomes of the auxiliary qubit, each pair of $\{X\}$ and $\{Y\}$ forms a subspace of the Hilbert space, the controlled phase gate ensures to change amplitudes of those outcomes within this subspace depending on how different the spin configurations between $\{X\}$ and $\{Y\}$ are.
322
+
323
+
At this stage, the information of differences between pairs of $\{X\}$ and $\{Y\}$ is no longer relevant, thus we return to our initial basis for register $\left| X \right\rangle$ by applying the pairwise CNOT gates:
In the result we have the Hamming distances encoded into the amplitudes of the final state.
338
-
After getting statistics of the measurement outcomes we can produce the distance matrix between two data sets of binary vectors (Fig.~\ref{fig:distance_matrix}).
339
-
In this case, a biggest amplitude in measurement result coincide to a smallest Hamming distance when the measurement result of the auxiliary qubit is 0
340
-
and we have the inverse relationship when measurement result on the auxiliary qubit is 1.
341
-
In order to reduce noise we average measurement results over different states of the auxiliary qubit as $a_0(x_i,y_j) + (1-a_1(x_i,y_j))$
342
-
where $a_0(x_i,y_j)$ and $a_1(x_i,y_j)$ are amplitudes for the measurement results $\left| x_i \right\rangle\left| y_j \right\rangle\left| 0\right\rangle_a$ and $\left| x_i \right\rangle\left| y_j \right\rangle\left| 0\right\rangle_a$ respectively.
343
-
In comparison with the circuits for Hamming distance calculations proposed previously \cite{trugenberger2001},
344
-
our method allows one to reduce number of gates in the circuit (at least in $2n$ one-qubit NOT gates,
345
-
depends on actual realization control phase gate in a quantum register on the hardware level),
346
-
reconstruct all distance matrix at once and can be implemented with high fidelity on current quantum devices.
341
+
This made $\{X\}$ store input vectors again, just like at the initial stage, however it preserved the amplitudes of the auxiliary qubit which are proportional to how different each pairs of $\{X\}$ and $\{Y\}$ are.
342
+
343
+
In the result we have the Hamming distances encoded into the amplitudes of the final state. After getting statistics of the measurement outcomes we can produce the distance matrix between two data sets of binary vectors (Fig.~\ref{fig:distance_matrix}). In this case, a biggest amplitude in measurement result coincide to a smallest Hamming distance when the measurement result of the auxiliary qubit is 0 and we have the inverse relationship when measurement result on the auxiliary qubit is 1.
344
+
345
+
Measuring the Hamming distance of a particular pair of input vector $\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, this can be done using the following projector operator.
Using the above projection operator, the subspace of the Hilbert space formed by particular pair of input vector and cluster vector can be traced out as follows.
In order to reduce noise we average measurement results over different states of the auxiliary qubit, thus the measured Hamming distance between the input vector $\left| X_i \right\rangle$ and cluster vector $\left| Y_j \right\rangle$ takes the following form.
The Hamming distance measured in this way is contained $0\leq d_{i,j}^H \leq1$, where intuitively, $0$ would indicate $x_i$ are $y_j$ identical and $1$ would mean they are completely opposite in terms of their pairwise binary coordinates.
371
+
372
+
In comparison with the circuits for Hamming distance calculations proposed previously \cite{trugenberger2001}, our method allows one to reduce number of gates in the circuit (at least in $2n$ one-qubit NOT gates, depends on actual realization control phase gate in a quantum register on the hardware level), reconstruct all distance matrix at once and can be implemented with high fidelity on current quantum devices.
347
373
348
374
% Please , add comparison of complexities in number of gates for realization between our scheme and previously proposed schemes (one qubit and two qubit separately)
0 commit comments