I Introduction
For quantum systems, there exist both discrete and continuous variables, and they may interact with each other. A typical example is an lightatom interacting system, which demonstrates how discrete energy levels and continuous light fields evolve quantum mechanically. Notably, a hybrid scenario of information processing using both discrete and continuous variables has been proposed before Furusawa and Van Loock (2011); Andersen et al. (2015); Lloyd (2000); van Loock et al. (2008); Proctor et al. (2017), such as hybrid quantum computing Lloyd (2000); van Loock et al. (2008); Proctor et al. (2017). The relevant advantages have been indicated in tasks like quantum float computing Lloyd and Braunstein (1999)
and quantum phase estimation(QPE)
Lloyd (2000); Liu et al. (2016), in which infinite dimensions of continuous variables are exploited Lau and Plenio (2016); Lau et al. (2017); Aaronson (2015); Liu et al. (2016), making the proposals promising.As is known, machine learning plays an important role for extracting worthwhile information and making trustable predictions in an era of big data C. M. Bishop (2006). In addition, a magnificent combination of machine learning and quantum mechanics has opened a new window for information processing Biamonte et al. (2017); Wiebe et al. (2012); Schuld et al. (2015); Lloyd et al. (2014); Rebentrost et al. (2014); Dunjko et al. (2016); Lloyd et al. (2016); Wang (2017). A class of quantum machine learning Harrow et al. (2009); Clader et al. (2013); Pan et al. (2014); Wang (2017) is based on the HarrowHassidim Lloyd (HHL) algorithm that aims to obtain the inverse of a matrix with exponential speedup under reasonable conditions Harrow et al. (2009). Normally, quantum linear regression has been regarded as a representative task in quantum machine learning and investigated by various allqubit approaches Wiebe et al. (2012); Schuld et al. (2016); Wang (2017)
. The algorithms for quantum linear regression usually consist of several main parts, namely quantum phase estimation, regularization, singular value transformation, and prediction. All of these approaches require ancillary qubits to register singular values in quantum phase estimations that are necessary for quantum linear regression. Depending on the desired precision, the number of ancillary qubits may be large, which demands a more rare resource of qubits and is a grand challenge for current quantum technology. On the other hand, the quantum phase estimation can be implemented much more efficiently using the hybrid approach
Lloyd (2000), which requires merely one qumode based on appropriate squeezing states Liu et al. (2016). This motivates us to work out a quantum algorithm of linear regression using the hybrid approach with desired quantum advantages.In this paper, we first introduce how to convert a linear regression into a quantum task. We then recall the quantum algorithms of allqubit systems, and analyze their properties. We emphasize the demanding of ancillary qubits, and the inefficiency of incorporating regularization and realizing singular value transformation. By introducing qumodes, we propose a hybrid approach for quantum linear regression, where single values are encoded into the entangled two qumodes and single value transformation can be implemented simply by homodyne measurements with postselection. This makes the algorithm more feasible for future physical implementation as it involves basic continuous variable quantum operations, in contrast to the allqubit approach that requires complicated quantum circuits for quantum arithmetic and controlrotation. A brief proposal for a physical realization of the algorithm with trapped ions is suggested. Our results show that the hybrid approach still retains the same order of runtime as the allqubit approach. The regularization can be incorporated by a controlledphase gate on two qumodes, and it may greatly reduce the required squeezing factor for the case of bad condition number Harrow et al. (2009); Aaronson (2015). We also investigate a basic role of the finite squeezing factor, and find that it is not only helpful for running the algorithm efficiently, but also may be taken as an extra regularization for regression.
The paper is organized as follows. We introduce quantum linear regression in Sec. II, and give an analysis of the existing allqubit approach in Sec. III. Then, in Sec. IV we present the quantum algorithm using qumodes and its physical implementation in trapped ions. Finally, discussions and conclusions are given in Sec. V.
Ii Quantum version of linear regression
In this section, we will demonstrate how to formulate the linear regression as a quantum problem that may be solved using quantum algorithm. Let us first introduce the linear regression. Given a training dataset of points , where
is a vector of
features and is the target value, the goal is to learn a linear model with parameters that can give the prediction for new data as . The parameterscan be estimated by minimizing the loss function of leastsquare errors
(1) 
over . Here is a regularization term with parameter , which is usually considered in machine learning for better performance. It will be shown later that the regularization is helpful for efficiently implementing the quantum algorithm. Introducing the matrix notation , the linear regression solution turns out to be , where the MoorePenrose pseudoinverse (with term) reads . Here
is the identity matrix. It is inspiring to study the linear regression by using the singular value decomposition of
by Schuld et al. (2016), . Here are singular values ofwith corresponding left (right) eigenvector
(). Now it can be verified that the MoorePenrose pseudoinverse reads as . Then, the prediction can be written as .To formulate a quantum version of linear regression, we need to encode each component as a quantum state or a quantum operator. For a vector , the amplitude encoding scheme is taken to encode into a quantum state as . Here ,where is a binary representation of integer , and it requires a number of qubits. Accordingly, and are encoded as and , respectively. Without loss of generality, we assume all quantum states in this paper are normalized, and the final result should be rescaled accordingly. The remaining question now is how to treat . It is natural to take it as a operator, and the prediction finally writes as . One should pay special attention to the following aspects for this approachWiebe et al. (2012). Firstly, is not necessary a square matrix, and the Hilbert space should be extended to define a square matrix that contains . Secondly, two HHLlike algorithms for applying and sequentially are required. Thirdly, both and are not unitary in general, there must be some nonunitary procedure such as measurements or projections in the algorithm. Thus, measurement is required in the middle of the algorithm.
An alternative approach to circumvent the above problems is to treat as a quantum state Schuld et al. (2016)
. This is possible by rewriting the prediction as a tensor formula
which is an inner product between two vectors. Accordingly, we may write the quantum state corresponds to as , where is introduced for normalization. Then, the prediction is obtained as the inner product between and , up to a constant factor .
On the other hand, the input data can be loaded as a quantum state , where the second equality comes from Schmidt decomposition. Thus, the key task is to find a quantum algorithm that transforms to . After loading data as initial state , different quantum techniques may be used to steer the system from initial state to the target state .
Since both and are bipartite quantum states, an investigation of their entanglement structure may inspire the design of the quantum algorithm. They share the same entangling basis of with different coefficients, where are eigenstates in feature space and are eigenstates related to sample space. Then a quantum algorithm can be devised that keeps those basis unchanged, while the coefficients are transformed in the form of . Such a transformation has been realized using ancillary qubits Harrow et al. (2009); Wiebe et al. (2012); Schuld et al. (2016).
It should be pointed out that focusing on instead of the states of parameters , which is defined as for parameters , has its own advantages, especially when there are multiple target values for linear regression. For example, based on the features of one person, one can predict two target values such as both income and cost. In such a case, predictions are obtained by inner product of and ( for income and cost), separately. In other words, once is obtained it can be applied for linear regression with different target vectors. On the other hand, is specified to fixed target value. Moreover, one may construct the later from the former for each target vector as
(2) 
In this sense, is more fundamental than . In our implementation, we adopt this more efficient way.
Iii Existing allqubit approach
Before proposing the hybrid approach using both qubits and qumodes, we first recall how to do quantum linear regression with allqubit systems, where regularization has not been considered Wiebe et al. (2012); Schuld et al. (2016); Wang (2017). An analysis is given to show that the allqubit approach demands for lots of ancillary qubits in several main procedures of quantum linear regression. This motives us to propose a hybrid approach that is more efficient.
Basically, there are two subroutines in the algorithm of allqubit approach. Firstly, quantum phase estimation is applied that registers in ancillary qubits; secondly, coefficients are obtained by a conditional rotation on an extra ancillary qubit and then a projection to state. The success rate of projecting to is proportional to the conditional number , where stands for largest/smallest singular values of . Under bad conditional number, e.g., (which naturally arise for lowrank ), the runtime will scale with and thus destroy the exponentially speedup. This issue, as will be demonstrated later, can be remedied by introducing regularization.
We analyze the cost of resource, especially on the number of qubits. For the quantum phase estimation, firstly, series of with different time should be constructed. Secondly, since are typically continuous numbers, to encode them with precision a number of qubits is required. If regularization is included, a quantum circuit for quantum addition is required, which requires extra qubits. For singular value transformation, to realize the required conditional rotation an oracle should be constructed which would involve many qubits depending on the precision. Importantly, for all processes, although lots of ancillary qubits should be used, they would be discarded finally. Since their role is just to register singular values and further give singular value transformation, it is desirable for alternative approach that requires less resource of qubits.
It is known that the quantum phase estimation as well as the quantum addition are more naturally and efficiently implemented in a quantum system with continuous variables Lloyd and Braunstein (1999) (also see Appendix A). On the other hand, vectors of classical data are better encoded in quantum states of qubit systems, as each component of a vector now becomes the corresponding amplitude directly, while encoding in qumodes this would be much complicated Lau and Plenio (2016); Lau et al. (2017). Given the above two considerations, it naturally calls for a hybrid quantum computing approach that exploits both the advantages of qubits and qumodes, as would be explored in this paper.
Iv Quantum algorithm using two auxiliary qumodes
We present the quantum algorithm for linear regression using two auxiliary qumodes. Further discussions will be presented in Sec. V. We introduce qumodes and , which are eigenstates of conjugate quadrature field operators and (such as momentum and position operators), respectively. As , we have . It should be emphasized that the squeezing factor can not be infinite physically. Nevertheless, we first present the algorithm for the case of infinite squeezing, as the main procedures of the algorithm is more clearly revealed. We then stress the importance of finite squeezing and modify the algorithm accordingly.
The algorithm under infinite squeezing can be summarized as following:

