Next Article in Journal
New Approach for Investigating a Class of Multi-Cost Interval-Valued Extremization Problems
Previous Article in Journal
Digital Twins in Critical Infrastructure
Previous Article in Special Issue
Control of Qubit Dynamics Using Reinforcement Learning
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Quantum Algorithms for the Multiplication of Circulant Matrices and Vectors

1
Key Laboratory of Cyberspace Security Defense, Institute of Information Engineering, CAS, Beijing 100085, China
2
School of Cyber Security, University of Chinese Academy of Sciences, Beijing 100085, China
*
Author to whom correspondence should be addressed.
Information 2024, 15(8), 453; https://doi.org/10.3390/info15080453
Submission received: 3 July 2024 / Revised: 23 July 2024 / Accepted: 23 July 2024 / Published: 1 August 2024
(This article belongs to the Special Issue Quantum Information Processing and Machine Learning)

Abstract

:
This article presents two quantum algorithms for computing the product of a circulant matrix and a vector. The arithmetic complexity of the first algorithm is O ( N log 2 N ) in most cases. For the second algorithm, when the entries in the circulant matrix and the vector take values in C or R , the complexity is O ( N log 2 N ) in most cases. However, when these entries take values from positive real numbers, the complexity is reduced to O ( log 3 N ) in most cases, which presents an exponential speedup compared to the classical complexity of O ( N log N ) for computing the product of a circulant matrix and vector. We apply this algorithm to the convolution calculation in quantum convolutional neural networks, which effectively accelerates the computation of convolutions. Additionally, we present a concrete quantum circuit structure for quantum convolutional neural networks.

1. Introduction

Quantum computing, as a disruptive technology, has received widespread attention from various fields, since it can efficiently accelerate the solving of some fundamental computational problems. For example, Shor’s algorithm [1] can solve the factorization problem in polynomial time, posing a great threat to modern cryptography in theory. Grover’s algorithm [2] can achieve a square-root speedup in unstructured search. The HHL algorithm [3] proposed in 2006 has an exponential speedup in solving linear equations.
As a linear equation solver, the HHL algorithm consists of three main parts. The first part employs quantum phase estimation to achieve the eigenvalues of the matrix being calculated. The second part applies quantum controlled gates to flip the auxiliary qubits based on the given eigenvalues. The third part uses the inverse of quantum phase estimation to undo the entanglement and restore some of the auxiliary qubits. By measuring the remaining auxiliary qubits, one can obtain the target state. By modifying the second step of the HHL algorithm, we can easily apply the idea of the HHL algorithm to matrix–vector multiplication. It should be noted that the complexity of the HHL algorithm depends not only on the size of the matrix but also on the condition number of the matrix. The condition number of a matrix is an indicator of the sensitivity of the matrix to changes in the result, and is an inherent property of the matrix. Therefore, it is difficult to manually constrain the condition number of the matrix. There are some types of matrices that may have a high condition number but contain some specific structures, which could lead to more efficient computation. Circulant matrices are one of these types and, in this paper, we focus on their computation.
Circulant matrices have been well studied in both classical and quantum settings. In the classical setting, it was shown that the product of a circulant matrix and a vector of size N can be computed with O ( N log N ) operations using FFT (Fast Fourier Transformation) [4]. By expressing a Toeplitz matrix as a circulant matrix, Golub and van Loan showed that a Toeplitz matrix and a vector can also be multiplied in time O ( N log N ) [4]. Circulant matrices and related structured matrices were also studied in [5,6,7]. In the quantum setting, different quantum expressions for the circulant matrix were presented in [8,9,10]. Reference [8] presents a quantum construction method for cyclic matrices. Where the Toeplitz matrix can serve as a submatrix of the cyclic matrix, reference [9] provides an asymptotic method for solving Toeplitz systems. Reference [10] applies cyclic matrices to quantum string processing.
In this paper, we propose two new quantum algorithms for circulant matrix–vector multiplication, which take advantage of the features of quantum mechanics and have better computational complexity compared to classical algorithms. For the first algorithm we propose, the complexity is O ( N log 2 N ) in most case. For the second algorithm, if the elements in the circulant matrix and vector are randomly chosen from R or C with a norm no larger than d, then the proportion of matrices and vectors that can be computed with complexity O ( N log 2 N ) approaches 1 as the dimension of the matrix increases. Similarly, if the elements are randomly chosen from R + with a norm no larger than d, then the proportion of matrices that can be computed with complexity O ( log 3 N ) also approaches 1 as the dimension increases.
Theorem 1. 
There exists two quantum algorithms which compute the multiplication of the circulant matrix and vector. For the first algorithm, it computes the multiplication of a circulant matrix and a vector over C (or R ) with a probability of at least 1 1 N and complexity O ( N log 2 N ) , where N is the dimension of the matrix, and the proportion of the circulant matrix and vector combinations that can be effectively computed approaches 1 as the dimension increases. For the second algorithm, it computes the multiplication of the most circulant matrix and vector over C (or R ) with a probability of at least 1 1 N and complexity O ( N log 2 N ) , where N is the dimension of the matrix, and the proportion of the circulant matrix and vector combinations that can be effectively computed approaches 1 as the dimension increases.
Compared to the approach similar to the HHL algorithm, our second algorithm has two advantages. Firstly, our second algorithm directly performs calculations on quantum states without the need for Hamiltonian simulations, thus reducing computational complexity and errors. Secondly, our second algorithm does not have the process of quantum phase estimation (QPE), thus reducing the use of auxiliary bits and errors. Our second algorithm also has a measurement step and has the same complexity as the HHL approach during measurement. The comparison is shown in the Table 1. In particular, when the circulant matrix and vector values are in R + , the algorithm complexity is logarithmic with respect to the size of the matrix.
Furthermore, we apply our algorithms in convolution computation, which is an important and fundamental problem in quantum machine learning (QML). The field of quantum machine learning has been developing rapidly in recent years. Machine learning algorithms suffer from computational bottlenecks as the dimensionality increases. To promote experimental progress towards realizing quantum information processors, the approach of using quantum computers to enhance conventional machine learning tasks was proposed, and this led to the development of quantum convolutional neural networks (QCNNs). The earliest QCNN was proposed in [11] for solving quantum many-body problems. Subsequently, in [12,13], QCNNs for image recognition were discussed. The difference of their results is that the quantum circuit in [12] is a purely random quantum circuit, while the quantum circuit in [13] has a simple design. In [12], the authors presented real experiments to confirm that their algorithm still has some effect even when using a fully random quantum circuit. The quantum circuit designed in [13] only entangles different qubits without a more specific definition of the quantum circuit. In this paper, we present an effective quantum circuit for computing convolutions, which may be used as a sub-circuit in the quantum circuit of QCNNs.
The structure of this article is as follows. In Section 2, we introduce circulant matrices and some basics of quantum computing, and present some quantum circuit structures that will be used in the quantum algorithms for circulant matrix–vector multiplication. In Section 3, we describe the details of our new algorithms and analyze their running times. As both algorithms involve quantum measurements, Section 4 presents a probability analysis of the measurements and, for parts where theoretical analysis is not available, we present experimental results to support our algorithms. In Section 5, we discuss the specific application of circulant matrix–vector multiplication in convolution computation. Finally, conclusions and future directions are presented in Section 6.

