Quantum Fourier transform to estimate drive cycles

Drive cycles in vehicle systems are important determinants for energy consumption, emissions, and safety. Estimating the frequency of the drive cycle quickly is important for control applications related to fuel efficiency, emission reduction and improving safety. Quantum computing has established the computational efficiency that can be gained. A drive cycle frequency estimation algorithm based on the quantum Fourier transform is exponentially faster than the classical Fourier transform. The algorithm is applied on real world data set. We evaluate the method using a quantum computing simulator, demonstrating remarkable consistency with the results from the classical Fourier transform. Current quantum computers are noisy, a simple method is proposed to mitigate the impact of the noise. The method is evaluated on a 15 qubit IBM-q quantum computer. The proposed method for a noisy quantum computer is still faster than the classical Fourier transform.

www.nature.com/scientificreports/ classical computers by orders of magnitude, Aaronson 15 identified NP-Complete problems as one of the limits of Quantum Computers. Though meta-heuristic approaches are useful, the field of transportation management, policy and planning are subject to scrutiny. This is predominantly because of the safety critical aspects as well as the wide public impact transport interventions have on society. This requires providing structural bounds and assurances on the validity of the solution. This need from a decision support standpoint requires to rely on quantum logic gates.
There has been ground breaking theoretical work that demonstrated quantum algorithms relying on quantum logic gates can provide significant speedups, to name a few: (a) Deutsh-Jozsa algorithm 16 to determine constant of symmetric output provides exponential speedup (b) Simon's period finding algorithm 17 provides exponential speedup (c) Bernstein-Vazirani secret string determination algorithm 18 provides super-polynomial speedup (d) Grover's search Algorithm 19 provides quadratic speedup and (e) Dürr-Høyer algorithm 20 to find minimum provided polynomial speedup. One of the most celebrated is the Shor's 21 algorithm, that demonstrated that quantum computers can solve the prime factorization problem exponentially faster than classical computers, having significant implications on cryptography. Though subject to some debate, recently "Quantum Supremacy" was demonstrated on a problem that would take a classical supercomputer 10,000 years to be completed by 53 qubit Sycamore processor in 200 s 22 . This research contributes by implementing a Quantum Fourier Transform (QFT) to evaluate the frequency domain of the drive cycle. The validity of this method is demonstrated using the IBM quantum simulator (https:// quant um-compu ting. ibm. com/). The QFT algorithm is also implemented on IBM's freely available IBM-Q16 Melbourne, that can be used to create a 15-qubit quantum circuits. The IBM-Q16 does not have a full error correction capability, resulting in noisy outputs. A simple error correction method is proposed that does not compromise the quantum speedups.

Quantum circuits
Basic information of qubits, Quantum Circuits and Quantum Fourier Transform are comprehensively provided by Nielsen and Chuang 23 . So as to provide completeness of context for broader transportation and traffic researchers, we cover some of the basics. Qubits are the basic unit of quantum information in a quantum circuit. A qubit is represented as a linear superposition of its two orthonormal vectors. These vectors are usually denoted as, Therefore, a qubit can be represented as a linear combination of |0� and |1�: It should be noted that α and β are complex valued and the corresponding probability amplitudes for |0� and |1� . This means that we can measure |0� with a probability of |α| 2 and |1� with a probability of |β| 2 . The concept of "superposition" implies that there is no way to tell which of the two possible states the qubit is in. In fact, the moment we measure a qubit, it collapses to the measured state. As you will see later the probability amplitudes are responsible for quantum "interference".
A quantum circuit is a sequence of quantum gates that carry out the computation by operating on the qubits. Quantum gates are Unitary operators (U, i.e. UU † = I ), and therefore a quantum circuit is reversible.
Quantum algorithms begin with creating a superposition of qubits that act as an input for the quantum oracle function ( U f ), which is a quantum version of the classical function ( f ). This process is referred to as "quantum parallelism", which is widely used as a starting point to build useful quantum algorithms.
Discrete Fourier transforms. Quantum Fourier transform (QFT) is a quantum implementation of the classical Fourier transform. Before introducing QFT, it is critical to provide a brief overview of a Discrete Fourier Transform (DFT). DFT acts on a complex valued vector (x 0 , x 1 , . . . x N−1 ) to transform it into another complex valued vector (y 0 , y 1 , . . . y N−1 ) according to the formula: If x j has a period τ , then y k is non-zero for k that are multiples of N/τ . Else, it is zero everywhere else. The magnitude of the coefficients of the Fourier basis indicates the amount of that frequency carried in the signal. (2) ϕ = α|0� + β|1� Where |α| 2 + |β| 2 = 1

