AMPLITUDE AMPLIFICATION
Amplitude amplification is a tool used in quantum computing to convert inaccessible phase differences within a quantum processing unit (QPU) register into readable magnitude differences. It is a simple, efficient, and powerful tool that can be used extensively. It is used to solve certain computational problems more efficiently than classical algorithms. The technique works by amplifying the amplitude of target states while suppressing the amplitude of non-target states. This is done by applying a series of quantum gates to the input state, resulting in a superposition of the original state and its conjugate. The amplitudes of the target and non-target states are altered accordingly. The technique can solve various problems, including searching an unsorted database and computing the period of an unknown function. It is an essential tool for quantum computing, as it dramatically reduces the time complexity of specific algorithms.
The code below is written with OPENQASM and can be run on IBM Q composer.
OPENQASM 2.0;
include "qelib1.inc";
qreg reg[4];
qreg scratch[1];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[2];
x reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[2];
x reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[2];
x reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[2];
x reg[3];
barrier reg[0],reg[1],reg[2],reg[3],scratch[0];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
ccx reg[0],reg[1],scratch[0];
h reg[3];
ccx scratch[0],reg[2],reg[3];
h reg[3];
ccx reg[0],reg[1],scratch[0];
x reg[0];
x reg[1];
x reg[2];
x reg[3];
h reg[0];
h reg[1];
h reg[2];
h reg[3];
Suppose we have a four-qubit quantum processing unit (QPU) register containing one of three distinct quantum states (X, Y, or Z), but we don’t know which one. Each of these states has a different marked-value or phase filliped, but since all of the values in the register have the same magnitude, reading the QPU register in any of these states will return an evenly distributed random number, which does not reveal which of the three states we started with. Furthermore, this kind of read will destroy the phase information stored in the register. Fortunately, with a single QPU routine, we can reveal the hidden phase information. This process is known as mirroring and is used as a technique in the Grover search algorithm. To observe the action of this technique, you can run the sample code.