Efficient quantum circuit for singular value thresholding
Singular value thresholding (SVT) operation is a fundamental core module in many mathematical models in computer vision and machine learning, particularly for many nuclear norm minimizing-based problems. We presented a quantum SVT (QSVT) algorithm which was used as a subroutine to address an image classification problem. This algorithm runs in , an exponential speed improvement over the classical algorithm which runs in . In this study, we investigate this algorithm and design a scalable quantum circuit for QSVT. In the circuit design, we introduce an adjustable parameter to ensure the high probability of obtaining the final result and the high fidelity of actual and ideal final states. We also show that the value of can be computed ahead of implementing the quantum circuit when the inputs of the QSVT algorithm, i.e. matrix and constant , are given. In addition, we propose a small-scale quantum circuit for QSVT. We numerically simulate and demonstrate the performance of this circuit, verifying its capability to solve the intended SVT. The quantum circuit for QSVT implies a tempting possibility for experimental realization on a quantum computer.
Quantum computing has been shown to perform significantly better than classical computing at certain computational tasks, especially in the emerging interdisciplinary field of quantum machine learning Nielsen and Chuang (2010); Sentís et al. (2012); Schuld et al. (2014); Wittek (2014). To show its superiority, remarkable quantum algorithms help a range of classical algorithms achieve a speedup increase Shor (1994); Grover (1997); Durr and Hoyer (1996); Brassard et al. (2000); Giovannetti et al. (2008); Harrow et al. (2009); Y et al. (2017); Li et al. (2016). Shor’s algorithm for factoring and Grover’s algorithm for search are typical algorithms which can achieve exponential and quadratic speed increase, respectively Shor (1994); Grover (1997). In 2009, Harrow, Hassidim, and Lloyd (HHL) proposed an algorithm for solving linear systems of equations Harrow et al. (2009). This algorithm offers an exponential speed over its classical counterparts by calculating the expectation value of an operator associated with the solution of the linear equation under certain circumstances. Considering that a linear system is the centre of various areas in science and engineering, the HHL algorithm guarantees widespread applications Lloyd et al. (2014); Rebentrost et al. (2016, 2014). Inspired by the idea of the HHL algorithm, other fruitful quantum machine learning algorithms are proposed Liu and Zhang (2016); Schuld et al. (2016a); Adcock et al. (2015); Qi et al. (2013); Yu et al. (2016). Moreover, experimentalists aim to implement the HHL algorithm on a quantum computer. Therefore, research on the numerical theoretical simulation and experimental realization of the algorithm is emerging recently Cao et al. (2012a); Pan et al. (2013); Cai et al. (2013); Stefanie et al. (2014).
In many mathematical models in computer vision and machine learning, there is a fundamental core module known as singular value thresholding (SVT). In particular, the SVT method has been widely adopted to solve many nuclear norm minimizing (NNM)-based problems, such as matrix completion, matrix denoising and robust principle component analysis (RPCA). Therefore, the SVT method can be applied to many applications, such as image extraction, image colorization, image denoising, image inpainting and motion capture date recovery. However, NNM usually requires the iterative application of singular value decomposition (SVD) for SVT and the computational cost of SVD may be too expensive to handle data with high dimension, e.g. high-resolution images. In order to speed up the process of SVT, we proposed a quantum SVT (QSVT) algorithm that can execute the SVT operator exponentially faster than its classical counterparts. The QSVT algorithm is used as a subroutine to accelerate an image classifier SMM Duan et al. (2017).
In this article, we conduct further specific discussion regarding the algorithm and design a quantum circuit for QSVT which can be applied on a universal quantum computer. Ref. Duan et al. (2017) shows that the QSVT algorithm is based on the HHL algorithm which consists of two core subroutines, namely, phase estimation and controlled rotation. Phase estimation outputs the eigenvalues of input matrix and decompose the input vector in the eigenbasis of . Innovating and implementing controlled rotation are the key of HHL-based algorithms. Herein, we add an important missing piece to the algorithm by developing the detailed circuit of the controlled rotation via the theoretical function in Ref. Duan et al. (2017). Specifically, we divide the controlled rotation into two unitary operations. The first unitary operation is , which is used to compute the function of the eigenvalues of . By implementing the Newton iteration method, these function values can be stored in the quantum basis states. The second unitary operation is , which is used to extract the values in the quantum basis state to the corresponding amplitudes of the basis states. Implementing directly affects the probability of obtaining the final result and the fidelity of actual and ideal final states. To improve probability and fidelity, we introduce a parameter in , which can be computed ahead of quantum circuit implementation. Moreover, we present an example of a small-scale circuit for the algorithm and execute the numerical simulation of the example. The result shows the capability of the quantum computer to solve the intended SVT, and the performance of the algorithm is discussed.
In detail, our work has two major contributions. First, we design a quantum circuit for QSVT algorithm, which provides a possibility for implementing the algorithm on a quantum computer. Second, by introducing the parameter , which can be computed ahead of implementing the quantum circuit, in the circuit design of controlled rotation, high probability and high fidelity can be obtained. Our work based on the QSVT algorithm may also inspire the circuit design of other HHL-based algorithms.
Ii Review of QSVT
In this section, we briefly review the QSVT problem and the key procedure of QSVT algorithm. More detailed information can be found in Ref. Duan et al. (2017).
ii.1 QSVT problem
SVT is an algorithm based on the SVD of a matrix. Suppose the input of the SVT is a low-rank matrix with singular value decomposition , where is the rank of , and are just the singular values of , with and being the left and right singular vectors. SVT solves the problem , where and Cai et al. (2008). The vectorization of the matrices and are and , which vary as the quantum states and respectively, where and . Therefore, the QSVT algorithm solves the transformed problem Duan et al. (2017).
ii.2 QSVT algorithm
Let , therefore . The QSVT algorithm is now shown as follows Duan et al. (2017):
Input. A quantum state , a unitary , and a constant .
Output. A quantum state .
Algorithm. . The procedure of the algorithm can be illustrated as a sequence of the unitary operations:
Eq. (1) shows that the QSVT algorithm consists of two core subroutines, namely, and .
(1) The first core subroutine is presented as follows:
where register stores the estimated eigenvalues of an Hermite matrix , register stores the input state , is the inverse quantum Fourier transform, and is the conditional Hamiltonian evolution Harrow et al. (2009). The Hermite matrix determines which eigenspace the quantum algorithm implements on. Note that , where are the eigenvectors of and the corresponding eigenvalues are . By taking a partial trace of , the density matrix that represents can be obtained Schuld et al. (2016b): .
(2) The second core subroutine aims to ‘extract’ and then ‘reassign’ the proportion of each eigenstate in the superposition . In particular, helps change the probability amplitude of each basic state from to via a transformation . Without loss of generality, is defined as follows: if :
otherwise do nothing.
Iii QSVT circuit
In this section, we further study the QSVT algorithm Duan et al. (2017) based on the quantum circuit model. It provides the ability for the quantum computer to solve many NNM-based problems. Firstly, we describe the overview model of quantum circuit for QSVT. Secondly, we investigate in depth the realization of controlled rotation via quantum circuit. In particular, we introduce an adjustable parameter in the controlled rotation step and demonstrate that the value of can be computed ahead of implementing the quantum circuit to ensure high probability and high fidelity readout.
The overview of the circuit for solving QSVT is shown in Fig 1. We omit the ancilla in the following register presentation because it remains the same during the procedure of the quantum circuit.
(1) Prepare the quantum registers in the state
where the input matrix has been prepared quantum mechanically as a quantum state stored in the quantum register .
(2) Perform the unitary operation on the state . Recall where are the eigenstates of and are the corresponding eigenvalues. As shown in Ref. Duan et al. (2017), we have the state
(3) The unitary converts the eigenvalues stored in the register to the intermediate result stored in the register , where . The state is now
(4) To realize : , i.e., to ‘extract’ the value of in register to the amplitude of the ancilla qubit, we introduce a unitary with parameter (see Sec. III.2) to approximate :
Subsequently, is applied to the ancilla qubit on the top of the circuit and controlled by the register . We obtain the state
(5) Uncompute the registers , and , and remove the register and , we have
(6) Measure the top ancilla bit. If the result returns to 1, then the register of the system collapses to the state final state
In summary, the procedure of the quantum circuit can be illustrated as follows:
iii.1 Computation of
We deal with the computation of the function of the eigenvalues of : . Here we use Newton iteration to compute if . The initial approximation is selected as such that . To obtain the final state we design the iteration step as: . The quantum circuit shown in Fig 2 computes . This circuit involves quantum circuits for addition and multiplication which have been studied Vedral et al. (1996); Parent et al. (2017). Quantum circuits for division can be implemented by the inverse of the multiplication.
iii.2 Computation of
A sequence of rotations about the axis can be used to implement the unitary Cao et al. (2012b), where . Here we introduce a parameter , which can be used to improve the probability and accuracy of obtaining the final state. Assume that we have obtained a -qubit state . Consider the binary representation of : , there is
where is the Pauli operator. The quantum circuit of is shown in Fig. 3.
iii.3 Probability and fidelity analysis
We now analyze the probability of obtaining the final result and the fidelity of the ideal and actual outputs. Eqs. (1) and (11) show that the quantum circuit is a unitary approximation of the quantum algorithm . Without loss of generality, we assume that there is no error in any step of and . Therefore, the unitary in dominates the probability and the fidelity in the quantum circuit. We now analyze how to compute the parameter in to ensure high probability and high fidelity readout.
The fidelity of the actual and ideal final results can be calculated via the inner product of the output and the theoretical output :
To ensure high probability and high fidelity, we introduce function of :
and to find that maximizes , i.e. to solve the problem . This problem is transformed to solve the following equation:
A series of methods, such as gradient descent, Newton’s method, evolutionary algorithms, can be used to solve Eq. (16). Given that the problem to be solved is not convex, these iterative algorithms can only output locally optimal solution. Tayler’s series can also be used to solve this problem and obtain an approximate solution.
Instead of using the aforementioned methods, we select an ‘intuitive’ method to compute an approximate solution for this problem. As , we denote , for . Recall that , . The period of the are , thereby satisfying . We now consider the case that the value satisfies , therefore, .
Eq. (16) shows that . Therefore,
and considering , we obtain the approximate solution .
Although the approximate solution is not the optimal solution, it has two advantages. Firstly, it has simpler expression and can be computed more efficiently compared with iterative algorithms. Secondly, this ‘intuitive’ solution is only based on the maximized singular value of , i.e. priori knowledge of is only the maximum singular value instead of all singular values of compared with Tayler’s series method (see Appendix A).
The following experiments shows that is possibly a good solution to ensure high probability and fidelity. Recall that the applications of SVT are mainly based on videos or pictures. Thus, we select 120 different inputs of matrix , which are derived from random pictures.
Fig. 4 shows that the axis represents the 120 inputs. Fig. 4(a) and (b) show the probability and the fidelity in terms of different , which are obtained by Tayler’s method (in blue dashed line) and our ‘intuitive’ method (in red ’+’), respectively. The numerical results show that our ‘intuitive’ method works well as the Tayler’s method. The probability is almost the same in terms of obtained by our method and Tayler’s method. Moreover, fidelity performs slightly better when our method is used instead of the Tayler’s method. Both methods can help output the high probability and high fidelity in the context of the 120 different random inputs.
In this section, we design and implement a numerical simulation experiment of a small-scale QSVT circuit and analyze the results. The purpose for this example is to illustrate the algorithm and for potential experimental implementation using currently available resource.
We demonstrate a proof-of-principle experiment of the QSVT algorithm. This simple quantum circuit solves a meaningful instance of the problem, that is, to perform the SVT on a dimension matrix . For the numerical example, we select different inputs of all satisfying that the singular values of are . Matrix is selected such that the eigenvalues of are 4 and 1, which can be exactly encoded with three qubits in register . Without loss of generality, let . This allows us to optimize the subroutine (in Fig 1) without involving register and ancilla qubits . The input state of register is a normalized quantum state .
The initial quantum system is . Phase estimation generates the states that encodes the eigenvalues of in register , and subsequently, the system is in the superposition : . The mapping of the operator is: and where the outputs and can be interpreted as the encodings and respectively. After the operator, the system becomes . Then we use in register as the control register to execute a sequence of Pauli rotations on the ancilla qubit with . Take the inverse of all the operations before , measure the ancilla qubit to be , the system now becomes
The theoretical result is as follows:
Our results may motivate experimentalists to verify this result by implementing the quantum circuit with capability of addressing 6 or more qubits and execute basic quantum gates on their setups.
Nowadays, the quantum circuit model is the most popular and developed model for universal quantum computation. We further investigated the QSVT algorithm which we proposed in Ref. Duan et al. (2017) by providing the possibility to implement the algorithm on a quantum computer via the circuit model. The scalable quantum circuit is presented, in which the key subroutine of the controlled rotation is designed by introducing an adjustable parameter . We provided two methods to compute the value of to ensure high probability and high fidelity readout and conducted numerical experiments. The numerical results show that under different inputs, our method can output high probability and high fidelity in one iteration of the quantum circuit. Furthermore, we present a small-scale circuit as an example to verify the algorithm. We hope that our research motivates experimentalists to conduct new investigations in quantum computation.
Appendix A Tayler’s series method
Using Tayler’s series method to solve Eq. (16), we have
If the 2-order approximation is selected, then
If the 4-order approximation is selected, then
Acknowledgements.We would like to thank Patrick Rebentrost, Maria Schuld, Shengyu Zhang and Chaohua Yu for helpful discussions. This work was supported by the Funding of National Natural Science Foundation of China (Grants No. 61571226 and No.61701229), the Jiangsu Innovation Program for Graduate Education (Grant No.KYLX15_0326), and the Fundamental Research Funds for the Central Universities.
- Nielsen and Chuang (2010) M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information: 10th Anniversary Edition (Cambridge University Press, 2010) pp. 1–59.
- Sentís et al. (2012) G. Sentís, J. Calsamiglia, R. M. Tapia, and E. Bagan, Scientific Reports 2, 708 (2012).
- Schuld et al. (2014) M. Schuld, I. Sinayskiy, and F. Petruccione, Contemporary Physics 56, 172 (2014).
- Wittek (2014) P. Wittek, Quantum machine learning what quantum computing means to data mining (Elsevier (Singapore) Pte Ltd., 2014).
- Shor (1994) P. Shor, in Symposium on Foundations of Computer Science. IEEE Computer Society (1994) pp. 124–134.
- Grover (1997) L. K. Grover, Phys. Rev. Lett. 79, 325 (1997).
- Durr and Hoyer (1996) C. Durr and P. Hoyer, Computer Science (1996).
- Brassard et al. (2000) G. Brassard, P. Hoyer, M. Mosca, and A. Tapp, Quantum Computation & Information 5494, 53 (2000).
- Giovannetti et al. (2008) V. Giovannetti, S. Lloyd, and L. Maccone, Phys. Rev. Lett. 100, 160501 (2008).
- Harrow et al. (2009) A. W. Harrow, A. Hassidim, and S. Lloyd, Phys. Rev. Lett. 103, 150502 (2009).
- Y et al. (2017) L. Y, Y. J, D. B, and D. Li, arXiv:1709.05015v3 (2017).
- Li et al. (2016) D. Li, M. Gettrick, G. M., J. F., Xu, and Q. Wen, Phys. Rev. A 93, 042323 (2016).
- Lloyd et al. (2014) S. Lloyd, M. Mohseni, and P. Rebentrost, Nature Physics 10, 108 (2014).
- Rebentrost et al. (2016) P. Rebentrost, A. Steffens, and S. Lloyd, arXiv:1607.05404 (2016).
- Rebentrost et al. (2014) P. Rebentrost, M. Mohseni, and S. Lloyd, Phys. Rev. Lett. 113, 130503 (2014).
- Liu and Zhang (2016) Y. Liu and S. Zhang, Theoretical Computer Science 9130, 204 (2016).
- Schuld et al. (2016a) M. Schuld, I. Sinayskiy, and F. Petruccione, Phys.Rev.A 94 (2016a).
- Adcock et al. (2015) J. Adcock, E. Allen, M. Day, S. Frick, J. Hinchliff, M. Johnson, S. Morleyshort, S. Pallister, A. Price, and S. Stanisic, arXiv:1512.02900 (2015).
- Qi et al. (2013) B. Qi, Z. Hou, L. Li, D. Dong, G. Xiang, and G. Guo, Scientific Reports 3, 3496 (2013).
- Yu et al. (2016) C.-H. Yu, F. Gao, Q.-L. Wang, and Q.-Y. Wen, Phys. Rev. A 94, 042311 (2016).
- Cao et al. (2012a) Y. Cao, A. Daskin, S. Frankel, and S. Kais, Molecular Physics 110, 1675 (2012a).
- Pan et al. (2013) J. Pan, Y. Cao, X. Yao, and e. Zhaokai Li, Phys. Rev. A 89, 1150 (2013).
- Cai et al. (2013) X.-D. Cai, C. Weedbrook, Z.-E. Su, and e. M.-C. Chen, Phys. Rev. Lett. 110, 230501 (2013).
- Stefanie et al. (2014) B. Stefanie, I. Kassal, and e. Martin Ringbauer, Scientific Reports 4, 6115 (2014).
- Duan et al. (2017) B. Duan, J. Yuan, Y. Liu, and D. Li., Phys. Rev. A. 96, 032301 (2017).
- Cai et al. (2008) J. F. Cai, E. J. Candes, and Z. Shen, Siam Journal on Optimization 20, 1956 (2008).
- Schuld et al. (2016b) M. Schuld, I. Sinayskiy, and F. Petruccione, arXiv:1601.07823 (2016b).
- Cao et al. (2012b) Y. Cao, A. Papageorgiou, I. Petras, J. Traub, and S. Kais, New Journal of Physics 15(2) (2012b).
- Vedral et al. (1996) V. V. Vedral, A. Barenco, and A. Ekert, Phys. Rev. A. 54, 147 (1996).
- Parent et al. (2017) A. Parent, M. Roetteler, and M. Mosca, arXiv preprint (2017).