1. Introduction
In recent years, increased work has been done but much remains to be done in the development of existing and novel methods of data processing in new computers named quantum computers. Quantum circuits are complex, since all operations, or gates, should be invertible (unitary), and all calculations should be performed on normalized data, which are called quantum superpositions [
1,
2]. Another feature is the impossibility of measuring the quantum states during calculation in circuits without destroying the complete quantum superposition. Quantum states change instantly as soon as they are observed. In other words, they are well protected from our interference. So even simple tasks require hundreds of thousands of runs of the same quantum circuit to observe reliable data for computing. All that tells us that we need to develop effective and, most importantly, simple methods of building quantum circuits. Many simple one- and two-qubit gates are well known in quantum computation [
3,
4,
5]. However, how to use them in the most effective way to build universal codes, or circuits, to compute multi-qubit quantum operations is still an open problem to be solved.
Multi-qubit operations, or gates, in quantum computation are described by unitary matrices, real or complex. It means that if we build the circuit for multi-qubit operation
, it is not difficult to obtain the circuit for inverse operation
. This is a good and desirable property for the transform. However, the requirement for operation to be unitary makes it difficult to implement many important operations. For instance, in engineering, we mention the operation of linear convolution, correlation, linear filtration, optimal or Wiener filtration, and signal and image restoration [
6,
7].
Studying different methods of matrix decomposition, such as the Gramm–Schmidt process [
8], the method of Householder transformations [
9,
10], cosine-sine decomposition (CSD) [
11], and QR-decomposition by Givens rotations [
12,
13], we choose QR-decomposition. This decomposition, or the factorization for the case of unitary matrices, has been studied and used by many researchers. To build quantum circuits for multi-qubit operations and state preparations, this decomposition has been combined with different permutations [
14,
15,
16,
17,
18,
19,
20]. The purpose of such additional permutations, including CNOT operations and Gray code-based permutations, is the requirement to fulfil the computations only on adjacent bit planes (BP), that is, which differ by only one bit [
21,
22,
23]. The presence of permutations and CNOT gates is associated with multiple switching of information flows from one set of qubits to others. Even for a small number of qubits, for example, 4-qubit operations, the number of only CNOT operations is estimated as
. Many quantum circuits are populated with different switches. The possibility of removing all such permutations from the circuits was noted in our work devoted to 3-qubit operations [
24]. Permutations are not mandatory elements in a universal set of gates, they are not needed at all for multi-qubit operations. We mention several quantum circuits that are used to compute the
-qubit quantum Fourier transform (QFT) [
25,
26]. It is a complicated operation, but implementation of this operation by the Cooley–Tookey algorithm [
27,
28] and paired-transform based method [
29] do not include the CNOT gates in the circuits of the
-qubit QFT. In connection with what has been said, we present
Table 1 with CNOT counts in the known circuits for
-qubit operations (see
Table 1 in [
30] (p. 1008)). This table includes for comparison, the known QR decomposition, cosine-sine decomposition (CSD), and quantum Shannon decomposition (QSD).
This work is the continuation of the above mentioned publication that describes in detail only the case of 3-qubit operations with real unitary matrices, not complex. Here, we consider the general case of 3- and 4-qubit operations. The QR-decomposition and circuits for computing these operations are described in detail. The QR-decomposition is based on the concept of the discrete-time signal-induced heap transform (DsiHT) [
33,
34]. Namely, we consider its particular case, when the transform is generated (induced) by one signal, not several. This transform is used in the QR decomposition with a special property. On each stage of the decomposition, we introduce the roadmap of the transform. It shows a path, the “fast path,” for the DsiHT to operate exclusively on adjacent bit-planes, which ensures optimization of the quantum circuit layout. That allows us to entirely eliminate CNOT gates and Gray-code permutations from the circuits.
The DsiHT is generated by a given signal, and there are many ways to compose this transform by using the path of the transform. The path is an especially important characteristic of the transform, and from the very beginning when this transform was presented (Grigoryan [
35]), we have repeatedly drawn attention to the choice of this path. It was shown, for example, that the right choice of such a path may significantly reduce the number of zeros of the unitary matrix
in the decomposition
for a square matrix, in the general case when
is not necessarily unitary. That reduces the number of multiplications in the matrix calculation. Thus, the traditional method of processing data in the natural order
) is not the best way (or path) of processing data in QR decomposition of an
matrix
. In quantum computation, we only consider the case when
is a power of 2,
. The quantum analogue of the
-point DsiHT is the
-qubit quantum signal-induced transform (QsiHT) [
36].
The key contributions of this work are:
New effective roadmaps or “fast paths” for all fifteen DsiHTs in the QR decomposition of a 4-qubit operation, real or complex. No additional permutations with Gray codes or CNOT gates are required in the decomposition.
For any 3- or 4-qubit operation (circuit), the universal set of gates consists only of - and -rotations, plus the phase gate.
For quantum operations with unitary real matrices, only Givens rotations are required.
A universal and transparent circuit for quantum 3- and 4-qubit operations.
The quantum circuit with a maximum of 120 controlled rotation gates and depth of 54 for 4-qubit real operation. The circuit for complex 4-qubit operation requires a maximum of -rotation gates, -rotation gates, and no permutations.
A simple circuit for generating any 3- and 4-qubit operation with a real or complex unitary matrix by using an encoding table.
A general method for constructing circuits for multi-qubit operations with maximum of -rotation gates, -rotation gates and no permutations, for qubits.
The rest of the paper is organized as follows. In
Section 2, the concept of the DsiHT is briefly discussed. The roadmaps for the 3-qubit QsiHT is presented. The complex DsiHT is considered in
Section 3.
Section 4 describes the method of DsiHT-based QR decomposition on the example with an 8
8 matrix,
. In
Section 5 and
Section 6, the cases of 2- and 3-qubit quantum signal-induced heap transform (QsiHT) are considered in detail with two encoding tables and quantum circuits for complex 2- and 3-qubit operations. The quantum circuit of a 4-qubit unitary operation is presented in
Section 7. All roadmaps for 15 QsiHTs in the QR-decompisition of the 4-qubit operation (complex and real) are presented in
Appendix A.
2. The Concept of the DsiHT
The DsiHT is the unitary transformation that is induced, or generated, by one or more signals [
37]. The illustration of this transform when the transform is generated by a single signal
is shown in
Figure 1. A signal-generator is shown in
Figure 1a. The input and output of the generated transform are shown in
Figure 1b and
Figure 1c, respectively.
To compose such a transform, different ways of processing the components of the generator can be used. We consider the case when the transform is composed sequentially by the series of 2-point operations. At each stage of composition, only two components
and
of signal
will be processed, for instance, the components number
and
. These components can also be renewed during the calculations as well. By using these components, a 2-point operation,
, will be generated, and then, it will be applied on component number
and
of the input signal
, as shown in
Figure 1. Thus, it is a two-level transformation. On the first level, the transforms
are generated, and on the second level, they are applied on the input signal. Input signal
can also be processed after generating the entire transform, DsiHT. We consider the simple case, when each 2-point transformation
moves the energy of the input to one of its components. In other words, the transformation is defined as
or
Here, the energy of the input
is defined as
or
for the complex input.
First, we consider real transformations defined by the Given rotation,
, which is described in the matrix form as
The angle is calculated by
, and
if
. The transformation in Equation (2) is described by
Because of the property + after changing as , the Givens rotation in Equation (3) will result in the transform in Equation (4).
In this section, we describe the DsiHTs composed of the Givens rotations and apply them to real signals. The case of complex transformations
and DsiHT is considered in
Section 3. The main characteristic of the DsiHT is the path, that is, the order in which it is assembled from the basic 2-point rotations with one parameter (the angle) each. The angles are calculated from the generator. The set of these angles is called
the angular representation of the generator and is denoted by
[
33,
37]. In quantum computation, it is desired to compose operations only on adjacent bit planes to avoid additional permutations. Therefore, to apply the concept of the DsiHT in quantum computation and compose the quantum analog of this transform, the path of the transform is chosen as one that allows the composition of the transform by the rotations only on adjacent bit planes [
24].
As an example, we consider the 8-point DsiHTs, which use two different paths.
Figure 2 shows the so-called road map of the 8-point DsiHT and the quantum circuit of the analogue 3-qubit QsiHT.
The road map is the table with the 8-point generator in the first column,
eight bit-planes in the second column, and the output of the transform in the last column. The transformation over the same generator moves the entire energy of
to the first component, resulting in the following signal:
The road map shows seven operations, or butterflies, with two inputs and two outputs. The colors in circles for outputs 0 are in red. The blue color shows the output with the energy of the input. Nodes with blue and next to the right black color on the same bit plane are considered connected. Therefore, the connecting horizontal lines between them are not shown. All butterflies are numbered from top to bottom and left to right. On the first stage, the first four butterflies operate on the bit-planes (0,1), (2,3), (4,5), and (6,7). In the quantum circuits these four operations are described by four gates of rotation controlled by the first two qubits. The corresponding angles of rotations,
are calculated as shown in Equation (3). On the second stage of calculation of the DsiHT, two butterflies are used on the renewed components of the generators, namely component numbers 0, 2, and 4, 6. The corresponding controlled gates of rotations
and
are shown in the circuit. These gates are controlled by qubit numbers 1 and 3. The last butterfly operates on the renewed component numbers 0 and 4. As a result the energy of the generator will be moved to the first output. It is the heap of the transform (shown in yellow circle) and is denoted by
because this component was renewed three times. This butterfly is described by the rotation gate
controlled by the last two qubits. The depth of this circuit is equal to 3, that is, to the number of stages composing the DsiHT. The circuit does not have permutations, only seven gates of rotation on adjacent bit-planes. Seven angles
make up the angular representation of the generator
. These angles plus the path are the key of the DsiHT. This transformation can be written in the matrix form as follows:
Here, the notation
is used for the controlled rotation gate that operates on the biplanes
and
,
.
Now, we consider the 8-point DsiHT generated by the same generator
but with another path.
Figure 3 shows the road map of the new 8-point DsiHT and the corresponding quantum circuit of the 3-qubit QsiHT. Here, we also have seven butterflies, or rotations, and all operates on adjacent bit-planes. This 3-qubit QsiHT can be written in the matrix form as
In comparison with the road map in
Figure 2, the 3-qubit DsiHT is calculated in five stages. It means that the quantum circuit has a depth of 5. Therefore, the circuit in
Figure 2 with depth 3 can be considered more effective than the second circuit. In the future, we will also give preference to road maps that provide minimal computational depth.
Example 1. Consider the generator The matrix of the 8-point DsiHT with the road map in Figure 2 can be written as Here, the diagonal matrix is
The set of angles of rotation gates is equal to (in degrees)
Now, we consider the 8-point DsiHT with the road map given in
Figure 3. The matrix of this transform is equal to
with the diagonal matrix
The angular representation of the signal is the set of angles
Both matrices of the DsiHT have 32 zero coefficients, they are unitary and
and if we normalize the generator,
then
It means that the 3-qubit superposition
will be transformed to the first basis state
. The 3-qubit can be prepared by both transforms
and
, as
. Here,
denotes the transpose matrix. It follows from Equation (6), that the preparation of
can be accomplished by the 3-qubit operation described as
Here, we use the fact that
for rotation gate
.
Figure 4 shows the quantum circuit for 3-qubit state preparation when using the first road map of the DsiHT.
3. Complex QsiHT
In this section, we describe the general case of the
-point DsiHT and its quantum analogue,
-qubit QsiHT, generated by complex signals, or
-qubit superposition. As shown in [
34], there are different complex matrices
that can be used as the basis elements to compose the
-point DsiHT. First, we consider the following 2 × 2 matrix:
Numbers
and
are complex. One coefficient of this matrix is a real number. The matrix
is unitary, and its determinant is the complex number
with
The matrix product
equals
Consider the polar form of the numbers,
and
. Then, the matrix
in Equation (17) can be written as
Denoting
for angle
), we obtain the following:
Therefore, this matrix can be represented as
This is the decomposition of the matrix by the phase shift, two
-rotations, and one
-rotation, that is,
For the real numbers
and
, the matrix is
The phase shift gate
can be removed from the decomposition in Equation (23) and the operation with the following matrix can be considered:
This is the decomposition of the matrix by two
-rotations and one
-rotation,
Here, the vector-angle
, and the angles
and
. The 2 × 2 matrix
is defined as
All coefficients of this matrix are complex numbers. The circuit element for the 1-qubit operation with matrix
is shown in
Figure 5.
Also, we consider the transform with the following unitary 2
2 matrix:
Transform
moves the energy of the complex vector
to the second output,
The following decomposition holds:
with the angle
. Thus,
where the vector-angle
. The circuit element for the 1-qubit operation
with this matrix is shown in
Figure 6. It should be noted that because of
this matrix can be written as
Example 2. Consider the complex generator with the energy . To generate the complex 8-point DsiHT, we will use the road map given in Figure 2. Each of seven butterflies in this road map will represent the corresponding complex gate 1:7, with three parameters and angles. The circuit of the 3-qubit complex QsiHT is given in Figure 7. The angles of seven gates
are given in
Table 2.
The circuit is described by the following matrix equation:
As in the case of real rotations, the notation
is used for the controlled gate
that operates on the biplanes
and
,
. This circuit of the 3-qubit QsiHT calculates the first basis state
from the generator, written as the 3-qubit superposition
That is,
, or
(1,0,0,…,0)’. The matrix of this transform is equal to
The determinant of this matrix is equal to 1. As in the case of the real generator in Example 1, the number of zeros in this matrix is equal to 32 (the half of the size of the matrix).
The matrix is unitary, the transpose matrix is the inverse matrix of the conjugate transpose,
. Therefore, the 3-qubit preparation (
) can be accomplished by the 3-qubit gates as
Note that the gate inverse to
is calculated by
Thus,
. The triplets of angles for the inverse gates change as
,
.
Figure 8 shows the quantum circuit for preparing the 3-qubit superposition
, by using the first road map of the 8-point DsiHT. This circuit is composed of rotation gates
and
. These two gates,
- and
-rotations, together with the phase gate, compose the set of universal gates for 3-qubit operations. This circuit uses a maximum of 7 rotation gates
and 14 gates
.
The main characteristics of this quantum circuit are given in
Table 3.
For the signal
in Example 2, there are six zero angles for gates
in
Table 1. This means that the last three operations are rotations,
. The circuit can be simplified. The full quantum circuit to initiate the 3-qubit state
in Equation (35) is shown in
Figure 9. The circuit contains seven rotation gates
and eight gates
. The total number of gates is 15.
4. DsiHT-Based QR Decomposition
In this section, we describe the QR decomposition of a square unitary matrix of size
by the Givens rotations [
34,
38]. The unitary matrix
is considered with real or complex coefficients. In this decomposition, the matrix is presented as
, where
is a unitary matrix composed of rotations, and
is a diagonal matrix with coefficients lying on the unit circle. During this decomposition, the matrix
is transformed sequentially into a diagonal matrix
.
DsiHTs are used in the QR decomposition of matrix
. The first step of this decomposition is illustrated below, for an 8
unitary matrix,
The matrix diagonalization can be described by the following steps:
- 1.
The first DsiHT, denoted as is generated by the first column of the matrix , which we denote by This transform changes this column as
After multiplying the matrix of this DsiHT by matrix
, the new matrix
will have the form shown in Equation (39). Except the first point on the diagonal, all values of the first column and row are equal to 0.
- 2.
The second 8-point DsiHT, denoted as is generated by the second column of the new matrix , which is denoted as This transform will change this column as
and other columns
of the matrix
as
.
- 3.
A similar 8-point DsiHT, , will be generated by the 3rd column of the new matrix and applied on it. If we denote this column as , then this transform will change this column as
and other columns
of the matrix
as
.
- 4.
This process is continued four more times, until matrix diagonalization is completed
Each of these seven 8-point DsiHTs can be defined with the fast path, as in the examples described above, which calculate these transforms only on adjacent bit planes.
In the above, for
, the transform
generated by the vector
does not change the first values
of
, as well as a vector
on which it applies. That is, it processes only the remaining components. For instance, if
,
This 8-point DsiHT is generated under the condition,
where
is the norm of the vector,
. Thus, the energy of the signal is moved to the third components (
).
These seven 8-point DsiHT with fast paths for the QR-decomposition of a matrix 8
8 are described in detail and with the quantum circuits in [
24] for the real matrix
. The QR decomposition is encoded, as shown in
Table 4.
All butterflies (BF) and paths are shown in this table for all seven DsiHTs that are used in the decomposition. In other words, seven roadmaps are encoded in this table. For instance, we consider the transform
. Five butterflies are used as follows. The butterflies are numbered from left to right. The first butterfly is encoded as
, meaning that it operates on bit-planes 2 and 3, and the second output of the operation is zero (symbol ‘o’ is used). The energy of the input will be moved to the first output (symbol ‘*’ is used). This butterfly is the operation of rotation described in Equation (3). The butterfly number 4, which is encoded as
, operates on bit-planes 4 and 6 and moves the energy of the input to the second output. The first output is zero. This is the rotation described in Equation (4). The remaining butterflies of numbers 2, 3, and 5 operate on bit-planes (4,5), (6,7), and (2,6), respectively. They are operations of rotation that move the energy of the inputs to the first component, as the first butterfly. The road map and the quantum circuit for the 3-qubit DsiHT,
, for the real generator are given in
Figure 10.
This encoded table shows that 20 gates
and 8 gates
are used for the decomposition of the matrix. The same encoded table can be used in the case when the matrix
is complex. Only the above butterflies as real gates should be changed by the corresponding complex gates
or
. For instance, in the above case, the 1st butterfly
will be changed by
, and the firth butterfly
should be changed to
. The corresponding quantum circuit is given in
Figure 11.
7. The Circuit for 4-Qubit Operation
In this section, we describe the circuit for calculating 4-qubit operations, which is defined by a complex unitary 16
16 matrix
. The QR-decomposition is accomplished by fifteen 16-point DsiHTs in total on 120 adjacent biplanes. The information on this decomposition
is given in encoding
Table 10.
If we use this table for a real 4-qubit operation, the QR decomposition requires only 120 rotation gates. Therefore, the quantum circuit for this operation
requires a maximum of 120 rates
plus one Pauli
gate for the diagonal matrix with coefficients
, if the last coefficient is
.
The road map for all 15 DsiHTs with fast paths are shown in
Figure A1,
Figure A2,
Figure A3,
Figure A4,
Figure A5,
Figure A6,
Figure A7,
Figure A8,
Figure A9 and
Figure A10 in
Appendix A. The quantum circuit for these transforms are also given in these figures. As shown in
Figure A9, the roadmap for the DsiHT,
, is composed of the corresponding roadmap of the 3-qubit transform
. In the circuit, we need only to add the circuit of the 3-qubit transform controlled by the first qubit. Similarly, the road maps for the last six DsiHTs,
, when
are composed of the corresponding road maps of the 3-qubit transforms
. Therefore, the quantum circuits for these transforms,
are composed of the circuits of the transformation
controlled by the first qubit, as shown in
Figure A10.
All transforms , when are defined with fast paths, that is, they are composed of rotations on adjacent bit-planes only. The circuits are given for the case when the matrix of the 4-qubit operation is real. In the complex case, these rotations are substituted by the complex gates or , as shown in the road maps. The total number of these gates is equal to 120. Among them, 40 gates are of type In all circuits, the gates are numbered from left to right. However, the numbers are shown only for gates. For instance, for the transformation , instead of rotation gate numbers 1–4, 9, 10, and 13, gates are used when drawing this circuit for the complex 4-qubit operation. The remaining seven rotations will be substituted by the corresponding gates.
All angles
and
of these 120 complex gates represents
the table of keys of the 4-qubit operation
. Such tables of keys are described in detail in examples for 2- and 3-qubit operation in [
24]. In the general case when
, an
-qubit operation can be decomposed by (
) DsiHTs with fast path. The total number of
and
gates in the decomposition is equal to
. For a real
-qubit operation
, the number of rotation gates
is equal to
.
In conclusion, we consider the work of Fedoriaka [
23], where the QR decomposition was implemented with Gray code and fully controlled gates. We refer to this method as the X and fully controlled gate decomposition (XFCD). The corresponding code was implemented in Q# programming language and is publicly available (for detail, see [
23]). The decomposition uses
-rotation gates, phase gates, and X gates with matrix
The comparison is shown in
Table 11 for 3- and 4-qubit operations. We note that the XFCD was implemented for the special unitary operations, whose matrices
have the determinant
In general, for a unitary matrix
. The proposed QsiHT-based QR decomposition method is used for any unitary operation. For special cases of
-qubit operations, the number of gates may be smaller, and the above quantum circuits can be reduced, or simplified, as shown in [
24] with the example of Dicke states [
39].
The main advantage of the proposed QR decomposition by the DsiHT with fast paths is that
It does not require any permutations for any unitary gate in the quantum computation. It means that CNOT operations are not required.
A maximum of () Givens rotations are gates required to perform an -qubit operation with a unitary real matrix.
A maximum of () Givens rotation and () -rotation gates are required to perform an -qubit operation with a unitary complex matrix.
It gives us a simple (transparent) calculation quantum circuit.
Any -qubit operation can be generated by a table of keys.
It shows that - and -rotation plus global phase gate are a universal set of gates in quantum computation.