**9. Complexity analysis**

Before analyzing the quantum circuits introduced here in terms of complexity, first the choice of *NM* and *NE* for representing realistic flow fields is considered.

### **9.1 Representing Taylor-green vortex flow**

In a two-dimensional flow field, the non-linear terms appearing in the Navier– Stokes equations, shown in Eq. (4), involve the square of the velocity components in *<sup>x</sup>*� and �*<sup>y</sup>* directions, i.e. *<sup>u</sup>*<sup>2</sup> and *<sup>v</sup>*2, as well as, the product *uv*. Here, the example flow field defined by the two-dimensional Taylor-Green vortex is considered, where velocity and pressure are defined in a square domain 0, 2 ½ � *<sup>π</sup>* <sup>2</sup> with periodic boundary conditions as,

$$u = \cos\left(\mathbf{x}\right)\sin\left(\mathbf{y}\right) \; ; \quad v = -\sin\left(\mathbf{x}\right)\cos\left(\mathbf{y}\right) \; ; \quad p = -\frac{1}{4}\left[\cos\left(2\mathbf{x}\right) + \cos\left(2\mathbf{y}\right)\right] \tag{10}$$

Considering a 100 � 100 uniform mesh, the effect of representing the flow field variables with a reduced-precision floating-point format is analyzed first.


**Table 5.**

*Approximation errors of velocity products in Taylor-green vortex flow field due to reduced-precision floatingpoint representation. L*<sup>∞</sup> *and L*<sup>2</sup> *norms of errors relative to IEEE double-precision representation for velocity (u*<sup>2</sup>*) and pressure (uv) for different NM and NE.* <sup>100</sup> � <sup>100</sup> *uniform mesh.*


**Table 6.**

*Number of controlled-phase gates (CPHASE) and doubly-controlled-phase (C*<sup>2</sup>*PHASE) for phase-addition operator in quantum-multiplier. Also, smallest rotation angle is shown.*


#### **Table 7.**

*Number of controlled-phase gates (CPHASE) in phase-addition step for modulo adder (MADD) and full adder (FADD). Also, smallest rotation angle is shown.*

**Table 4** summarizes the results, highlighting the importance of including subnormal numbers in the floating-point representation. Since a sign bit is not used here, the absolute values of *u*, *v*, *p* were actually used. Flow variables defined in Eq. (10) are in the range ½ � �1, 1 , so that by increasing *NE* from 3 to 4, far fewer subnormal numbers are used to represent the flow field. As a result, removing the subnormal number capability (as shown in bottom half of table), results in smaller errors for *NE* ¼ 4. For realistic applications of the proposed quantum floating point format, the relatively small overhead incurred by introducing sub-normal numbers in the quantum circuits clearly suggests that sub-normal numbers should be included.

For *NE* <sup>¼</sup> 4, the representation of *<sup>u</sup>*<sup>2</sup> and <sup>∣</sup>*uv*<sup>∣</sup> is considered. Specifically, the error shown is that introduced by the multiplication: the difference between the 'exact' product of the reduced-precision representation of ∣*u*∣ and ∣*v*∣ and the corresponding reduced precision representation of the products is shown in **Table 5**. The results highlight that although sub-normal numbers played a relatively smaller role in representing velocity components, in the computation of the nonlinear terms, the inclusion of sub-normal numbers is more important for the minimization of approximation errors.

#### **9.2 Mantissa multiplication step**

*QFT* and inverse *QFT* are used involving 2*NM* qubits, so that the complexity in terms of two-qubit (controlled-phase) gates scales as *N*<sup>2</sup> *<sup>M</sup>*, where the well-known complexity of the standard *QFT* implementation is used. The complexity of the phase-addition steps involved in the multiplication are detailed in **Table 6**. For the two-qubit gates the number can be seen to scale as *N*<sup>2</sup> *<sup>M</sup>*, while the number of three-qubit gates shows a *N*<sup>3</sup> *<sup>M</sup>* scaling.

#### **9.3 Computation of exponent**

*QFT* and inverse *QFT* are used involving *NE*, *NE* þ 1 and *NE* þ 2 qubits, representing a smaller complexity than the *QFT* used in mantissa multiplications. The main contributions to complexity of exponent computation stems from the modulo and full-adders involving a number of qubits scaling linearly with *NE*. The polynomial complexity in terms of qubits for the adders implemented here is shown in **Table 7**.

#### **9.4 Discussion**

The quantum circuits presented here for squaring two floating-point numbers in the format proposed show that by accounting for sub-normal numbers and

*Quantum Algorithms for Nonlinear Equations in Fluid Mechanics DOI: http://dx.doi.org/10.5772/intechopen.95023*

under/overflow an additional number of multi-qubit controlled-NOT gates is needed. However, for the examples analyzed a polynomial dependence on *NM* and *NE* was observed. This means that in terms of quantum-algorithm complexity this implementation has the desired efficiency. The relatively small complexity as compared to circuits used for mantissa multiplication highlights that for most applications it is desirable to include the capability of using sub-normal numbers and provide under/overflow protection in the quantum circuits. The analysis in this section also shows that for a realistic application, a well-considered scaling of the governing equations to *O*ð Þ1 variables is even more important here than in classical implementations using IEEE single- or double-precision arithmetic. Using the limited number of qubits available on current and near-term quantum computers (<100), the proposed approach to introducing non-linearity is a good candidate in cases where *NM* and *NE* can be chosen significantly smaller than in equivalent classical floating-point representations.

## **10. Conclusions**

The challenges associated with representing non-linear differential equations in terms of quantum circuits were discussed in this chapter. In this work, a new approach for representing product-terms in nonlinear equations suitable for nearterm (e.g. NISQ generation) quantum computers was proposed. A key aspect discussed is the (temporary) representation of the variables in the computational basis. Furthermore, the use of a suitably-chosen floating-point format was detailed. The importance of including sub-normal numbers, such as defined in the IEEE 758 standard for floating-point arithmetic on classical computers, was demonstrated. Based on the current findings, a number of suggestions for further work can be put forward. The presented circuits performed arithmetic for a single set of input data, i.e. equivalent to data for a single point in a computational domain. Extending the approach to a multi-dimensional computational mesh is a first step to consider. A complexity analysis will be needed to assess the potential speed-up relative to classical discretization approaches for the considered equations. A further step involves investigating how the proposed approach can be made part of a larger quantum algorithm, where a mix of amplitude-based encoding and computationalbasis encoding occurs. A key aspect is therefore the development of efficient quantum circuits to perform the required conversions between the two different encoding approaches. Finally, further work is needed to establish how the approach presented here can be used in a wider range of quantum computing applications.

*Quantum Computing and Communications*