Quantum phase estimation. Perform on which leads to
This step encodes singular values of into the entangled two qumodes.

Regularization. For a preset regularization parameter
which is a hyperparameter, perform
that shifts mode to . Different values of can be tried that a specified can be chosen to get good enough performance of prediction. 
Singularvalue transformation. After a homodyne detection on qumode with result , the state collapses to , where qumodes are discarded since they are disentangled from qubits. This step transforms quantum amplitudes from to .

Prediction. For new data , prepare the reference state . The prediction is proportional to the inner product between the target state and , denoted as , which can be implemented using the method introduced in Refs. Rebentrost et al. (2014); Cai et al. (2015). The key point is to introduce an ancillary qubit to firstly construct an entangled state . This can be achieved by setting the ancillary qubit in as a control state, and when the ancillary qubit is in the reference state is prepared, and when in state is prepared. Then, conditioned on state, procedures of for the algorithm are performed to generate , e.g., by attaching a control to all operations in procedures of , which lead to a state . Then, a measurement on the ancillary qubit of quantum state gives the output
with probability
. Thus .
The abovepresumed infinite squeezing factor is impractical in implementation, and success rate for postselecting is vanishing.
We now take finite squeezing into account, which leads to a modification of the algorithm in three places. Firstly, in the state preparation two qumodes are prepared as
with a squeezing factor . Since , at limit. Secondly, in the singularvalue transformation, to fully disentangle qubits and qumodes, two qumodes are postselected as and using homodyne detection. To get a nonzero success rate, we can let the point locates within a small area proportional to centered at (see Appendix B). Now, the unnormalized state can be written as
(3) 
where at the limit . Here . Compared with , each coefficient now is multiplied by correspondingly. When , the state reduces to . In this sense characterizes an error. We may take as an extra regularization due to finite squeezing, which will be discussed in Sec. V. Thirdly, we use in the prediction. Note is up to a factor to the required prediction as . Such a factor can be obtained as the ratio between and . Here is the predicted value of training data . The factor can be more accurate by averaging on predicted values of a number of training data.
At this stage, we proceed to give some implementation details. While involving only with qumodes, standard techniques of Gaussian quantum information processing Weedbrook et al. (2012) are sufficient for the algorithm, which includes the following procedures. In the state preparation, the squeezing state can be obtained using displacement operator and squeezing operator. In the regularization step the operator is just a conditionedphase gate. Finally, in the singular value transformation, homodyne detection of modes is required.
The essential part of the implementation of the algorithm is to construct the operator for the quantum phase estimation. As extracts singular values implied in states of qubits and registers them on entangled qumodes, it is essentially a hybrid quantum operator. Effectively constructing of involves a density matrix exponentization of using the method in Ref. Lloyd et al. (2014); Kimmel et al. (2017). Further, the required exponential swap gate should be modified Lau et al. (2017) to couple the density matrix to . The density matrix exponentization of density can be obtained by repeatedly applies the exponential swap operation and tracking out ,
(4) 
Here is the swap operator.
To construct , the exponential swap operator should be modified as
(5) 
Here , and is a control swap operator on multimodes, where swap between and , conditioned on the ancillary qubit . Note that Eq. (5) is a hybrid approach version of the one in an optical system Lau et al. (2017). The conditional swap operator is constructed as , where is a ControlNOT gate that takes () as the control(target), and is the Toffoli gate that conditioned on both and the ancillary qubit . Initially the ancillary qubit is set in state . We now have
Set we obtain . To construct with desired precision it requires copies of Lau and Plenio (2016).
A key component of our hybrid approach is to construct the hybrid operator which involves a coupling of one qubit to two qumodes. Such a term would not appear naturally in a physical system. Nevertheless, it can be obtained by using basic hybrid quantum operators Lloyd (2000), with the following intertwined quantum evolution . Let and here and the evolution repeat times, we thus have .
We briefly discuss how to implement the algorithm physically in trapped ions, with some necessary modification. A more detailed demonstration can be found in Appendix. C. It should be emphasized that the hybrid approach is more feasible for a physical implementation, comparing to the allqubit approach. For trapped ions, the internal states and motional states of trapped ions can respectively serve as discrete and continuous variables for encoding information, and notably both states are wellcontrollable in the trappedion systems Cirac and Zoller (1995); Lau and James (2012); Shen et al. (2014); OrtizGutiérrez et al. (2017); Lamata et al. (2007); Gerritsma et al. (2010). The setup contains ions in a Pauli trap lined in the direction. A specified ion, called aion, provides its motion modes in and directions as two qumodes, and one qubit as the ancillary qubit. We initialize two qumodes in squeezing states of momentum, and the ancillary qubit in . Also, copies of and the reference state are prepared using internal states of ions. In the phase estimation, the conditional exponential swap operator can also be written as for convenience in the present system of trapped ions, where is the Hadamard gate on the ancillary qubit. The conditional swap operator has been realized experimentally in trapped ions Linke et al. (2017). Setting , which can be realized using lasers for simulating Dirac equations Lamata et al. (2007); Gerritsma et al. (2010), the hybrid gate is realizable, using the intertwined quantum evolution of and . The regularization demands for a controlledphase gate . Note that . Then by relaxing the trap along directions and strengthening it along direction for aion, we can realize approximately by setting . The singular value transformation can be implemented with homodyne detection of approximate zero momentum, using the motion tomography method in Ref. Poyatos et al. (1996). In the prediction, a swap test Buhrman et al. (2001) can access , where is the success rate of projecting the ancillary qubit into state. The sign of should be determined by other means Schuld et al. (2016).
V Discussions and conclusions
The hybrid approach for quantum linear regression is similar to that of the allqubit approach. Both use auxiliary modes to encode information of singular values; and finally project out the auxiliary modes which at the same time gives the singular value transformation. However, the hybrid approach exploits the infinite dimension of qumodes and is essentially different in several aspects. Firstly, it uses entangled qumodes to achieve the singular value transformation. This is unique for continuous variable quantum states (see Appendix A for a more general investigation). Secondly, the finite squeezing factor plays a basic role which is absent for the allqubit approach. Those lead to some distinct properties for the algorithm, as would be revealed below.
We first analyze the runtime of the hybrid approach using two qumodes. It mainly arises from the construction of operator for the quantum phase estimation, and the success rate of homodyne detection at the step of singular value transformation. To construct , it requires copies of density matrix with desired precision . Meanwhile, each copy of density matrix can be obtained from that takes runtime using qRAM. Thus the runtime in the phase estimation is . The runtime for singular value transformation turns to be (see Appendix B). In total, the runtime scales as .
We investigate the role of the regularization parameter and the squeezing factor for quantum speedup and accuracy. For lowrank , we expect and , which corresponds to the case of bad conditional number. Without regularization, the exponential speedup loses in the allqubit approach Rebentrost et al. (2014). In our hybrid approach, however, exponential speedup always holds under a constant error once we set (recalling that ). Moreover, with regularization, the required squeezing factor becomes if we set , which greatly reduces the requiring resource of squeezing. For a preset constant , the requiring squeezing factor turns to be .
For the aspect of experimental reachable squeezing factor, the squeezing of motional modes of trapped ions can reach about dB Kienzler et al. (2015) (a squeezing factor about ), corresponding to four qubits for encoding a continuous number. The precision can be enough for our demonstration proposal of quantum linear regression with trapped ions where only two singular values need to be told apart (See Appendix C where we have used a data set with four samples and two features). The squeezing factor can be even higher, which may be raised, e.g., with a longer parametric drive duration time when keeping coherence Burd et al. (2018). We may see that raising the squeezing factor requires an improvement of operations on a single qumode against the noisy environment Kienzler et al. (2015); Burd et al. (2018). Such a challenge is different from that of increasing the number of qubits, which depend on the scalability of physical setups.
Due to the regularization and finite squeezing, the obtained state is different from one with infinite squeezing and without regularization. To characterize this difference, we calculate the fidelity between and and study its relation to regularization factor and squeezing factor . More details can be found in Appendix. D. As expected, the fidelity increases when increases as one should expect, and decreases when increases. Moreover, under larger regularization the fidelity can decrease significantly slower with reducing squeezing factor .
We further mention the shrinkage effects Hansen (1987) due to the regularization and finite squeezing, which may benefit machine learning. Firstly, regularization introduces a shrinkage that the coefficients in are , instead of
for the case without regularization. The extent of shrinkage is higher for small singular values (low variance components) and lower for large singular values (high variance components). Further, in the case of finite squeezing, the final state we obtain is
instead of , that is, each coefficient is rescaled by , correspondingly. This further reduces the weighting of low variance components. Rather than taking as an imperfection of the algorithm, we can consider it as an extra regularization due to finite squeezing. Whether this regularization will improve the performance of prediction is an interesting question and we would leave it for further investigation.It is meaningful to highlight the role of squeezing factor in the algorithm. On one hand, it is related to the success rate of postselection. The smaller , the bigger , and thus the higher the success rate. On the other hand, smaller leads to a bigger shrinkage. Thus, a proper squeezing factor is not only necessary for efficiently implementing the quantum algorithm, but also may be beneficial for machine learning.
In summary, we have adopted a hybrid approach for quantum linear regression, exploiting the advantage of qubits for encoding data and the efficiency of auxiliary qumodes for implementing phase estimations and singular value transformation. The regularization can be incorporated directly with a controlled phase gate on two qumodes. This regularization can remedy the issue of bad condition number by reducing the requirement of squeezing resource, and thus is important for running the quantum algorithm efficiently. Our hybrid approach has the same order of runtime as the allqubit regarding to the dimension of data , the number of training data (samples) , and the precision , but can save the using of ancillary qubits at the price of requiring finite squeezing states with qumodes. We have also demonstrated the important role of finite squeezing for efficiently running the algorithm. Moreover, we have shown that the shrinkage effect due to finite squeezing may provide a new type of regularization for linear regression. We wish that the hybrid approach may allow us to design quantum algorithms with more flexibility and efficiency, and may even provide new insights for quantum machine learning, by exploiting the infinite dimensionality as well as the finite squeezing nature of qumodes.
Acknowledgements.
We thank Mile Gu for helpful discussions. This work was supported by the NKRDP of China (Grant No. 2016YFA0301800) and the NSFC (Grants No. 91636218 and No. 11474153) as well as the KPST of Guangzhou (Grant No. 201804020055)Appendix A Qumodes for quantum computing
Quantum phase estimation
. At the heart of QPE is quantum Fourier transformation (QFT) which gives exponential speedup, as performing QFT on
qubits takes the order of quantum operations, while fast Fourier transformation takes . It is noted that Fourier transformation for quadrature field operators and is inherent, as revealed by the relation of their eigenstates and , which takes the form . Based on the inherent QFT in qumodes, quantum phase estimation Lloyd (2000) routine can be much simplified. Note. To write eigenvalues into the registering qumode, one just needs to performs quantum gate
on , which results in . The registering of eigenvalues in qumodes is just a shift of position (momentum), with the quantity determined by the eigenvalues obtained as works on its eigenstate. Remarkably, only a single qumode with squeezing factor Liu et al. (2016) is required for desired precision . In contrast, for allqubit system, registering with same precision requires qubits.Quantum addition. We consider the addition . First encode as , then the addition can be realized by performing the shift operator on , and it is easy to see that the output is . In general, floating computing is more conveniently implemented in the continuousvariable quantum computing setup Lloyd and Braunstein (1999).
Transformation of quantum amplitudes using entangled qumodes. The task is to transform the initial state to (unnormalized), where relates to , such as a pair of eigenvalue and eigenstate. Here quantum amplitudes are mapped as . We show how this can be achieved using entangled qumodes and projection. This is unique for entangled states of continuousvariable. For illustration we give the derivation only for infinite squeezing. We assume that the following quantum state can be prepared,
(6) 
Take a homodyne detection on qumode and if the result is , then the state collapses to
(7) 
where mode has been discarded. Further, postselecting of , then this can realize . General in principle can be implemented as follows. Firstly, quantum float computation Lloyd and Braunstein (1999) allows a mapping from to . Then, a homodyne measurement on the qumode leads to the state
(8) 
which multiples the coefficient by , respectively. It is required that for some given to disentangle the qumode. For instance, when (), we can chose .
Appendix B Finite squeezing analysis
Let us consider squeezed states with squeezing factor , following the method in Ref. Lau et al. (2017). Then, the unitary operator performs on the prepared state
(9) 
We emphasize that the factor should not be dropped when analyzing the runtime behavior. It follows by the operator realizing a regularization. To unentangle qumodes from qubits, homodyne detections are conducted on both qumodes with results and . Then the quantum state turns to be
(10) 
where
(11) 
For brevity we have introduced . Set , then
(12) 
The width of distribution of both and is . For our task it is natural to let the precision specified to . We let . Note the probability density is . Then, the success rate of homodyne detection of two qumodes around the center with area can be approximately calculated through
(13) 
The runtime is , and further if amplitude amplification Brassard et al. (2000) can be applied to continuous variables then the runtime would reduce to .
Appendix C Physical implementation: a demonstration
For the purpose of demonstration, we consider a dataset that contains four training samples, each having two features. This corresponds to and . Features for each sample is represented by (), and the corresponding target value is . The regression task is to predict the target value for new data .
We choose trapped ions Cirac and Zoller (1995); Lau and James (2012); Shen et al. (2014); OrtizGutiérrez et al. (2017); Lamata et al. (2007); Gerritsma et al. (2010) for a physical implementation of the algorithm. Our setup contains ions in a Pauli trap lined in the direction. Each ion can provide a qubit and two qumodes (motion modes in and directions). According to their roles in the algorithm, we can group them as following:

dions contains three ions for loading the data information into a quantum state , which would be transformed into the target state .

tions contains three ions. They are initialized to and help to construct for the phase estimation. Many copies of tions may be required depending on the desired precision. Here we simply choose two copies for the purpose of demonstration.

aion provides an ancillary qubit and two qumodes.

rions contains three ions for encoding the reference state .
In total thirteen ions are required. We briefly discuss how those ions play their role in the procedures of the algorithm, as illustrated in Fig. 3. Firstly, aion, dions, tions and rions are initialized to , ,, , respectively. In the training step, which transfers to , tions, dions, and aion are involved to perform the quantum phase estimation. For either tions or dions, only the qubit recording features is involved, as marked red in Fig. 3. Then, a controlledphase gate and homodyne measurements performs on two qumodes of the aion, realizing regularization and singular value transformation respectively. In the prediction, a swap test involves rions (encoding ), dions (encoding ), and aion (providing an ancillary qubit). Note that two motion modes of aion are not required in this stage anymore.
We work on squeezing states of momentum, as a regularization operator is more realizable in a single ion. The implementation details with the five procedures are given as follows:

State preparation. dions are prepared in the state by . Explicit quantum circuit of can be seen in Fig. LABEL:state_paration. tions are also prepared in state . For the aion, the qubit state is initialed as , and the motion state is initialized as , where squeezing state is obtained by performing a squeezing operator on the vacuum state . rions are initialized in the reference state . Here shortnotes . is a twoqubit operator that prepares , and .

Quantum phase estimation. This step applies an unitary operation , using . Here is a state on tions, and is a state on dions. The conditional exponential swap operator is . Here is a conditional swap operator performing on qubit and qubit, conditioned on the qubit of aion. We emphasize that recently the conditional swap operator has been realized experimentally in trapped ions Linke et al. (2017).
Comments
There are no comments yet.