2. Preliminaries

In this section, we will present some background information that will be used in our later discussion of the circulant matrix–vector algorithm. This includes properties of circulant matrices, existing results in quantum computing, and structures of quantum circuits, as well as the effects that these structures can achieve in quantum circuits.

2.1. Circulant Matrix

For any vector a = ( a 0 , a 1 , , a N 1 ) in C N , its corresponding circulant matrix is denoted by A and is represented as follows:
A = a 0 a 1 a 2 a N 1 a N 1 a 0 a 1 a N 2 a 1 a 2 a 3 a 0
The circulant matrix A can be represented as a linear combination of matrix T , denoted as
A = j = 0 N 1 a j T j ,
where T is the cyclic permutation matrix and can be represented as
T = 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 N × N
In addition, a circulant matrix can also be diagonalized by a Fourier matrix of the same order. Let F be the Fourier matrix in C N × N , and let ω = e 2 π i N ; then, F can be expressed as
F = 1 1 1 1 1 ω ω 2 ω N 1 1 ω N 1 ω 2 ( N 1 ) ω ( N 1 ) 2
Using F , we can diagonalize A to a diagonal matrix A . Specifically, if we denote d i a g { F 1 a } as the diagonal matrix with F 1 a on its diagonal, then, we have
A = 1 N FAF 1 = d i a g { F 1 a } .
In this paper, we are calculating the matrix–vector multiplication of a circulant matrix A and a vector x = ( x 0 , x 1 , , x N 1 ) over C . Here, A is given by a vector a = ( a 0 , a 1 , , a N 1 ) , and their correspondence can be found in Equation (1). It is easy to check that the k-th eigenvalue of A is λ k = j = 0 N 1 a j ω j k , and Λ k = 1 N ( 1 , ω k , , ω k ( N 1 ) ) is the corresponding eigenvector. Moreover, we have x = k = 0 N 1 ( 1 N j = 0 N 1 x j ω j k ) Λ k and, in the following, we denote 1 N j = 0 N 1 x j ω j k by λ k x for simplicity.
To compute matrix–vector multiplication by a quantum algorithm, we need to represent the given two vectors by quantum states. The modulus squared of the coefficients of the quantum state corresponds to the probability of measuring that quantum state. Therefore, we first normalize the two given vectors and then convert them into the representation of quantum states. Unless otherwise specified, the vectors a and x we use later are both in the normalized form. As argued in most of quantum algorithms, we always assume that the quantum states | a = j = 0 N 1 a j | j and | x = j = 0 N 1 x j | j are already effectively prepared and we can directly use them for calculation. For example, our algorithm can serve as a subroutine in a larger algorithm and, in this case, the required quantum states | a and | x have already been generated. Generally speaking, it is difficult to prepare an arbitrary initial state, and there are only a few methods available now [14,15,16].

2.2. Quantum Computing

Definition 1. 
Let n 0 be an integer, and N = 2 n . The quantum Fourier transform on n qubits is defined by
F N : | x 1 2 n y = 0 2 n 1 e 2 π i x y / 2 n | y ( 0 x 2 n 1 )
The complexity of the quantum Fourier transform is O ( n 2 ) , and its quantum circuit diagram is as shown in Figure 1.
Next, we introduce the quantum amplitude amplification algorithm [17]. The quantum amplitude amplification algorithm can be classified into two types: the first type is when we already know the success rate of the target algorithm, while the second type is when we only know the possible values of the target algorithm. Both types achieve quadratic speedup. The algorithm can be described as follows.
There exists a quantum algorithm QSearch with the following property. Let A be any quantum algorithm that uses no measurements, and let χ : Z { 0 , 1 } be any Boolean function. The Boolean function χ : Z { 0 , 1 } induces a partition of the values of algorithm A into a direct sum of two subspaces, a good subspace and a bad subspace. The probability that the measurement result of the quantum algorithm A falls onto a good subspace is a. Algorithm QSearch finds a good solution using an expected number of applications of A and A 1 , which are in O ( 1 a ) if a > 0 , and otherwise runs forever. Please refer to [17] for more specific details.

2.3. Quantum Circuit

Here, we will introduce some quantum circuits that we will use and their roles.

Quantum Arithmetic Operation

We only need addition among quantum arithmetic operations. Here, we use the quantum adder given in [18], which consists of two parts. The first part is the calculation of carry, composed of the sub-circuit MAJ , and the second part is the addition process using the carry calculation, composed of the sub-circuit UMA . This adder is an in-place circuit, and its result is stored in the second register to reduce the number of qubits used. The relevant structures and circuit diagrams of the sub-circuits are shown below (calculate a 2 a 1 a 0 + b 2 b 1 b 0 = c 3 s 2 s 1 s 0 ).
In Figure 2, M and U correspond to the sub-circuits MAJ and UMA in Figure 3, respectively, as detailed below:
From the above circuit diagrams, we can see that the number of gates required to perform the addition of two n-bit numbers is O ( n ) .

