Chris Pollett >
Students > [Bio] [Del1] [Del2] [Del3] |
Del 3: Simulating quantum circuit with unbounded fan-out for value gate1 Program DescriptionThis program performs a linear value gate calculation. Given n qubits |x> and value m, the program constructs a quantum circuit with fan-out, and then evaluates the circuit. The idea for constructing such a circuit can be found in [S02]. 2 Quantum ComputationQuantum mechanics is a mathematical framework for the development of physical theories. In this section, we will review some important concepts of quantum mechanics, for details, see the textbook of quantum computation [NC00].
3 Algorithms for SimulationIn this section, we will briefly review the main results of the basic algorithm, which is used to construct the circuit implemented in this program, for details, see [S02]. In forthcoming circuits, we will need the following tools: quantum fan-out operation, parallelization method, quantum Hadamard transform, and increment operation. 3.1 Quantum fan-out operationNotice that because of the no-cloning theorem, quantum circuits cannot contain a naive quantum counterpart of the classical fan-out operation performing |s>|0>⊗ n --> |s>⊗ n+1 (3.1) for a general superposition state |s>. However, a modified quantum fan-out operation can be defined. It performs exactly (3.1) for each computational basis state and the effect on superposition states is determined by linearity. The quantum fan-out operation can also be regarded as a sequence of controlled NOT operations sharing the source qubit. Define a quantum fan-out operation on source qubit |s> and n target qubits |tk> performs |s>⊗k=1n|tk> --> |s>⊗k=1n|tk ⊕ s> 3.2 Parallelization methodHaving the above quantum fan-out operator, now we are able to perform a more general task: an arbitrary number of (possibly controlled) commuting operations operating on the same qubits can be performed at the same time in the model of quantum circuits with unbounded fan-out. First, if some operators commute, then they are all diagonal in the same basis. Second, a diagonal unitary operator consists just of phase shifts, because every coefficient in the diagonal is a complex unit. Furthermore, applying multiple phase shifts on an individual qubit can be parallelized as following:
This method can be readily generalized from one qubit to a set of qubits by copying all target qubits using the fan-out operation after basis change. Other tricks are similar to one qubit case. 3.3 Quantum Hadamard transformQuantum Fourier Transform (QFT) is one of the main tools of quantum computing. It is a quantum equivalent of the classical Fourier Transform, but it operates on quantum amplitudes of superposition states instead of an array of numbers. For detail about QFT, see [NC00]. The main trick used in this algorithm is replacing QFT by Hadamard transform. The Hadamard transform Hn on n qubits is the following operator (written in the computational basis): Hn = 1/2n/2 ⊗j=02n-1|y> ⊗j=02n-1(-1)y*x<x|, where y*x is the bitwise scalar product. A useful property of the Hadamard transform is Hn = H⊗n. 3.4 Increment operationAn increment operator P on n qubits is an operator mapping each computational basis state |x> to |x+1 mod 2n>. P is diagonal in the Fourier basis and, in this basis, can be implemented exactly by a depth 1 quantum circuit. Define operator D = FPF†, that is the increment in Fourier basis. Define a rotation operator about the z-axis by angle θ by Rz(θ) = |0><0| + eiθ|1><1|. Then for every k ∈ {1, 2, ..., n}, Dk = Rz(π / 2n-k)⊗ Dk-1. The 0-qubit operator D0 is considered to be 1. 3.5 Value gateHaving all these tools, a circuit for value gate with unbounded fan-out can be constructed as shown in Figure 1. Figure 1 A circuit for value gate 4 Design and ImplementationOne of the most challenging parts in implementing this algorithm is to understand substantial mathematics involved in the algorithm and quantum computation. It took me a long time to figure out the matrix for each quantum gate involved in this circuit. 4.1 Matrix designFrom an implementation view, four types of layers are included in Figure 1: Permutation layer, Hadamard layer, Fan-out layer, and Increment layer. According to this consideration, from left to right, we first apply Hadamard layer to change the basis of the input vector. Then we apply permutation layer to change the order of input line. Then, apply fan-out layer, after this, we apply permutation layer again to change the order back, and apply another permutation layer to give an order that needed by applying increment layer. Then, by applying controlled increment layer on Hadamard basis, we can calculate if the number of inputs that is on is equal to a value m. We again applying permutation, fan-out, permutation, and Hadamard layer respectively to change the vector back to computational basis and eliminate ancilla qubits. Each layer can be represented as a matrix. This matrix comes from the tensor-product of sub-matrices. The entire circuit can also be represented as a matrix, which is the product of all layers. A matrix representation for the Hadamard layer (we call it H_layer) is straightforward. H_layer = I1 ⊗ ... ⊗ In ⊗ H⊗ (n+1)*p. Next we will explain matrix representation for other layers.
4.2 Program organizationIn implementation, we designed four classes: Complex number class, Matrix class, Gate class and Value gate class. In Complex number class, we define complex number and its operations. In Matrix class, we define matrix and matrix operations, such as addition, multiplication, transpose, tensor-product, and Hermitian-conjugate. In Gate class, we define a base gate, and set matrix for identity gate, Hadamard gate, fan-out gate, flip(permutation) gate, and controlled increment gate. Finally, in Value gate class, we set up quantum circuit for value gate and evaluate the circuit to output result. Figure 6 shows a class organization.
Figure 6 Class diagram 5 TestWe tested on one qubit case. According to the algorithm, if the value gate is satisfied, that is, number of inputs that is on equal to the value m, then the register, say |Z> is in computational basis state |0>. Otherwise, register |Z> is in a general superposition state. By doing a measurement <Z|Z>, we get a output value, we then negate this value to output the result. Table 1 shows test result on one qubit case. In this table, we see that if value gate is satisfied, program output 1, otherwise 0.
Table 1 Test result on one qubit case 6 Limitation of the ImplementationCurrently, our program is an initial implementation. For now, both space complexity and time complexity are high. Give n qubits, the space and the time complexity for this implementation is O(2nlog(n)). So far, we know that this algorithm is in PSPACE, because BQP lies somewhere between P and PSPACE [NC00], see Figure 7.
Because of the exponential complexity of our current implementation, we are not able to evaluate large number of qubits. However, it does give us the insight of how the quantum algorithm works. Currently, we are actively exploring ways of reducing both space and time complexity and are making good progress. Reference:[S02] R. Spalek. Quantum Circuits with Unbounded Fan-out. Submited to STACS 2003 v2. [NC00] Quantum Computation and Quantum Information. M.Nielson and I.Chuang. Cambridge. 2000. |