# Quantum Circuit Implementation of Multi-Dimensional Non-Linear Lattice Models
## 7 Detailed Description of Quantum Circuit for \(u^{2}+v^{2}\) Evaluation (Design _EKin2D3_)  
For the shift-and-add multiplier used in Design _EKin2D3_ detailed here, the modified full adder quantum circuits were detailed for the case \(N_{M}=4\). In this section, \(N_{M}=4\) will again be used as an example, where it needs to be considered that, in practically relevant applications, \(N_{M}\) will typically be significantly larger due to precision requirements. Before detailing the quantum-circuit implementation, the key features of Design _EKin2D3_ can be summarized as follows:  
* Combined evaluation of mantissa squaring of \(u^{2}\) and \(v^{2}\) with a minimum of \((2N_{M}+1)\) output to avoid overflow;
* Quantum floating-point arithmetic is used with \(u\) defined by \(N_{M}-1\) mantissa qubits \(|mu2|mu1|mu0\rangle\) and \(|eu2|eu1|eu0\rangle\) (\(N_{E}\) qubits defining exponent), and \(v\) is similarly defined by \(|mv2|muv1|mv0\rangle\) and \(|ev2|ev1|ev0\rangle\);  
Figure 10: Definition of \(FA_{\mu}\) and \(FU_{v}\)-modified Cuccaro 5-qubit full adders for use in shift-and-add-based squaring for \(N_{M}=4\). * In setting up the mantissa squaring, potential differences in the exponents of \(u\) and \(v\) need to be accounted for. If \(E_{u}\) and \(E_{v}\) are the integer values of the \(u\)-velocity and \(v\)-velocity exponents, respectively, then for \(E_{v}<E_{u}\), a floating-point addition needs a'shift' on the \(v\)-input qubits by \(\Delta E=E_{u}-E_{v}\) placed in the input register of the adder toward a less significant position. For \(E_{v}\leq E_{u}\) and normalized \(u\)-velocity, \(|qu3|qu2|qu1|qu0\rangle\) is set to state \(|1|mu2|mu1|mu0\rangle\). For \(E_{u}-E_{v}=1\), the input qubits \(|qv3|qv2|qv1|qv0\rangle\) need to be set to state \(|0|1|mu2|mu1|\) (if \(u\) is normalized input). Similarly, for larger \(\Delta E\), ever larger shifts will be applied;
* The shifts introduced to account for exponent differences of \(u\) and \(v\) will lead to the elimination of one or more less-significant mantissa qubits for \(\Delta E>0\);
* Improved designs can be derived that employ an extended workspace in the shift-and-add-based multiplier, with the aim of reducing the truncation and rounding effects created for \(\Delta E>0\). To investigate the effect of extending the shift-and-add-based multiplier in more detail, for \(N_{M}=4\), three different designs were considered, as detailed in the next sections. For clarity, only the case \(E_{u}\geq E_{v}\) will be considered. At the top of the quantum circuits for each of these designs, the qubit mapping can be summarized as follows:  
\[|eu2|eu1|eu0\rangle : N_{E}\text{ qubits defining the $u$-velocity exponent}\] \[|sub\rangle : \text{ initialized at $|0\rangle$, in state $|1\rangle$ for sub-normal $v$}\] \[|ev2|ev1|ev0\rangle : N_{E}\text{ qubits defining the $v$-velocity exponent}\] \[|mv2|mv1|mv0\rangle : N_{M}-1\text{ qubits defining the $v$-velocity mantissa}\]  
Right at the bottom of the circuit, the qubits defined to store kinetic energy in the floating-point format are allocated:  
\[|ek2|ek1|ek0\rangle : N_{E}\text{ qubits defining the $u^{+}v^{2}$ exponent}\] \[|mk2|mk1|mk0\rangle : N_{M}-1\text{ qubits defining the $u^{2}+v^{2}$ mantissa}\]  
The different designs use a varying number of workspace qubits, as detailed in the respective sections. In the quantum-circuit design, the first three steps are identical:  
* Set \(|vsub\rangle=|1\rangle\) for cases with \(|ev2|ev1|ev0\rangle=|000\rangle\) (sub-normal \(v\)-velocity);
* Perform operation \(Eu-Ev\) that calculates the difference in \(u\)- and \(v-\)velocity exponents (\(E_{u}-E_{v}\)) and set this difference (temporarily) in qubits \(|ev2|ev1|ev0\rangle\);
* For \(|eu2|eu1|eu0\rangle=|000\rangle\) (sub-normal \(u\)-velocity), set \(|qu3\rangle=|0\rangle\);  
In this design of the quantum circuit, \(E_{u}\geq E_{v}\) was assumed.