2.4. Quantum Circuit for the U i Transformation

In this subsection, we suppose that we have the quantum circuit for the unitary matrix U; then, we introduce the quantum circuit for the U i transformation, which appears as a sub-circuit in quantum phase estimation. Specifically, given a quantum state | a and a unitary matrix U, the U j transformation
| 0 n | a i = 0 2 n 1 1 2 n | i U i | a
can be implemented as shown in Figure 4.
This circuit requires n controlled-U gates and performs a total of O ( n ) quantum gates. Later, we will present the specific structure of the U gate to analyze the complexity of our first algorithm.

2.4.1. Quantum Circuit for the Cyclic Permutation

According to Equation (2) in Section 2.1, we know that the circulant matrix A can be represented by the cyclic permutation matrix T . Here, we present a specific implementation for T , where T is a 2 n × 2 n cyclic permutation matrix.
Let F be the 2 n × 2 n Fourier matrix. It is easy to check that
T = FTF 1 = d i a g { ω 0 , ω 1 , , ω ( 2 n 1 ) }
is a diagonal unitary matrix, and T can be implemented in Figure 5:
Figure 5. Quantum circuit for transformation T .
Figure 5. Quantum circuit for transformation T .
Information 15 00453 g005
where
R ω 1 ( k ) = 1 0 0 ω 2 k .
As introduced in Definition 1, we can implement F with complexity O ( n 2 ) . Then, using T = F 1 T F , we can derive the implementation of T from those of F and T . Moreover, we can construct T 2 s similarly. Since we have T 2 s = ( F 1 T F ) 2 s = F 1 T 2 s F , we only need to construct T 2 s . From our previous result, we have T 2 s = d i a g { ω 0 · 2 s , ω 1 · 2 s , , ω ( 2 n 1 ) · 2 s } ; thus, the circuit for T 2 s can be easily achieved by replacing R ω 1 ( k ) with R ω 2 s ( k ) in the circuit for T , where
R ω 2 s ( k ) = 1 0 0 ω 2 k + s .
In this way, for any s { 0 , 1 , , n 1 } , we can implement the matrix T 2 s with O ( n ) quantum operations, and we can further implement the matrix T 2 s with O ( n 2 ) quantum operations.

2.4.2. Quantum Extraction Circuit

We introduce a circuit that can extract the target state i = 0 2 n 1 c a i x i | i | 0 from a given quantum state i = 0 2 n 1 j = 0 2 n 1 a i x j | i | j , where c is the change coefficient due to the collapse of the original state to the target state after measurement. For example, if n = 3 , the quantum extraction circuit is in Figure 6:
When the measurement results for the last three qubits are | 000 , we can obtain our target state. In this way, the probability of obtaining the target state is i = 0 2 n 1 | a i x i | 2 . This probability can be increased by using the quantum amplitude amplification algorithm, and we will give a specific probability analysis later.

3. Multiplication of Circulant Matrices and Vectors

We present two different algorithms for computing the product of a circulant matrix and a vector, which result in different representations. It should be noted that, when the entries of the circulant matrix and the vector are all in R + , our second algorithm can achieve exponential acceleration compared to classical algorithms. In this section, the computation of the indices and the binary numbers (or integers) corresponding to basis states is in the ring Z N , where N = 2 n and n is the number of qubits. For the sake of simplicity, we omit the “ mod N ” symbol in their expression. Specifically, for a variable a i or a basis state | i with i N or i < 0 , we mean a j or | j , with j = i mod N .

3.1. The First Algorithm

Theorem 2. 
There exists a quantum algorithm that computes the multiplication of a circulant matrix and a vector over C (or R ) with a probability of at least 1 1 N and complexity O ( N log 2 N ) , where N is the dimension of the matrix, and the proportion of the circulant matrix and vector combinations that can be effectively computed approaches 1 as the dimension increases.
We suppose that a = ( a 0 , a 1 , , a n 1 ) , and A is the corresponding circulant matrix for a . Let x = ( x 0 , x 1 , , x n 1 ) . Then, the input of our algorithm is
| 0 n | a | b = j = 0 N 1 k = 0 N 1 a j x k | 0 n | j | k
where | a = j = 0 N 1 a j | j and | x = k = 0 N 1 x k | k are the quantum states corresponding to the vectors a and x , respectively.
Obviously, we have
Ax = a 0 x 0 + + a N 1 x N 1 a N 1 x 0 + + a N 2 x N 1 a N k x 0 + + a N k 1 x N 1 a 1 x 0 + + a 0 x N 1 = a 0 x 0 + + a N 1 x N 1 a 1 x 2 + + a 0 x 1 a k x 2 k + + a k 1 x 2 k 1 a N 1 x N 2 + + a N 2 x N 3
If we remove the + sign on the right-hand side, then we can achieve a matrix A * with A i j * = a i + j x 2 i + j . Then, the output of our algorithm is the quantum state ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n , whose amplitudes are equal to Ax .
Our algorithm is presented in Algorithm 1. In the following, we provide a detailed analysis of each step of this algorithm.
Algorithm 1 Multiplication of a circulant matrix and a vector
Input: 
The quantum state | 0 n | a | x
Output: 
The quantum state
  
( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n .
 1:
Apply the H n transformation on the first register.
 2:
Apply the T i transformation on the second register, then get the state
i = 0 2 n 1 j = 0 2 n 1 1 2 n a j | i T i | j | x = i = 0 2 n 1 j = 0 2 n 1 1 2 n a i + j | i | j | x .
 3:
Double the basis state of the first register, then get the state
i = 0 2 n 1 j = 0 2 n 1 1 2 n a i + j | 2 i | j | x .
 4:
Apply the quantum adder for the states of the first two registers with the result stored in the first register, then get the state
i = 0 2 n 1 j = 0 2 n 1 1 2 n a i + j | 2 i + j | j ( k = 0 2 n 1 x k | k ) = i = 0 2 n 1 j = 0 2 n 1 k = 0 2 n 1 1 2 n a i + j x k | 2 i + j | j | k .
 5:
Run the quantum state extraction circuit in Figure 6. Then, with some probability the state of the first three registers is
i = 0 2 n 1 j = 0 2 n 1 c 2 n a i + j x 2 i + j | 2 i + j | i | 0 n .
 6:
Reverse the quantum arithmetic operations performed on the first register, then get the state
i = 0 2 n 1 j = 0 2 n 1 a i + j x 2 i + j | i | j | 0 n .
 7:
Apply the H n transformation on the second register, and then measure the second register, when the measurement results for the second register is | 0 n , then get the state
c ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n .
 8:
return ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n .
Step 1. We apply the H n transformation on the first register.
Step 2. We apply the T i transformation to the second register, with the qubits in the first register serving as the control qubits. Based on the circuit in Figure 4 and the properties of the matrix T , we can easily obtain the circuit of the controlled-T operations as shown in Figure 7:
In this circuit, implementing F and F 1 requires O ( n 2 ) operations as mentioned earlier, and implementing each controlled- T 2 s requires O ( n ) operations. Therefore, Step 1 requires O ( n 2 ) operations. It should be noted that, for a basis state | j , T | j = | j 1 ; hence, T i | j = | j i . Therefore, by modifying the indices of these a j s, we can obtain the expression in Equation (13).
Step 3. We double the basis states of the first register: | i n i n 1 i 1 | i n i n 1 i 1 0 m o d 2 n = | i n 1 i n 2 i 1 0 . This can be implemented directly by some swap gates, CNOT gates, and one auxiliary qubit.
In Figure 8, we present the circuit for doubling the basis state of four qubits. In this circuit, we want to double | i 3 i 2 i 1 i 0 . By using one auxiliary qubit, we convert | 0 i 3 i 2 i 1 i 0 to | i 3 i 2 i 1 i 0 0 , and the output we need is | i 2 i 1 i 0 0 . This means that | i 3 on the auxiliary qubit is a garbage output. Here, we do not restore it to | 0 immediately, since its value will not affect the following steps. In Step 5, this auxiliary qubit will be restored to | 0 by uncomputation. Therefore, we omit this qubit in the description of our algorithm.
Step 4. We use the quantum adder in Figure 2 to apply the modular addition for the first two registers and store the result in the first register. It should be noted that the mod 2 n operation can be easily implemented by removing the operations that generate the highest carry in the quantum adder circuit. Therefore, the complexity of this step is O ( n ) .
Step 5. We run the quantum state extraction circuit in Figure 6 for the first and third registers in order to obtain the desired state. The complexity of this step is O ( n ) . The probability of obtaining this result is 1 2 n . Since the state of the third register collapses to | 0 n , the normalized state is multiplied by a coefficient c, which is equal to 2 n and can be cancelled out with the denominator. As the probability of the measurement outcome being | 0 n is 1 2 n , the quantum amplitude amplification algorithm can increase the probability to over 1 1 2 n with complexity O ( 2 n ) . A detailed analysis of the measurement success probability will be presented in Section 4.
Step 6. We reverse the quantum arithmetic operations performed on the first register. This step has a complexity of O ( n ) .
Step 7. We apply the H n transformation on the second register, and then measure the second register; the normalized state is multiplied by a coefficient c ; the probability of the measurement outcome being | 0 n is O ( N ) in most case. A detailed analysis of the measurement success probability will be presented in Section 4.
Step 8. We return the quantum state of the three registers.
After organizing the complexity of the previous calculations, the overall complexity of the algorithm was determined to be O ( N log 2 ( N ) ) . Ultimately, we obtained a quantum state containing result information. Compared with classical results, the quantum state we obtained may have more applications, for example, when used in quantum convolutional neural networks.
In this section, we also present a new quantum representation method for circulant matrices, which is given through controlled matrices and related quantum states, with the expectation of having better applications.

3.2. The Second Algorithm

Theorem 3. 
There exists a quantum algorithm which computes the multiplication of the most circulant matrix and vector over C (or R ) with a probability of at least 1 1 N and complexity O ( N log 2 N ) , where N is the dimension of the matrix, and the proportion of the circulant matrix and vector combinations that can be effectively computed approaches 1 as the dimension increases.
We suppose that a = ( a 0 , a 1 , , a n 1 ) , and A is the corresponding circulant matrix for a . Let x = ( x 0 , x 1 , , x n 1 ) ; then, we have that computing Ax = b is equivalent to computing FAF 1 Fx = Fb . Moreover, we have FAF 1 = d i a g ( F 1 a ) , so Fb can be computed by F 1 a and Fx . We can then use a quantum extraction circuit to extract the target state, and the whole algorithm is presented in Algorithm 2.
Algorithm 2 Multiplication of a circulant matrix and a vector
Input: 
The quantum state | a | x
Output: 
The quantum state
  
c ( 2 n ) r = 0 2 n 1 ( j = 0 2 n 1 a j x j + r ) | r
 1:
Apply the inverse quantum Fourier transform ( QFT ) to | a and the quantum Fourier transform (QFT) to | x , then get the state
1 2 n j = 0 2 n 1 a j ( k = 0 2 n 1 e 2 π i j k / 2 n | k ) p = 0 2 n 1 x p ( q = 0 2 n 1 e 2 π i p q / 2 n | q ) .
 2:
Use the quantum extraction circuit in Figure 6 to extract our target state from the first two registers. Then, with some probability, we get the state
c 2 n k = 0 2 n 1 ( j = 0 2 n 1 a j e 2 π i j k / 2 n ) ( p = 0 2 n 1 x p e 2 π i p k / 2 n ) | k | 0 n .
 3:
Perform QFT on the first register, then get the state
c ( 2 n ) 3 2 k = 0 2 n 1 ( j = 0 2 n 1 a j e 2 π i j k / 2 n ) ( p = 0 2 n 1 x p e 2 π i p k / 2 n ) ( r = 0 2 n 1 e 2 π i r k / 2 n | r ) .
 4:
Return the quantum state
c ( 2 n ) r = 0 2 n 1 ( j = 0 2 n 1 a j x j + r ) | r .
Here, we analyze the complexity of each step in detail.
Step 1. We apply QFT to | a and QFT to | x . Obviously, the complexity of this step is O ( n 2 ) .
Step 2. We use the quantum extraction circuit in Figure 6 to extract our target state from the first two registers. This step has a complexity of O ( n ) . When the measurement outcome is | 0 n , we obtain the target state. Since the state of the second register collapses to | 0 n , the normalized state is multiplied by a coefficient c. If the elements of vectors a and x (not normalized) are randomly chosen from ( 1 , 1 ) (over R ) , or the ball (over C ) with a norm of 1, then, for most cases, the probability of the measurement outcome being | 0 n exceeds 1 2 N . With a complexity of O ( N ) , the quantum amplitude amplification algorithm can increase this probability to at least 1 1 N . Moreover, if the elements of | a and | x are randomly chosen from ( 0 , 1 ) , then, for most cases, the probability of obtaining | 0 n exceeds 1 2 . The specific analysis will be discussed in the next section.
Step 3. We perform QFT on the first register, with a complexity of O ( n 2 ) . Then, the amplitude of | r is
c ( 2 n ) 3 2 k = 0 2 n 1 ( j = 0 2 n 1 a j e 2 π i j k / 2 n ) ( p = 0 2 n 1 x p e 2 π i p k / 2 n ) e 2 π i r k / 2 n = c ( 2 n ) 3 2 j = 0 2 n 1 p = 0 2 n 1 k = 0 2 n 1 a j x p e 2 π i ( j + p r ) k 2 n = c ( 2 n ) 3 2 j = 0 2 n 1 t = 0 2 n 1 a j x t + j ( k = 0 2 n 1 e 2 π i ( j + ( t + j ) r ) k 2 n ) / * Substitute p with t + j * / = c ( 2 n ) 3 2 j = 0 2 n 1 t = 0 2 n 1 a j x t + j ( k = 0 2 n 1 e 2 π i ( t r ) k 2 n ) = c 2 n ( 2 n ) 3 2 j = 0 2 n 1 a j x j + r = c ( 2 n ) r = 0 2 n 1 ( j = 0 2 n 1 a j x j + r )
Step 4. We return the quantum state c ( 2 n ) r = 0 2 n 1 ( j = 0 2 n 1 a j x j + r ) | r .
In summary, the output of this algorithm is exactly the result of the circulant matrix–vector product given in the first algorithm. If the components of the vectors a and x (not normalized) are randomly selected from ( 1 , 1 ) (over R ), or the ball (over C ) with a norm of 1, then, for most cases, the complexity of this algorithm is O ( N log 2 ( N ) ) . If the components of | a and | x are randomly selected from ( 0 , 1 ) , then the complexity of this algorithm is O ( log 3 ( N ) ) , achieving exponential acceleration compared to classical algorithms.

4. Measurement Success Probability Calculation

In this section, we will present a detailed analysis of the probability of obtaining the target states after measurements in Algorithms Section 3.1 and Section 3.2. Here, we also omit the “mod N” symbol in the indices with N = 2 n . The vectors a and x in this section are no longer normalized, and the conditions they satisfy will be given below.
For Algorithm 1, we have the following success rate of measurement in Step 4:
Pr succ = i = 0 2 n 1 j = 0 2 n 1 ( 1 2 n a i + j x 2 i + j ) ( 1 2 n a ¯ i + j x ¯ 2 i + j ) i = 0 2 n 1 j = 0 2 n 1 k = 0 2 n 1 ( 1 2 n a i + j x k ) ( 1 2 n a ¯ i + j x ¯ k ) = i = 0 2 n 1 j = 0 2 n 1 ( 1 2 n a i + j x 2 i + j ) ( 1 2 n a ¯ i + j x ¯ 2 i + j ) 1 2 n i = 0 2 n 1 j = 0 2 n 1 a i + j a ¯ i + j k = 0 2 n 1 x k x ¯ k = i = 0 2 n 1 j = 0 2 n 1 ( 1 2 n a i + j x 2 i + j ) ( 1 2 n a ¯ i + j x ¯ 2 i + j ) = 1 2 n i = 0 2 n 1 t = 0 2 n 1 a i + ( t i ) x 2 i + ( t i ) a ¯ i + ( t i ) x ¯ 2 i + ( t i ) = 1 2 n t = 0 2 n 1 a t a ¯ t ( i = 0 2 n 1 x i + t x ¯ i + t ) = 1 2 n
In Step 7, we have the state
1 2 n ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n + | ,
where | is orthogonal to
1 2 n ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) | i ) | 0 n | 0 n ,
so the success rate of measurement in Step 7 is 1 N ( i = 0 2 n 1 ( j = 0 2 n 1 a i + j x 2 i + j ) ( j = 0 2 n 1 a ¯ i + j x ¯ 2 i + j ) ) and is O ( N ) in most cases. We will use experiments later to illustrate.
For the probability calculation of Algorithm 2, unfortunately, we were unable to present an explicit formula. Therefore, we used experimental results to demonstrate that, for most matrices, we can effectively compute them in Algorithm 2. Our goal was to estimate the proportion of circulant matrix–vector combinations that our algorithm could effectively compute, in all circulant matrix–vector combinations. We randomly generated matrices and vectors by selecting elements from a given interval, and then used classical algorithms to calculate the required probability. We then recorded the proportion of circulant matrix–vector combinations that we could effectively compute, and observed how this proportion changes with the interval and dimension.
We first considered the circulant matrix–vector multiplication on R with the norm of the elements not exceeding d. Let a = ( a 0 , a 1 , , a s 1 ) and x = ( x 0 , x 1 , , x s 1 ) be two vectors with each component randomly chosen from ( d , d ) . To satisfy the condition of quantum state, we need to normalize them, which gives
a = ( a 0 i = 0 s 1 a i 2 , a 1 i = 0 s 1 a i 2 , , a s 1 i = 0 s 1 a i 2 ) .
Moreover, we have
a = ( a 0 d i = 0 s 1 ( a i d ) 2 , a 1 d i = 0 s 1 ( a i d ) 2 , , a s 1 d i = 0 s 1 ( a i d ) 2 ) .
If a i is randomly chosen from ( d , d ) , then a i d is randomly chosen from ( 1 , 1 ) . Therefore, to simplify the computation, we can assume d = 1 . Similarly, we have
x = ( x 0 i = 0 s 1 x i 2 , x 1 i = 0 s 1 x i 2 , , x s 1 i = 0 s 1 x i 2 ) .
We consider the trend of the proportion of circulant matrix–vector combinations whose probability of obtaining the target state under this interval condition is greater than 1 2 s as the dimension s varies. We randomly selected 1000 sets of a and x for each s ( 1 , 2 , , 100 ) in the manner described above, and plotted Figure 9a based on the proportion of circulant matrix–vector combinations whose probability of obtaining the target state was greater than 1 2 s .
We notice that, as s increases, the values of the proportions from Figure 9a gradually approach 1. Therefore, we believe that our algorithm can effectively compute most of the circulant matrix–vector combinations on R with the norm of the elements in the matrix and vector not exceeding d, and the proportion of circulant matrix–vector combinations that can be effectively computed gradually approaches 1 as s increases. (It is obvious that the success rate is 1 when s = 1 ).
Further, we consider the computation of circulant matrix–vector products with the norm of elements not exceeding 1 over C , and discuss it in the same way as over R , obtaining (b) of Figure 9. We also believe that our algorithm can effectively compute most circulant matrix–vector combinations over C with the elements’ norm in matrix and vector not exceeding 1, and the proportion of circulant matrix–vector combinations that can be effectively computed gradually approaches 1 as s increases.
When the elements are all in R + , we can obtain more exciting results compared to the first two domains under the same conditions. We raised the baseline probability of the target to 1 2 . The proportion of circulant matrices and vector combinations that satisfy the condition of having a probability greater than 1 2 to measure the target state changes with the dimension s, as shown in Figure 9c. We find that this proportion also approaches 1 as s increases. Since 1 2 is a constant, for matrix–vector combinations that satisfy the condition of having a probability greater than 1 2 , we need k measurements to get the target state with a probability of more than 1 1 2 k .
Here, we also present some theoretical analysis results that we obtained. Let | a = k = 0 N 1 a k | k , | x = k = 0 N 1 x k | k ; then, we have
F 1 | a = 1 N j = 0 N 1 ( k = 0 N 1 a k e 2 π i j k N ) | j ,
F | x = 1 N j = 0 N 1 ( k = 0 N 1 x k e 2 π i j k N ) | j ,
( F 1 | a ) ( F | x ) = 1 N j 0 = 0 N 1 j 1 = 0 N 1 [ ( k = 0 N 1 a k e 2 π i j 0 k N ) ( k = 0 N 1 x k e 2 π i j 1 k N ) ] | j 0 | j 1 .
The coefficients of the basis state | j 0 | j 1 in the aforementioned state can be denoted as F j 0 j 1 . Let F t = j = 0 N 1 a j x j + t ; then, we have
F k k = 1 N t = 0 N 1 j = 0 N 1 a j x j + t e 2 π i t k N = 1 N t = 0 N 1 e 2 π i t k N F t
The probability of obtaining the target state is
k = 0 N 1 | F k k | 2 = k = 0 N 1 F k k · F k k ¯ = 1 N 2 k = 0 N 1 ( t = 0 N 1 e 2 π i t k N F t ) ( t = 0 N 1 e 2 π i t k N F t ¯ ) = 1 N 2 k = 0 N 1 ( t 0 = 0 N 1 t 1 = 0 N 1 e 2 π i k ( t 0 t 1 ) N F t 0 F t 1 ¯ ) = 1 N 2 t = 0 N 1 ( k = 0 N 1 F t F t ¯ ) = 1 N t = 0 N 1 F t F t ¯
We look forward to someone providing an explicit formula for the probability distribution that correspond to the above expression when the entries of | a and | b satisfy some specific distributions.
If the approach modified by the HHL algorithm is used, we only need to calculate the multiplication instead of finding the inverse, so we have the state
1 k = 0 N 1 ( λ k x ) 2 λ k ^ 2 C 2 k = 0 n 1 C λ k x λ k ^ | 0 | 0 m | Λ k
where C is chosen to be O ( 1 ) and λ k ^ = λ k λ m a x . Since λ k = j = 0 N 1 a j ω j k j = 0 N 1 | a j | N , λ m a x N . The complexity of quantum state extraction is O ( k = 0 N 1 ( λ k x ) 2 λ k ^ 2 C 2 ) = O ( k = 0 N 1 | F k k | 2 ) . So, our second algorithm has the same probability of obtaining the target state as the approach modified by the HHL algorithm.