Quantum Fourier transforms.
To employ QFT, we need to define an n-qubit quantum states as inputs, s.t.
N = 2 n . The QFT transforms x i to the fourier coefficients y i . This fourier coefficient y i is the same as probability of observing frequency.
It is important to note that the probability of measuring state |i� in the standard basis will be y i 2 . Therefore, applying QFT to a periodic function with period τ would result in a high likelihood of the measurement of |k� , when k is a multiple of N/τ. A QFT is implemented on a vector of length N = 2 n , represented by a basis state by |x� = |x 1 �⊗|x 2 �⊗ · · · ⊗x n and x = 2 n−1 x n + · · · + 2x 1 + x 0 . The coefficient for a frequency from the fourier transform is the same as the probability of observing that frequency. With Eq. (3), we obtain: Replacing x in Eq. (5) with x = 2 n−1 x n + · · · + 2x 1 + x 0 , we obtain: A particular coefficient of y is the probability of observing frequency. After rearranging the sum and products in Eq. (7), we get entangled states: To implement the QFT, we will develop a quantum circuit, which will be explained in the following section.

Quantum Fourier circuit. A quantum circuit to undertake QFT relies on three types of gates (a) Hadamard
Gate (b) CROT k Gate, and (c) Swap Gate. The matrix operations for these three gates are shown in Eqs. (11)- (18), and the circuit representations are shown in Fig. 2.
The Hadamard Gate transforms a qubit x k The two-qubit controlled rotation CROT k gate is defined by A full algorithm follows five steps as shown below to determine the QFT. The corresponding full quantum circuit is shown in Fig. 3. The algorithm starts with an n-qubit input state |x 1 x 2 . . . x n �.
(1) A Hadamard gate is applied on qubit 1, and the state is transformed from the input state to: (2) Then apply CROT k in series controlled by qubit k = 2 . . . n . This results in: (3) Recursively applying Steps (1) and (2) on qubits i = 2..n.
(4) Then apply swap gates to reverse the order of the qubits, to get (5) Measure the n-qubits. www.nature.com/scientificreports/ As can be seen in the circuit shown in Fig. 3, the first qubit would require n gates, i.e., one Hadamard gate and n − 1 UROT gates. A generic qubit k would require n − k + 1 gates, followed by n/2 swap gates. Therefore, the total number of operations required will be n 2 + n k=1 n − k + 1 = n 2 2 + n . Hence the complexity of QFT is O n 2 or O((lnN) 2 ) , which is an exponential improvement over a Fast Fourier Transformation. This is a wellknown result and is discussed in detail in Nielsen and Chuang 24 .
We demonstrate the application through simulations and implementation on the IBMq16-Melbourne, quantum computer. This is the first application of quantum computing to study traffic dynamics data, particularly in the context of drive cycle evaluation.

