Interfacing External Quantum Devices to a Universal Quantum Computer

We present a scheme to use external quantum devices using the universal quantum computer previously constructed. We thereby show how the universal quantum computer can utilize networked quantum information resources to carry out local computations. Such information may come from specialized quantum devices or even from remote universal quantum computers. We show how to accomplish this by devising universal quantum computer programs that implement well known oracle based quantum algorithms, namely the Deutsch, Deutsch-Jozsa, and the Grover algorithms using external black-box quantum oracle devices. In the process, we demonstrate a method to map existing quantum algorithms onto the universal quantum computer.


Introduction
Quantum networks which connect quantum systems and can transmit quantum information have been extensively discussed [1]. Quantum connectivity provides a means of overcoming sizescaling and error-correction problems, and has significant advantages over classical connectivity. Furthermore, networks of quantum computers have also been proposed [2] where information can be exchanged between nodes via quantum and classical channels. A general question arises as to whether and how such quantum computers can communicate and exchange information. In the simplest case a quantum computer may download data sets from other nodes over the quantum network, but in more complex cases use the network to call subroutines, or concatenate programs from other quantum computers.
It is well known that classical principles do not necessarily apply in the realm of quantum mechanics. The no-cloning theorem (see [3] for example) is a well-known example of this. In the field of quantum computing, the ability to halt a programmable quantum computer was such an example. The original Universal Quantum Turing Machine proposal [4] made the tacit assumption that a quantum turing machine could be halted in a classical manner. This turned out to be problematic (see [5] for a discussion of the issues associated with the original proposal) due to properties of quantum mechanics. Thus, it is imperative to formally show whether a classical solution or property is applicable (or even relevant) in the realm of quantum mechanics. Assuming that a classical solution to a problem directly applies to a quantum mechanical system is prone to run into potential complications.
We address here the question of how a universal quantum computer can access an external oracle, which may be regarded as a ''black box'' quantum device, possibly over a quantum network but in any case as a separate and external quantum system to the universal quantum computer itself. In fact, the oracle may be a program running on a remote universal quantum computer. It should be noted that this is a different problem from that of implementing an oracle ''program'' on a universal quantum computer. This is of course possible by virtue of the fact that the computer is universal. Hence, if such a program exists, it can be implemented and executed on a universal quantum computer. Strictly speaking, however, the ability to utilize external quantum devices over a network connection is a different problem because such devices are external to the universal quantum computer itself.
Classically, the ability to access devices on a network is a wellknown problem with well-known solutions. However, as stated earlier, we cannot assume that this is necessarily the case for a quantum computer accessing quantum devices on a quantum network. Our aim is to explicitly show that accessing external quantum devices with a universal quantum computer is indeed possible by devising universal quantum computer programs that implement well-known oracle based quantum algorithms, namely the Deutsch, Deutsch-Jozsa, and the Grover algorithms using external black-box quantum oracle devices.
In [5] we constructed a programmable universal quantum computer UQC that is universal in the sense that it can emulate any classical Turing machine and can approximate any unitary operation to any desired accuracy. It is programmable in the sense that the machine's operations are specified using a sequence of instructions in the same way as for classical computers. UQC also supports conditional branching and hence conditional execution, a feature that is not directly possible in the quantum gate array circuit framework. Moreover, UQC uses a halting scheme that allows for valid program concatenation, thus resolving issues with the original Universal Quantum Turing Machine (UQTM) proposed by Deutsch [4].
In order to use information from a quantum network in UQC programs, we need to devise a means of enabling UQC programs to access such remote information and use that information for local computations. We assume that remote quantum nodes exist and treat them as black boxes without any assumptions as to their internal structure or operational details. Without loss of generality, we assume that such devices accept a finite number of input qubits and generate a finite number of output qubits. The input and output qubits may be shared, which is the case if the remote device functions in such a way as to alter the input qubits based on its function. We also assume, without loss of generality, that quantum network nodes have an ''enable'' qubit, jenT, that controls when an access is to begin, in order to let the device know when the input data has been prepared and is valid. We further assume, without loss of generality, that the nodes of the network generate their output data in less time than the time associated with a single iteration of UQC. If the query time were longer than a single iteration of UQC or were data-dependent, one could simply write the UQC program to wait for the appropriate number of cycles before using the result of the network access. Alternatively, the nodes could provide an ''access completed'' status flag qubit such that the UQC program could poll this status flag qubit before using the result of a network access.