5. Quantum Convolution Computation

Quantum machine learning is a rapidly developing direction in quantum computing. Quantum convolutional neural networks have been proposed for image recognition and classical information classification. An example of a convolutional neural network was first proposed in [11]. For a typical image recognition problem, the input image undergoes convolution to generate a feature map, which is then classified. Rather than completing general convolution calculations like classical convolutional neural networks, existing convolutional neural networks use one of the following three approaches to entangle different qubits and improve parameters through optimization algorithms: use a fully random circuit, treat the circuit as a black box, and simply use CNOT gates. In contrast, we can use a quantum circuit to complete general convolution calculations.
Here, we focus on the problem of image recognition. First, we consider the conversion from classical information to quantum information. For this goal, Venegas-Andraca et al. [19] proposed a storage method based on a “qubit lattice”, where each pixel in an input image is represented by a qubit, requiring at least 2 n bits of storage. Le et al. [20] proposed an FRQI model, which associates pixel values and positions through the tensor product of quantum states. One qubit is used to encode pixel values, and color information is encoded in the probability amplitude. In [21], a NEQR model was proposed, which also associates pixel values and positions through tensor products, but uses d qubits to encode pixel values and encodes grayscale information in the basis state. In [22], a QImR model is proposed to encode 2D images into quantum pure states. In this model, pixel values are represented by the probability amplitude of the quantum state, and pixel positions are represented by the basis state of the quantum state.
We used the QImR model and assumed that we completed the representation of the image. We considered a one-dimensional convolution calculation and, below, we give the definition of convolution calculation.
a = ( a 0 , a 1 , , a m 1 ) and x = ( x 0 , x 1 , , x n 1 ) are sequences of length m and n, respectively. Their convolution is denoted as h = ( h 0 , h 1 , , h m + n 2 ) , where h i = j = 0 i x j a i j .
We set D to be the minimal integer satisfying D m + n 1 and D = 2 l for certain l N . According to the definition of the QImR model, the quantum states | a and | x are given as follows: | a = i = 0 D 1 a i | i and | x = i = 0 D 1 x i | i , where a i and x i satisfy
a i = a i j = 0 m 1 a j 2 i [ 0 , m 1 ] 0 i ( m 1 , D )
x i = x i j = 0 n 1 x j 2 i [ 0 , n 1 ] 0 i ( n 1 , D )
Their convolution is denoted as | h = i = 0 D 1 h i | i , where h i satisfies
h i = h i ( j = 0 m 1 a j 2 ) ( k = 0 n 1 x k 2 ) i [ 0 , m + n 2 ] 0 i ( m + n 2 , D )
We plan to use circular matrix–vector multiplication to compute the convolution. The circular matrix corresponding to | a and required for convolution computation should be of the form
A = a 0 a D 1 a D 2 a 1 a 1 a 0 a D 1 a 2 a D 1 a D 2 a D 3 a 0
It should be noted that the matrix here is the transpose of the matrix we previously introduced. Therefore, we need to construct | a from | a , where | a = i = 0 D 1 a i | i and a i = a D i . We can first use apply an X gate to each qubit of the state | a = i = 0 D 1 a i | i to obtain i = 0 D 1 a D 1 i | i , then apply T 1 to obtain the target state | a . The complexity of this part is O ( log 2 D ) .
Then, our two different multiplication algorithms can be used according to different result requirements. Compared with the classical one-dimensional convolution with a complexity of O ( D log D ) , our algorithm can effectively accelerate it. The computation of two-dimensional convolution can also be extended in the same way.
In recent years, quantum neural networks have continuously developed, and improving their performance is a worthwhile research topic. For example, reference [23] proposes a new framework, ResQuNNs, as an improvement direction. The algorithm presented in this paper can improve the circuit of each layer and be combined with other methods to expect good results. On the other hand, quantum machine learning also poses significant challenges, such as the existence of plateaus. For this issue, improvements can be made in terms of framework and structure, as seen in references [24,25]. On the other hand, improvements can also be made to each layer of the circuit, combining the two aspects to further reduce the impact of high altitude.

