General structures of reversible and quantum gates
The most general structure (in matrix form) of a single-qubit gate is presented. Subsequently, used that to obtain a set of conditions for testing (a) whether a given 2-qubit gate is genuinely a 2-qubit gate, i.e., not decomposable into two single qubit gates and (b) whether a given single qubit gate is self-inverse? Relevance of the results reported here is discussed in the context of optimization of reversible and quantum circuits, especially for the optimization of quantum cost. A systematic procedure is developed for the identification of the non-decomposable 2-qubit gates. Such a non-decomposable 2-qubit gate along with all possible single qubit gates form a universal quantum gate library. Further, some possible applications of the present work are also discussed.
Keywords: quantum gates, reversible gates, circuit optimization, non-decomposable 2-qubit gates
The use of quantum resources provides an enhancement in the performance of certain tasks in comparison to their classical counterparts. To be specific, a quantum computer can perform factorization  and unsorted database search  with a speed not achievable by its classical counterpart, and quantum cryptography can provide unconditional security , a desirable feature of secure communication that cannot be achieved by any classical protocol. These facts lead to a simple question, how are these tasks performed in the quantum world? A simple answer would be by exploiting quantum superposition through suitable quantum operations which may be viewed as quantum gates. It is also worth noting that all the operations, besides measurement and noise, are unitary in nature. Therefore, quantum operations (except quantum measurement and Kraus operators representing various noise models) are essentially reversible in nature. In what follows, we refer to these unitary quantum operators that actually describe evolution of a quantum state and map the initial states to final states as quantum gates and analyze their properties.
Before, we proceed further, we would like to note that all quantum gates are reversible, but they are usually referred to as quantum gates, whereas by a reversible gate we usually mean a classical reversible gate which is also described by a unitary operation (. This is so because unitarity ensures reversibility through the condition or in other words, unitarity ensures the existence of for every unitary operation and thus establishes reversibility. Consequently, the basic structure of classical reversible and quantum gates are the same, In fact, and many other gates work in both classical and quantum domain, they are described by the same matrices, but there is a small difference as far as the acceptable input states are concerned. A classical reversible gate cannot accept superposition states as input, whereas a quantum gate can. Specially, a reversible gate should not accept a superposition state as input at the controlled bit. For example, if a gate accepts a superposition state in the controlled bit/qubit then the output will be an entangled state, which has no classical analogue and which cannot exist in the classical world. Thus, a classical reversible gate and a quantum gate would have the same mathematical form (both being described by unitary matrices), whether the quantum gate will have a classical counterpart or not would depend on the input-output relation; specifically, on whether the gate produces classically acceptable outputs for valid classical inputs. As quantum gates are more general and classical reversible gates form only a subclass of them, in what follows our discussion will be focused on the quantum gates (unless otherwise stated) only, and we will mostly focus on the structure of the unitary operators (gates) without providing much attention to whether a particular gate has a classical counterpart or not. However, the analysis is valid in general for both quantum and reversible gates and may be useful in optimizing both quantum and reversible circuits.
We have already noted that quantum gates are more general and classical reversible gates are special cases of them. However, the notion of quantum computer in general and quantum Turing machine in particular  has originated from the idea of reversible Turing machine , which was proposed to perform computation in reversible manner so that heat loss due to erasure of information predicted by Landauer’s principle  can be circumvented. Heat loss is a major issue in today’s VLSI technology. This is so because in accordance with Moore’s law , the number of transistors per unit area is doubling in every 18 months, and proportionately length of interconnecting wires and energy losses through those wires are also increasing. In case, we can make a room temperature superconducting material, we will be able to avoid the type of loss that happens through these wires. However, in the traditional irreversible computing, some losses of energy would still happen as it is implemented with irreversible logic gates, like AND, NOR, NAND all of which map a 2-bit input into a 1-bit output and thus causes an energy loss amounting to at least . This advantage of reversible computing and the computational speed up achieved by the quantum computer have motivated scientists to design and optimize reversible and quantum circuits for various purposes [for a set of interesting reversible circuits see [8, 9], some interesting reversible circuits and their optimization are reported in [10, 11, 12], whereas a set of important quantum circuits can be found at [13, 14, 15, 16, 17, 18, 19]]. All these circuits are designed using gates represented by unitary operations, but the general structure of those unitary operations is not investigated until today. Motivated by this fact here we report some observations on the general structures of the unitary gates and also discuss how to exploit those observations to perform optimization of the reversible/quantum circuits. To be precise, we would first describe the general structure of single qubit gates and using that we will obtain a set of requirements to be satisfied by a 2-qubit decomposable gate (i.e., a 2-qubit gate which can be expressed as tensor product of two single qubit gates). Further, we would also formulate a method to obtain those two single qubit gates once it is ensured that the given 2-qubit gate is decomposable. Finally, some applications of the decomposability tests designed in this paper are discussed with specific attention toward a physical problem involving different type of beam-splitters and the problems related to optimization of various types of cost metrics (such as gate count or circuit complexity, depth and width of a circuit, quantum cost) associated with quantum circuits.
The rest of the paper is organized as follows. In Sec. 2, we derive a general structure of single qubit gates. Using this general structure, in Sec. 3, we have obtained a general form to be possessed by the single qubit Hermitian unitary operations, which would represent self-inverse quantum gates. We further use the general structure to formulate the conditions to check whether a given 2-qubit gate is decomposable or not in Sec. 4. In Sec. 5, a method to reconstruct the decomposed single qubit operations from the given decomposable 2-qubit gate is designed. Finally, the paper is concluded in Sec. 7 after discussing some applications of the present results in Sec. 6.
2 General structure for single qubit gates
As we mentioned in the previous section, we are interested in obtaining the general structure of the unitary gates. To begin with, let us consider an arbitrary single qubit gate,
which would satisfy being unitary. Here, the first condition (i.e., gives us
while the second one (i.e., ) yields
From Eq. (2) we can easily observe that
Similarly, from Eq. (3) we obtain
In Eq. (5a), we can substitute This substitution and the use of Eqs. (4a) and (5a) would yield Similarly, using Eq. (4b) in Eq. (5a), we obtain Using these values, we can rewrite the arbitrary single qubit unitary matrix described by (1) as
where we have used the polar form of complex elements of the unitary matrix in Eq. (1). Further, using Eqs. (4c) and (5c) with values of different elements of matrix as given in Eq. (6), we obtain the same condition from both the equations, i.e.,
From which we can easily write
with being an integer. We may consider an angle in such a way that and in Eq. (1) can be written as complex conjugates of each other, which means
Interestingly, the same angle also makes and complex conjugates of each other as
It is noteworthy here that four equivalent general structures of single qubit unitary operation can be written by changing the position of negative sign among the four elements of the matrix in Eq. (10). Actually unitarity demands that one of the elements (expressed in the polar form) of the single qubit unitary operator has to have a sign opposite to that of the other three elements (say, negative sign, when the rest of the elements are with positive sign). Thus, the negative sign put in front of any of the 4 elements of the above structure of the unitary operator, would also provide a general structure of the single qubit unitary operator.
3 Hermiticity or self reversibility of single qubit gates
Hermitian matrices are the one satisfying . In case of unitary matrices, it turns out to be . Thus, if we find that a unitary matrix that represents a gate is also Hermitian, then we would be able to conclude that the gate is self inverse, too . For obtaining the general structure of self-reversible unitary operations, if we write the adjoint of in Eq. (10) as
then we can see that Hermiticity condition , would yield
By solving this set of conditions on the phase parameters, one can obtain and . Hence, the mathematical structure of a Hermitian unitary matrix (Hermitian single qubit quantum gate) is
It should be noted here that permutation of columns of unitary (10) will not change the mathematical structure of Hermitian quantum gate obtained here as the constraint equation will remain unchanged after such a permutation . For convenience, we may describe this gate as and note that the well known single qubit gates can be expressed in this notation as and whereas a phase gate is not self inverse and cannot be expressed in the above form.
4 Decomposability of a two qubit gate using the general structure of single qubit gates
In this section, we wish to formulate a method to distinguish between a set of 2-qubit gates decomposable in two single qubit gates from the genuine 2-qubit gates or non-decomposable gates. For the same, we have used obtained in the last section, given in Eq. (10), as the most general form of single qubit gates and checked the decomposability of two qubit gates. To do so, let us consider two arbitrary single qubit gates and having the following form
It is easy to write the tensor product of these two single qubit gates as
We can also consider an arbitrary matrix (which is assumed to represent a 2-qubit gate) as
and compare the coefficients of with the matrix in Eq. (13) to find the condition of separability (decomposability), the satisfaction of which for a given 2-qubit gate would mean that the given two qubit gate is not genuinely a 2-qubit gate as it can be decomposed into two single qubit gates. By comparing the elements of (13) and (14) we can observe the following conditions:
- Test 1:
- Test 2:
- Test 3:
- Test 4:
- Test 5:
Failure of any of these tests would imply the inseparability of the 2-qubit gate under consideration, which would mean that the investigated 2-qubit gate is genuinely a 2-qubit gate, i.e., the 2-qubit gate cannot be decomposed into two single qubit gates operating on each qubit, and such a 2-qubit gate may be used to construct a universal gate library in association with all the single qubit gates. This is so because it is well known that any genuine two qubit gate and set of all single qubit gates form a universal quantum gate library .
Note that to test the decomposability of a given 2-qubit gate, the 2-qubit gate is to be written in the form of matrix in Eq. (14), where to obtain we can again use the same method as was used in Eq. (8). Specifically, we may take the global phase in such a way that one of the conditions in Tests 1-5 is satisfied. In case of a decomposable 2-qubit gate all the remaining conditions should also remain valid. Without loss of generality, considering the first condition in Test 1, we can obtain where and are the first and sixteenth elements of the arbitrary 2-qubit unitary before taking a common phase out of the matrix . This global phase will be equivalent to in Eq. (13).
The present study also reveals that to check the inseparability of a given 2-qubit gate one can perform an assessment of the unitary before writing the unitary in the form of matrix given in Eq. (14). Specifically, all the diagonal elements in a decomposable 2-qubit unitary have the same modulus. Similarly, all the anti-diagonal elements in a decomposable 2-qubit unitary also have the same modulus, which is independent of the value for the diagonal elements.
Therefore, we may now summarize the conditions that ensure that a 2-qubit gate is decomposable into two single qubit gates as follows:
- Condition 1:
All the diagonal elements have the same modulus value. Even the anti-diagonal elements also have the same modulus, but not necessarily equal to the main diagonal elements. In other words, and , where are the elements of the given matrix before writing in the form of matrix of Eq. (14).
- Condition 2:
After writing the given matrix in the form of matrix of Eq. (14) all Tests 1-5 are satisfied.
Here, it is important to note that fulfillment of Condition 2 ensures that Condition 1 is also satisfied but not vice versa. Therefore, Condition 1 can be used as a primary check, while Condition 2 must be fulfilled by a decomposable 2-qubit gate.
Example: Here, as an example, we can consider the case of the controlled-unitary gate given as where in place of , we can use the general structure of unitary matrix given in Eq. (10), using which we obtain
We can easily observe from Eq. (15) that the diagonal elements do not have same modulus values so the gate is a genuine 2-qubit gate. Hence, we can easily observe that Condition 1 is violated, which gives the inseparability of the gate.
Here, we can also check that violation of Condition 1 makes sure Condition 2 is also not satisfied. Specifically, when we attempt to write this two qubit gate in the form of matrix of Eq. (14), we will have
which certainly fails Tests 1-3. Therefore, it concludes that the controlled-unitary gate cannot be decomposed into two single qubit gates. However, a special case, i.e., and becomes a decomposable operation.
5 Two single qubit gates from one tensor product gate
Once we have ensured that a 2-qubit gate is decomposable into two single qubit gates, the important task in our hands would be to obtain those two single qubit gates. In this section, we formulate a technique to do so. From Eq. (13), if we consider only the elements of the first two rows and two columns or more precisely the first block of four elements, then we obtained
Similarly, we can obtain this form for the remaining three blocks of the matrix in (13) with four elements each. Specifically, those can be written as
Further, after comparing corresponding terms with the elements of , it can be easily obtained that
Using these relations we can formulate four conditions for decomposability, which can be listed as follows
These set of conditions do not ensure the non-decomposibility of a 2-qubit gate. For example, one may consider a 2-qubit gate , which satisfies these set of conditions, but Test 2 (in Condition 2) fails concluding in the non-decomposibility of this gate. Therefore, we propose to use these results to obtain two single qubit gates once Conditions 1-2 mentioned in the previous section are fulfilled.
Therefore, to write a two qubit gate as a tensor product of two single qubit gates–if it is not a genuine two qubit gate–we can follow this prescription and obtain the two single qubits as
Note that all the terms in both these unitary operations contain square-root, which can be exploited to put a negative sign before one of the terms in both the gates. As mentioned beforehand these provide equivalent operations. In fact, even in this case, we obtain a family of s such that , which are unitary in themselves, giving the same gate on their tensor product. In what follows, we will show an example of a 2-qubit operation in optical implementation.
In this section, we aim to illustrate the possible applications of the results obtained in this work through some particular examples. To begin with we consider an example that shows that the decomposition of a polarization-dependent beam-splitter (PDBS) is not possible, but a polarization-independent beam-splitter (PIDBS) can be decomposed. Further, we have shown with the help of an explicit example that the decomposability tests developed in the present work can be used to reduce the quantum cost and gate counts of a quantum circuit.
Application 1: A physical example
As an application of the present scheme, we would like to consider the unitary operation corresponding to a PDBS , i.e.,
Here, () and () are the transmission and reflection coefficients of the PDBS for an incident photon in horizontal (vertical) polarization state, respectively. Also, and mentioned in the subscript correspond to the two input ports of the PDBS. Further, a phase change of is associated with the reflected mode. PDBS is frequently used in implementing the schemes of quantum communication and computation, and it may be viewed as the most general type of BS.
The PDBS can be checked with Conditions 1 and 2 to ensure that the PDBS is a unitary operation that corresponds to a genuine 2-qubit gate. In fact, this optical element is often used to generate entanglement. Now, consider a special case- an usual beam-splitter which is independent of polarization , i.e., and , we obtain
It is important to note here that PIDBS satisfies all the requirements (Tests 1-5) of a 2-qubit gate composed of two single qubit unitary operations. One can also reconstruct the single qubit unitary operations as follows
The relevance of the unitary operations can be understood from the input state of PDBS being , which can be viewed as , where polarization of the photon is an independent state acted upon by an Identity and the evolution of the spatial modes of input photons may be determined by a standard BS unitary operation ( here).
Application 2: Optimization of quantum circuits
The present result can be found useful in reducing quantum cost and gate counts (circuit cost) of a given quantum circuit by exploiting decomposability of 2-qubit gates, wherever possible. The minimum number of elementary gates (1 qubit and 2-qubit gates) required to accomplish a specific task is known as quantum cost [10, 23]. In fact, the use of single qubit gates in a qubit line that contains one of the qubit of a 2-qubit gate does not increase the quantum cost as the single qubit can be absorbed in the 2-qubit gate by creating a new 1-qubit gate. Look at Fig. 1 (a), it contains two 2-qubit gates and a single-qubit gate. So its gate count or circuit cost is three if we remain within the given gate library (before optimization). However, the linear quantum cost (quantum cost obtained without circuit optimization) would be two as for the determination of quantum cost no restriction on gate library is imposed and one can always construct a new 2-bit gate . This shows that single qubit gates usually do not contribute to the quantum cost. Now, we assume that we apply the results of the previous section and test the decomposability of both the 2-qubit gates present in the circuit shown in Fig. 1 (a), and our analysis revealed that the leftmost 2-qubit gate is a genuine 2-qubit gate, whereas can be decomposed as . The circuit after decomposition is shown in Fig. 1 (b). Clearly, and we may remove these gates and thus optimize the circuit as shown in Fig. 1 (c), which has a reduced circuit cost of two, and absorbing the single qubit gate in the 2-qubit gate we would obtain the nonlinear quantum cost (quantum cost obtained after optimization) as 1. Further, since there is no operation in the third line, we can say that the width of the quantum circuit is also reduced from three to two. Thus, this simple example clearly illustrates the utility of the present work (decomposability test designed here) in the optimization of quantum cost, circuit cost and circuit width. In a similar manner, one can show that this technique will be of help in optimizing quantum circuits using template matching  and other methods described in [3, 25] and references therein.
A general mathematical structure of single qubit gates is obtained by exploiting their unitary nature. As the unitary nature of operations ensures reversibility, the obtained result is applicable to classical reversible gates, too. Further, unitarity of the operations only ensures the existence of an operation (not necessarily the same) which can transform the output state back into the input state. In other words, unitarity only ensures reversibility, does not ensure self reversibility. It is known that some of the quantum gates are self-inverse, whereas the others are not. Keeping this in mind, the mathematical form of the self-inverse unitary operations is also obtained from the general structure of the single qubit gates. The restrictive conditions obtained here, indicates that there are only a few self-inverse single qubit quantum gates.
The formulated general structure is subsequently used to obtain a set of conditions using which one can easily test whether a given arbitrary 2-qubit gate is non-decomposable or decomposable into two single qubit gates. Once it is established that a given 2-qubit gate is decomposable, the important task would be to obtain the decomposed single qubit gates. Here, we have not only proposed an easy prescription for reconstructing the decomposed single qubit operations, we have also provided an interesting example related to the optical realization of a quantum gate. Specifically, we have used a genuine entangled gate for 2-qubits as PDBS, which is used frequently for entanglement generation in quantum optical implementations. Subsequently, we have shown mathematically that PDBS is not decomposable, but a polarization-independent counterpart of it becomes decomposable.
Finally, we have shown applications of the present results in the optimization of quantum circuits. Specifically, we have shown that when a 2-qubit quantum gate is decomposable, employing its decomposed single qubit counterparts can be used to reduce quantum cost, gate counts and circuit width. We conclude the paper with a hope that the present results would find wider scale applications in the synthesis and optimization of reversible and quantum circuits, and some of the circuits designed and/or optimized using the decomposability test developed here will be tested using IBM Quantum Experience, a quantum computer places in cloud  or other quantum hardwares capable of performing the task.
Acknowledgment: KT and AP thank Defense Research & Development Organization (DRDO), India for the support provided through the project number ERIP/ER/1403163/M/01/1603.
-  Shor, P. W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum com- puter. In Proc. 35th Annual Symp. on Foundations of Computer Science, (1994) Santa Fe, IEEE Computer Society Press
-  Grover, L. K.: Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett. 79, 325-328 (1997)
-  Pathak, A.: Elements of quantum computation and quantum communication. CRC Press, Boca Raton, USA (2013)
-  Deutsch, D.: Quantum theory, the Church-Turing principle and the universal quantum computer. Proc. Royal Society of London A: Mathematical, Physical and Engineering Sciences 400, 1818 (1985)
-  Bennett, C. H.: Logical reversibility of computation. IBM J. Res. Dev 17, 525-532 (1973)
-  Landauer, R.: Irreversibility and heat generation in the computing process. IBM J. Res. Dev. 5, 183 (1961)
-  Moore, G. E.: Cramming more components onto integrated circuits. Electronics 38, 114 (1965)
-  Maslov, D.: Reversible logic synthesis benchmarks page, http://webhome.cs.uvic.ca/~dmaslov/ (2017)
-  Revlib: An online resource for reversible functions and circuits, http://www.informatik.uni-bremen.de/rev_lib/index.php (2017); Also see Wille, R., Große, D., Teuber, L., Dueck, G.W., Drechsler, R.: RevLib: An online resource for reversible functions and reversible circuits. In Multiple Valued Logic, 2008. ISMVL 2008. 38th International Symposium on, 220-225 IEEE (2008)
-  Rahman, M. M., Banerjee, A., Dueck, G. W., Pathak, A.: Two-qubit quantum gates to reduce the quantum cost of reversible circuit. Multiple-Valued Logic (ISMVL), 2011 41st IEEE International Symposium. IEEE, 2011.
-  Banerjee, A., Pathak, A.: Reversible multiplier circuit. In Emerging Trends in Engineering and Technology (ICETET), 2010 3rd International Conference on, pp. 781-786. IEEE (2010)
-  Haghparast, M., Mohammadi, M., Navi, K., Eshghi, M.: Optimized reversible multiplier circuit. Journal of Circuits, Systems, and Computers 18, 311-323 (2009)
-  Shukla, C., Banerjee, A., Pathak, A.: Protocols and quantum circuits for implementing entanglement concentration in cat state, GHZ-like state and nine families of 4-qubit entangled states. Quantum Inf. Process. 14, 2077-2099 (2015)
-  Möttönen, M., Vartiainen, J.J., Bergholm, V., Salomaa, M.M.: Quantum circuits for general multiqubit gates. Phys. Rev. Lett. 93, 130502 (2004)
-  Bullock, S.S., O’Leary, D.P., Brennen, G.K.: Asymptotically optimal quantum circuits for d-level systems. Phys. Rev. Lett. 94, 230502 (2005)
-  Vidal, G., Dawson, C.M.: Universal quantum circuit for two-qubit transformations with three controlled-NOT gates. Phys. Rev. A 69, 010301 (2004)
-  Gupta, M., Pathak, A.: A scheme for distributed quantum search through simultaneous state transfer mechanism. Annalen der Physik 16, 791-797 (2007)
-  Banerjee, A., Pathak, A.: Probabilistic model of fault detection in quantum circuits. In Quantum Quenching, Annealing and Computation 297-304, Springer Berlin Heidelberg (2010)
-  Gupta, M., Pathak, A., Srikanth, R., Panigrahi, P.: General circuits for distributing measurement in quantum computation, Int. J. Quant. Info 5, 627 (2007)
-  Pathak, A.: Non-Hermitian quantum gates are more common than Hermitian quantum gates. arxiv:1309.4037 (2013)
-  DiVincenzo, D.P.: Two-bit gates are universal for quantum computation. Phys. Rev. A 51, 1015 (1995)
-  Pathak, A., Banerjee, A.: Optical quantum information and quantum communication. SPIE Spotlight series (2016)
-  Banerjee, A., Pathak, A.: An algorithm for minimization of quantum cost. Appl. Math 6, 157-165 (2012)
-  Maslov, D., Young, C., Miller, D.M., Dueck, G.W., Quantum circuit simplification using templates. In Design, Automation and Test in Europe, 2005, Proceedings, pp. 1208-1213 IEEE (2005)
-  Maslov, D., Dueck, G.W., Miller, D.M., Negrevergne, C.: Quantum circuit simplification and level compaction. IEEE Transactions on Computer-Aided Design of Integrated Circuits and Systems 27, 436-444 (2008)
-  IBM. The Quantum Experience. http://www. research.ibm.com/quantum/