Results
Recall from [5] that UQC consists of a memory tape M with an infinite number of qubits, of which only a finite portion is ever used, and a processor that contains observables that play the roles of several registers, including a data register D, a program counter register P, a scratch qubit s, and the halt qubit h. The processor executes programs stored on the memory tape using data that is also stored on the memory tape. A program of UQC consists of a sequence of qubits whose states encode instructions of the instruction set defined in [5] and reproduced in Table 1 at the end of this paper.
The single qubit operations H and T act on the qubit at tape location M(D), denoted jMT D , and the two qubit operations SWAP and NAND act on jMT D and the scratch qubit jsT, the latter being used as the control qubit for the NAND operation.
The instruction set includes a set of operations that can approximate any unitary operation to any desired accuracy. Thus, it is quantum computationally universal. In [5] we constructed a UQC program that can compute the NAND function, thereby showing that the machine can compute any classically computable function. Because of UQC's universality, any algorithm that can be implemented in the quantum gate array framework can be mapped to an equivalent UQC program by virtue of the fact that gate array circuits can be decomposed into circuits of gates with the same universal set of unitary operations fH,T,CNOTg that are implemented in the UQC instruction set. Each of the qubits in a quantum circuit (i.e. lines connecting gates) can be mapped to a suitable memory tape data qubit and each of the unitary operations (i.e. quantum gates) can be mapped to a suitable UQC subroutine. It is possible therefore to map quantum gate array implementations of algorithms such as the quantum Fourier transform, quantum phase estimation, quantum order finding, quantum factoring discussed in [6] (Chapter 5) onto UQC.

Accessing Networked Quantum Resources With UQC
Modifying UQC to use networked quantum devices, then, is a matter of connecting the qubits comprising the interface (input, output, enable, and optionally access complete) qubits of those devices to a finite subset of the data portion of M, which is the quantum analog of a classical computer's memory-mapped I/O and allows UQC programs to access remote devices using the M qubits that are connected to those devices. The UQC programs prepare the appropriate input data qubits, set the corresponding access enable qubits to perform an access, and utilize the corresponding output data qubits of M. It should be noted that a remote quantum device could be another instance of UQC which would enable distributed quantum computing. However, the scheme to access data from remote devices, be they simple devices or full-fledged quantum computers, would work in the same way.