6. Conclusions

We present two different algorithms for computing the multiplication of a circulant matrix and a vector. The two algorithms yielded results of different forms, and the appropriate algorithm can be chosen according to the computational needs. For most circulant matrices and vectors with elements in C or R , our algorithm has a complexity of O ( N log 2 N ) to compute their product. For most circulant matrices and vectors with elements in R + , we were able to reduce the complexity to O ( log 3 N ) , which achieves exponential acceleration compared to the classical complexity of O ( N log N ) for computing circulant matrix–vector multiplication.
Our algorithms are based on efficient quantum circuits for circulant matrices. With quantum circuits that can efficiently implement the quantum Fourier transforms, the multiplication of circulant matrices and vectors can be significantly accelerated. Compared to the HHL algorithm, our algorithms have the following advantages. First, we can complete the matrix operation through quantum circuits and corresponding vectors; hence, we no longer need to use quantum simulation to simulate the matrix to be calculated. Second, our complexity is no longer affected by the condition number, and we can present effective calculation for matrices with large condition numbers.
Furthermore, we have applied our approach to accelerate the basic convolution calculations for convolutional neural networks in machine learning. Our quantum circuit holds significant potential for applications in quantum machine learning, especially in convolutional neural networks.
In the success rate analysis of our second algorithm, we only presented some experimental results, which should also be expressed more clearly through probability theory in the future. Since different problems have different calculation intervals, finding more effective calculation intervals for this algorithm is also an interesting problem.

