Skip to main content
. 2022 Feb 3;12:1851. doi: 10.1038/s41598-022-05971-9

Figure 2.

Figure 2

Quantum circuit computes the real part of the inner product u|v. The Hadamard gate puts the ancilla qubit (q0) into uniform superposition. A single-controlled unitary gate entangles the exited state of the ancilla qubit with the training data state vector (u=Uq1q2q3). The X gate flips the ancilla qubit. Another single unitary controlled gate entangles the state vector of the test data (v=Vq1q2q3) with the excited state of the ancilla qubit. A second X gate flips the ancilla qubit. The Hadamard gate on the ancilla qubit interferences train and test data state vectors. The ancilla qubit is measured using a Pauli-Z gate. The real value of u|v is estimated from Eq. (9). The measurement gate is done by a Pauli-Z gate and Z=100-1.