Primitive Programs
In [5] we defined several primitive programs and subroutines that serve as building blocks for devising and analyzing more complicated and useful programs. We reproduce here only those that we specifically require for constructing the algorithms that are the focus of this work. By considering the quantum gate array framework implementations of the algorithms, we identify that we need programs that perform the operations H, s x , and CNOT. We also need to swap qubits for several operations such as enabling or disabling the remote networked quantum device, and the ability to address individual qubits on the memory tape to perform operations on them. Finally, we need a primitive program to halt the overall program.
In the equations that follow, superscripts on programs denote the operation specified by the program and subscripts indicate the qubits on which the program specifies the processor to operate upon. For notational simplicity, jP h T denotes the program that halts UQC, i.e. jP h Td ef jh?1TjNOPT.
The first set of primitive programs, fjD zi T,jD i T,jS i,s T,jS i,j Tg, is a subset of those defined in [5]: 1. jD zi T: Increment D by i,  Recall from the discussion of U EX in [5], that we precede the D?0 instruction with a Dz1 instruction to ensure that Dw0 when the D?0 instruction is executed.
3. jS i,s T: Swap data qubits D(i) and s, 4. jS i,j T: Swap data qubits D(i) and D(j), jS i,j Td ef jS 5i{1,s TjS 5j{1,s TjS 5i{1,s T: We also describe the set of programs fjP H i T,jP H i,j T,jP C i,j Tg which apply the single-and multiple-qubit H and CNOT operations on arbitrary qubits on the memory tape, where i and j[Z: 1. jP H i T: Apply H to data qubit D(i), 2. jP H i,j T: Apply H to data qubits D(i : j), where i §j, One could implement this program using a loop but that would require first implementing binary addition of M qubits. Binary addition is possible because one can implement a binary adder such as a Carry Lookahead Adder (CLA) [7] using the NAND program that we defined in [5]. However, since we are only interested in a polynomial order (in the number of qubits) multiple qubit Hadamard transformation program, we define jP H i,j T as a sequential ''unrolled'' loop program.
3. jP C i,j T: Apply CNOT to data qubits D(i) and D(j) with D(i) as the control qubit, Using the primitive programs defined above, we define jP X i T as the program that applies the s x (X) operation on data qubit i[Z z . Noting that a CNOT operation with the control qubit in the j1T state is equivalent to the X operation, we deduce the equivalence where the subscript j1T denotes that some suitable data qubit on the memory tape has been prepared in the state j1T. Similarly, we define jP Z i T as the program that applies the s z (Z) operation on data qubit i[Z z . Noting that HXH~Z, we deduce Finally, we define a program jP CZ i,j T that conditionally applies the Z operation on data qubit i[Z z and data qubit j[Z z . Since CNOT is the conditional X operation, we have

UQC Algorithms Using Networked Quantum Oracle Devices
With the notable exception of Shor's factorization algorithm [8], several well known quantum algorithms that achieve a speedup over their fastest known classical counterparts rely on the use of an oracle, the best known examples being the Deutsch, Deutsch-Jozsa, and Grover algorithms (see Nielsen and Chuang [6], for example). The Deutsch algorithm can determine a global property of a function f (x), namely f (0)+f (1) Grover's algorithm [9] can find a marked item in an unstructured database of N elements in O( ffiffiffiffi ffi N p ) operations whereas the fastest classical algorithm requires O(N) operations. Thus, these quantum algorithms all achieve at least a quadratic speedup over their classical counterparts.
These algorithms are well suited to illustrate the use of networked quantum resources with the UQC because they rely on black-box quantum devices that generate some output based on the given input. They thus serve as prototypical examples of a networked quantum node, whose internal implementation details are unknown; only the interface protocol need be known. Here, we assume the simplest protocol, which is that the output is valid one ''clock cycle'' after making a request.
Deutsch and Deutsch-Jozsa Algorithms on UQC. We now illustrate the use of a networked quantum device in a UQC program by first implementing the simplest known oracle based quantum algorithm, Deutsch's algorithm. The Deutsch oracle works as follows: where f is some function and jenT denotes the oracle query enable flag. The memory tape is prepared with D(0)~j0T and D(1)~j1T where D(0) and D(1) take the roles of x and y, respectively. We assume without loss of generality that D(2) takes the role of jenT and is prepared as j0T, and D(3) is initially prepared as j1T.
The program that executes the Deutsch algorithm is where jP H 1,0 T applies the Hadamard transform to the data qubits corresponding to x and y. jS 2,3 TjS 2,3 T swap qubits D(2) and D(3) thereby setting the oracle's jenT qubit (recall that D(2) is connected to jenT and that D(2)~j0T and D(3)~j1T initially) for a single UQC cycle and then clears it, returning the state of D(3 : 2) back to the original state. At this point, the oracle has generated the output state jD(0),D(0)+D(1)T. jP H 0 T then applies the Hadamard transform to the x output of the oracle and jP h T halts the program thus yielding the following on the memory tape: ffiffi ffi 2 p

:
Measuring D(0) yields the result that we were interested in, f (0)+f (1). This is a specific mapping of the gate array implementation of the algorithm (see [6] Figure 1.19, for example) onto the instruction set of UQC.
We can similarly implement the Deutsch-Jozsa algorithm by mapping a gate array implementation such as the one shown in [6], Figure 1.20. In this case, data qubits D(0 : n{1) take the role of x, D(n) takes the role of y, and we use D(nz1) as the jenT qubit. As before, D(0 : n{1) are prepared in the j0T state, D(n) is prepared in the j1T state, D(nz1) is prepared in the j0T state and D(nz2) is prepared in the j1T state. The Deutsch-Jozsa oracle works like the Deutsch oracle with the only difference being that x is n qubits wide. The resulting UQC program that computes the Deutsch-Jozsa algorithm is therefore which is again a direct mapping of the gate array implementation onto the UQC instruction set. Grover's Algorithm on UQC. We now use the techniques developed in the previous section to implement the Grover unstructured database search algorithm. We assume that the database has only one marked solution as can be determined by using the quantum counting algorithm (see [6] Chapter 6, for example). We denote the query data qubits as jqT and the query enable flag as jenT. The Grover oracle works as follows: if q is a solution to the search problem and f (q)~0 otherwise. More concisely, the oracle performs the unitary transformation where jmT denotes the marked solution. In other words, the oracle flips the phase of the solution state but leaves non-solution states unchanged. Grover's algorithm prepares an initial query state as the equal superposition of all elements in the database, followed by and denotes the equal superposition of all database elements. Thus, the first step in the program is to create a superposition of all database items in D(n : 1) where D(i)~M(5i{1), i[Z z , as the first query input. This is accomplished by the multiple qubit Hadamard primitive program jP H n,1 T defined in Eq. (6). The next step is to perform an oracle query. The following program performs an oracle call with query data prepared in D(n : 1): where D(nz1) is used as the oracle query enable qubit and D(nz2) is initialized to j1T. D(nz1) is assumed to be initialized to j0T (i.e. the oracle query data is disabled at start-up). This program simply sets the query enable qubit for a single UQC cycle and then clears it, returning the state of D(nz2 : nz1) back to the original state. Thus, upon running jP m T, the result of the oracle call is in D(n : 1), i.e. this program is functionally equivalent to U m . The next step is to implement a program jP s T that performs the reflection of a given state about the superposition of all basis states jsT. This requires a conditional-phase operation that works as follows: where jxT is n qubits wide. Up to a global phase, this can be implemented using the following procedure: 1. Apply the s x operation to all n qubits. 2. Apply a controlled-Z operation using n{1 qubits as control qubits and the remaining qubit as the data qubit.
3. Apply the s x operation to all n qubits. We can construct a multiple qubit controlled-Z program jP CZ i,j,k T where qubits i through j are the control qubits and qubit k is the data qubit, with the jP CZ i,j T program defined in Eq. (10) and the Toffoli program jP Toff i,j,k T that we defined in [5] using a procedure analogous to that described in [6], Chapter 4. Armed with jP CZ i,j,k T, we construct jP s T as follows: jP s Td ef jP H n,1 TjP X n,1 TjP CZ 2,n,1 TjP X n,1 TjP H n,1 T: It can be readily verified that this is functionally equivalent to the 2jsTSsj{I operator. Thus, a program that performs a single Grover iteration is jP G Td ef jP m TjP s T: In summary, the complete program to search a database of 2 n items with a single marked solution is where N G~p 4 ffiffiffiffi ffi 2 n p is the number of Grover iterations that can be pre-computed based on the database size, or that UQC can compute from the database size using a classical algorithm. Upon execution of jGT, a measurement of D(n : 1) reveals the solution jmT. Because there are no oracle queries associated with jP H n,1 T and jP h T, we immediately identify the complexity (as a measure of the number of oracle queries) of jGT as N G . As is to be expected, this complexity is identical to the number of oracle queries associated with an implementation in the gate array framework.

Discussion
We have presented a scheme to allow universal quantum computers to utilize networked quantum resources. We have illustrated the scheme by devising UQC programs that implement the well-known oracle based Deutsch, Deutsch-Jozsa, and Grover algorithms using networked quantum oracle devices. We have therefore demonstrated that universal quantum computers can access networked quantum devices in a way analogous to that by which classical computers access network resources. The method that we used to map quantum algorithms onto UQC can be applied to implement and analyze other quantum algorithms.