Author Contributions

Conceptualization, L.H. and Z.H.; formal analysis, L.H. and Z.H.; investigation, L.H. and Z.H.; methodology, L.H.; validation, Z.H. and C.L.; writing—original draft: L.H.; Writing—review and editing: Z.H. and C.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

The study did not require ethical approval.

Informed Consent Statement

The study did not involve humans.

Data Availability Statement

No new data were created or analyzed in this study. Data sharing is not applicable to this article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Shor, P. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comput. 1997, 26, 1484–1509. [Google Scholar] [CrossRef]
  2. Grover, L. Fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on the Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996. [Google Scholar]
  3. Harrow, A.; Hassidim, A.; Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 2009, 103, 150502. [Google Scholar] [CrossRef] [PubMed]
  4. Golub, G.H.; Van Loan, C.F. Matrix Computations; The Johns Hopkins University Press: Baltimore, MD, USA, 1996. [Google Scholar]
  5. Attendu, J.-M.; Ross, A. Skew-circulant matrix formulation for transient near-field acoustical holography. In Proceedings of the 20th International Congress on Sound & Vibration, Bangkok, Thailand, 7–11 July 2013. [Google Scholar]
  6. Hellings, C.; Utschick, W. Block-skew-circulant matrices in complex-valued signal processing. IEEE Trans. Signal Process. 2015, 63, 2093–2107. [Google Scholar] [CrossRef]
  7. Liu, Z.; Chen, S.; Xu, W.; Yulin, Z. The eigen-structures of real (skew) circulant matrices with some applications. Comput. Appl. Math. 2019, 38, 178. [Google Scholar] [CrossRef]
  8. Zhou, S.; Wang, J. Efficient quantum circuits for dense circulant and circulant like operators. R. Soc. Open Sci. 2017, 4, 160906. [Google Scholar] [CrossRef]
  9. Wan, L.-C.; Yu, C.-H.; Pan, S.; Gao, F.; Wen, Q.-Y.; Qin, S.-J. Asymptotic quantum algorithm for the toeplitz systems. Phys. Rev. A 2018, 97, 062322. [Google Scholar] [CrossRef]
  10. Daskin, A. Quantum implementation of circulant matrices and its use in quantum string processing. arXiv 2022, arXiv:2206.09364. [Google Scholar]
  11. Cong, I.; Choi, S.; Lukin, M. Quantum convolutional neural networks. Nat. Phys. 2019, 15, 1273–1278. [Google Scholar] [CrossRef]
  12. Henderson, M.; Shakya, S.; Pradhan, S.; Cook, T. Quanvolutional neural networks: Powering image recognition with quantum circuits. Quantum Mach. Intell. 2020, 2, 2. [Google Scholar] [CrossRef]
  13. Liu, J.; Lim, K.H.; Wood, K.; Huang, W.; Chu, G.; Huang, H.-L. Hybrid quantum-classical convolutional neural networks. Sci. China Phys. Mech. Astron. 2021, 64, 290311. [Google Scholar] [CrossRef]
  14. Grover, L.; Rudolph, T. Creating superpositions that correspond to efficiently integrable probability distributions. arXiv 2002, arXiv:quant-ph/0208112v1. [Google Scholar]
  15. Soklakov, A.; Schack, R. Efficient state preparation for a register of quantum bits. Phys. Rev. A 2004, 73, 012307. [Google Scholar] [CrossRef]
  16. Giovannetti, V.; Lloyd, S.; Maccone, L. Quantum random access memory. Phys. Rev. Lett. 2008, 100, 160501. [Google Scholar] [CrossRef] [PubMed]
  17. Brassard, G.; Hoyer, P.; Mosca, M.; Tapp, A. Quantum amplitude amplification and estimation. AMS Contemp. Math. Ser. 2000, 305, 53–74. [Google Scholar]
  18. Cuccaro, S.; Draper, T.; Kutin, S.; Moulton, D. A new quantum ripple-carry addition circuit. arXiv 2004, arXiv:quant-ph/0410184v1. [Google Scholar]
  19. Venegas-Andraca, S.; Bose, S. Storing, processing and retrieving an image using quantum mechanics. In Proceedings of the SPIE—The International Society for Optical Engineering, San Diego, CA, USA, 3–5 March 2003; Volume 5105. [Google Scholar]
  20. Le, P.; Iliyasu, A.; Dong, F.; Hirota, K. A flexible representation of quantum images for polynomial preparation, image compression and processing operations, quantum inf. Quantum Inf. Process. 2011, 10, 63–84. [Google Scholar] [CrossRef]
  21. Zhang, Y.; Lu, K.; Gao, Y.; Wang, M. NEQR: A novel enhanced quantum representation of digital images. Quantum Inf. Process. 2013, 12, 2833–2860. [Google Scholar] [CrossRef]
  22. Yao, X.-W.; Wang, H.; Liao, Z.; Chen, M.-C.; Pan, J.; Li, J.; Zhang, K.; Lin, X.; Wang, Z.; Luo, Z.; et al. Quantum image processing and its application to edge detection: Theory and experiment. Phys. Rev. X 2017, 7, 031041. [Google Scholar] [CrossRef]
  23. Kashif, M.; Shafique, M. ResQuNNs:towards enabling deep learning in quantum convolution neural networks. arXiv 2024, arXiv:2402.09146. [Google Scholar]
  24. Kashif, M.; Rashid, M.; Al-Kuwari, S.; Shafique, M. Alleviating barren plateaus in parameterized quantum machine learning circuits: Investigating advanced parameter initialization strategies. arXiv 2023, arXiv:2311.13218. [Google Scholar]
  25. Kashif, M.; Al-Kuwari, S. ResQNets: A residual approach for mitigating barren plateaus in quantum neural networks. EPJ Quantum Technol. 2024, 11, 4. [Google Scholar] [CrossRef]