Drive cycle data
In this section, we introduce the drive cycle data used for the simulation. The National Renewable Energy Laboratory (NREL) published drive cycle data that include second-by-second data on vehicle speed and acceleration using a global positioning system (https:// www. nrel. gov/ trans porta tion/ secure-trans porta tion-data/ tsdc-drivecycle-data. html). This acceleration data was used to create a binary variable indicating whether the vehicle was accelerating or decelerating to create a time series comprising of a sequence of binary numbers.  Fig. 4.
Note that a Fourier transforms a series from the time domain to the frequency domain, making it possible to infer the frequency spectrum. In the context of drive cycle estimation, our objective is to apply QFT to transform a series from the acceleration-deceleration time cycles to the frequency domain. In the next section, we will compare the performance of QFT and classical Fourier transform.

Comparison of quantum Fourier transform with classical Fourier transform
The QFT circuit discussed in "Quantum circuits" section was set up to analyse the frequency domain of the acceleration-deceleration cycles for a 256 s time period. The circuit was run using the IBM Quantum Simulator. The spectral data obtained from the QFT and the classical Fourier transform are in close agreement as seen in Fig. 5. A perfect correlation (correlation coefficient ~ 1) was observed between the square root of the probabilities estimated from the QFT and the coefficients of the Fourier Transform (see Fig. 6).  21  31  41  51  61  71  81  91  101  111  121  131  141  151  161  171  181  191  201  211  221  231  241

QFT using noisy quantum computing
Due to the extreme difficulty in controlling the qubits at low temperatures, maintaining superposition is extremely difficult, resulting in occasional decoherence. Current Quantum Computing Technology tend to be noisy with a small probability of an error in the qubit. Methods to correct these errors are required to develop applications using Noisy Intermediate-Scale Quantum Computing (NISQ) 25 . The 15 qubit IBM-Q16 Melbourne computer was used for this analysis. This limited the length of the sequence of data on which the QFT can be calculated to be 16. To conduct this analysis, sixteen series of baseline sequences were generated which are referred to as the calibrating dataset and six sequences were randomly generated and are referred to as the evaluation dataset. The 16 sequences were used to were used to calibrate for the underlying error structure and develop the model. The models performance was then evaluated on the 6 sequences.
The probabilities observed from the IBM-Q16 Melbourne were compared with the probabilities generated from the IBM quantum simulator. The comparison between the observed and actual probabilities are shown in Fig. 7a. Though there is a discernible positive correlation of 0.34 at a statistically significance of 95%, there is significant noise that is observed.
A deeper analysis, comparing the observed probabilities with the actual probabilities when those probabilities were zero is shown in Fig. 7b. Other than the consistent bias in the observed probabilities being greater than zero, the magnitude in level of bias varies between the different values in the frequency domain.   www.nature.com/scientificreports/ As discussed earlier, the QFT implemented on a vector represented by x = 2 n−1 x n + · · · + 2x 1 + x 0 , results in a probability ( P y ) of observing y in the Fourier domain measured as y = 2 n−1 y n + · · · + 2y 1 + y 0 . In a noisy quantum computer, the transformation in Eq. (4) occurs with errors, assuming that there are independent errors for each y . Therefore, the observed probabilities P yǫ can be written as a function of the actual probabilities P y and the probability of deviating from y, that is P ǫ y (Eq. 22).
We use the calibration dataset to determine the error probability ( P ǫ y ) in Eq. (22). Note that in Eq. (22), the actual probabilities P y were estimated using the simulator and are therefore known for each y . The observed probabilities P yǫ for each y are obtained from the IBMQ-16 Melbourne quantum computer, which is noisy. Then, given P yǫ and P y , P ǫ y can be estimated using Eq. (22) by regressing between the observed and actual probabilities for each y (see Fig. 8).
When a new data stream is analysed using the IBMQ-16 Melbourne quantum computer, and the observed probabilities P yǫ have noise embedded. To estimate the actual probabilities ( P y ) using Eq. (23), we use the calibrated P ǫ y that was determined from the calibration dataset from Eq. (22).  www.nature.com/scientificreports/ Furthermore, the probability distribution of the observed probabilities when the actual probabilities are zero was found to have a median of 0.051 and the 95th percentile value of 0.089 (see Fig. 9). If the observed probability is less than 0.089, it would not be possible to distinguish if the observed probability appears because the actual probabilities are zero or not. Therefore, in the evaluation, only observed probabilities that are greater than the 95th percentile value of 0.089 are considered. This is denoted by P 95 yǫ . The estimated probabilities (Fig. 10) align closely with the actual probabilities (correlation of 0.86), as compared to the observed probabilities (correlation of 0.59). Figure 11 summarizes the overall method in a flow chart.
The proposed method using a NISQ based computing system only requires the calibrated error probability ( P ǫ y ) and the observed probability ( P O yǫ ), as such it takes a single step to determine the accurate probabilities. Therefore, the computational complexity of post processing to determine the dominant frequency is still O((lnN) 2 ) . It should be however noted that the dominant frequency needs to have the observed probabilities greater than the threshold ( P 95 yǫ ). This limits the applications of this method to use cases where the frequencies have observed probabilities greater than the thresholds.

Conclusion
This paper is one of the first to explore the use of quantum computing for vehicle dynamics and drive cycle analysis. The method particularly relies on the Quantum Fourier Transform (QFT) that is known to be exponentially faster than the Fourier Transform to determine dominant Drive Cycle frequencies.
Using the IBM Quantum Computing Simulators, the study was able to demonstrate that the implementation of the QFT for drive cycle analysis was consistent with the results from the classical Fourier Transform.
Current quantum computers are known to have errors, and in the era of NISQ, it is imperative to develop methods that can achieve quantum speedups despite these errors. The study proposed a simple error correction     www.nature.com/scientificreports/ method to estimate the probabilities consistent with QFT, without compromising the computational complexity. The method was able to reasonably well recover the probabilities. We are embarking on an exciting frontier of quantum computing that has significant implications on vehicle dynamics, transportation planning and traffic management. These could help with identifying issues quickly and rapidly determining optimal responses, which could in turn help reduce congestion, emissions and improve safety.