Figure 1. Quantum circuit for the quantum Fourier transform.
Figure 1. Quantum circuit for the quantum Fourier transform.
Information 15 00453 g001
Figure 2. Quantum addition circuit.
Figure 2. Quantum addition circuit.
Information 15 00453 g002
Figure 3. Sub-circuits of quantum addition circuit.
Figure 3. Sub-circuits of quantum addition circuit.
Information 15 00453 g003
Figure 4. Quantum controlled-U circuit.
Figure 4. Quantum controlled-U circuit.
Information 15 00453 g004
Figure 6. Quantum extraction circuit.
Figure 6. Quantum extraction circuit.
Information 15 00453 g006
Figure 7. Quantum C-T circuit.
Figure 7. Quantum C-T circuit.
Information 15 00453 g007
Figure 8. Quantum circuit for doubling.
Figure 8. Quantum circuit for doubling.
Information 15 00453 g008
Figure 9. Proportion of valid circulant matrix–vector combinations on different domains with the change of dimension.
Figure 9. Proportion of valid circulant matrix–vector combinations on different domains with the change of dimension.
Information 15 00453 g009
Table 1. Comparison of HHL method, Algorithm 1, and Algorithm 2.
Table 1. Comparison of HHL method, Algorithm 1, and Algorithm 2.
HHL MethodAlgorithm 1Algorithm 2
Hamiltonian simulationneedneed notneed not
QPEneedneed notneed not
Number of auxiliary qubits O ( log ( N ) ) 2 log ( N ) + 2 log ( N )
Measurement probability O ( N ) O ( N ) O ( N )
Errorexistnono
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Hou, L.; Huang, Z.; Lv, C. Quantum Algorithms for the Multiplication of Circulant Matrices and Vectors. Information 2024, 15, 453. https://doi.org/10.3390/info15080453

AMA Style

Hou L, Huang Z, Lv C. Quantum Algorithms for the Multiplication of Circulant Matrices and Vectors. Information. 2024; 15(8):453. https://doi.org/10.3390/info15080453

Chicago/Turabian Style

Hou, Lu, Zhenyu Huang, and Chang Lv. 2024. "Quantum Algorithms for the Multiplication of Circulant Matrices and Vectors" Information 15, no. 8: 453. https://doi.org/10.3390/info15080453

APA Style

Hou, L., Huang, Z., & Lv, C. (2024). Quantum Algorithms for the Multiplication of Circulant Matrices and Vectors. Information, 15(8), 453. https://doi.org/10.3390/info15080453

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop