# Simulating Majorana zero modes on a noisy quantum processor

Kevin J. Sung<EMAIL_ADDRESS>IBM Quantum, IBM T.J. Watson Research Center,
Yorktown Heights, NY 10598, USA  Marko J. Rančić  TotalEnergies, Tour Coupole
La Défense, 2 Pl. Jean Millier, 92078 Paris, France  Olivia T. Lanes  IBM
Quantum, IBM T.J. Watson Research Center, Yorktown Heights, NY 10598, USA
Nicholas T. Bronn  IBM Quantum, IBM T.J. Watson Research Center, Yorktown
Heights, NY 10598, USA

###### Abstract

The simulation of systems of interacting fermions is one of the most
anticipated applications of quantum computers. The most interesting
simulations will require a fault-tolerant quantum computer, and building such
a device remains a long-term goal. However, the capabilities of existing noisy
quantum processors have steadily improved, sparking an interest in running
simulations that, while not necessarily classically intractable, may serve as
device benchmarks and help elucidate the challenges to achieving practical
applications on near-term devices. Systems of _non_ -interacting fermions are
ideally suited to serve these purposes. While they display rich physics and
generate highly entangled states when simulated on a quantum processor, their
classical tractability enables experimental results to be verified even at
large system sizes that would typically defy classical simulation. In this
work, we use a noisy superconducting quantum processor to prepare Majorana
zero modes as eigenstates of the Kitaev chain Hamiltonian, a model of non-
interacting fermions. Our work builds on previous experiments with non-
interacting fermionic systems. Previous work demonstrated error mitigation
techniques applicable to the special case of Slater determinants. Here, we
show how to extend these techniques to the case of general fermionic Gaussian
states, and demonstrate them by preparing Majorana zero modes on systems of up
to 7 qubits.

##  I Introduction

Figure 1: Circuit to prepare the first excited state of a 5-mode Kitaev chain.
Gates labeled with an angle $\theta$ are real-valued Givens rotation gates and
gates labeled with an angle $\varphi$ are $Z$ rotations. Note that the
presence of the $X$ gates implies that in general, the circuit does not
conserve particle number. However, the circuit always prepares a state with a
well-defined parity. The Givens rotation gate can be implemented on IBM
hardware by decomposing it into 2 CNOT gates plus single-qubit rotations.
Figure 2: Decomposition of the Givens rotation gate into two CNOT gates plus
single-qubit rotations.

The simulation of systems of interacting fermions is one of the most
anticipated applications of quantum computers due to its value to commercial
industry and scientific research [1, 2]. The most interesting simulations will
undoubtedly require a fault-tolerant quantum computer capable of executing
arbitrarily long quantum programs. The effort to build such a device is
underway at academic and industrial institutions, and while fault-tolerance
remains a long-term goal, the capabilities of existing prototypes have
steadily improved [3, 4, 5, 6, 7]. These improved capabilities have sparked an
interest in running simulations that, while not necessarily classically
intractable, may serve as device benchmarks and help elucidate the challenges
to achieving practical applications on near-term devices [8, 9, 10, 11, 12].

Systems of _non_ -interacting fermions are ideally suited to serve these
purposes. Despite being classically tractable, they display rich physics and
produce highly entangled states when simulated on a quantum processor. Because
they are classically tractable, experimental results can be verified even at
large system sizes that would typically defy classical simulation. Previous
experimental demonstrations of such simulations include an implementation of
the Hartree-Fock method on a quantum processor [12] and the preparation of
Majorana zero modes [13]. In both of these experiments, the quantum states
prepared and measured belong to the class of fermionic Gaussian states, of
which Slater determinants are a special case. Fermionic Gaussian states refer
to eigenstates of a quadratic Hamiltonian, the defining feature of a system of
non-interacting fermions.

Reference [12] demonstrated that for Slater determinants, the error mitigation
techniques of physically-motivated postselection of bitstrings and state
purification can be used to significantly improve the fidelity of the
simulation and the accuracy of measured observables. In this work, we show
that these techniques can be extended to the case of general fermionic
Gaussian states, and demonstrate them by improving on the preparation of
Majorana zero modes performed in Reference [13]. We also apply some additional
error mitigation techniques which were not used in either reference. While
Reference [13] ran experiments on only 3 qubits, here our error mitigation
techniques enable us to go up to 7 qubits while also obtaining more accurate
results. Our experiments are performed on a superconducting qubit processor
manufactured at IBM.

Majorana zero modes (MZMs) refer to zero-energy Majorana fermion modes that
exhibit topological properties due to spatial separation of the modes. A
prototypical system that contains MZMs is the Kitaev chain. The Hamiltonian of
a Kitaev chain is

$\displaystyle\begin{split}H=-t&\sum_{j=1}^{n}\left(a_{j}^{\dagger}a_{j+1}+a_{j+1}^{\dagger}a_{j}\right)\\\
&+\sum_{j=1}^{n}\left(\Delta
a_{j}^{\dagger}a_{j+1}^{\dagger}+\Delta^{*}a_{j+1}a_{j}\right)\\\
&+\mu\sum_{j=1}^{n}\left(a_{j}^{\dagger}a_{j}-\frac{1}{2}\right),\end{split}$
(1)

where $t$ is the tunneling amplitude, $\Delta$ is the superconducting pairing,
$\mu$ is the chemical potential, and the $\\{a_{j}\\}$ are fermionic
annihilation operators for a system of $n$ fermionic modes. When
$\lvert\Delta\rvert=t>0$ and $\mu=0$, the Hamiltonian (1) takes the form

$\displaystyle H=it\sum_{j=2}^{2n-2}\gamma_{j}\gamma_{j+1}$ (2)

where we have introduced the Majorana fermion operators

$\displaystyle\gamma_{2j-1}=a_{j}+a^{\dagger}_{j},\quad\gamma_{2j}=-i\left(a_{j}-a^{\dagger}_{j}\right).$
(3)

Note that $\gamma_{1}$ and $\gamma_{2n}$ do not appear in the Hamiltonian (2);
these are unpaired zero-energy Majorana modes localized at the ends of the
chain. The energy and separation of the modes is robust to small perturbations
in $\mu$. MZMs can theoretically be used as carriers of quantum information
with a Clifford gate set which is topologically protected against errors; this
fact has motivated efforts at their experimental realization [14].

In this work, we map the Kitaev chain model to a system of qubits using the
Jordan-Wigner transformation (JWT). Despite the nonlocal nature of the JWT,
eigenstates of the model can be prepared efficiently using only gates acting
on neighboring qubits on a line. We measure the excitation energies of the
model by separately preparing the ground and excited states, and we observe
the presence of zero-energy excitations that are robust to perturbations in
$\mu$. We also measure the Majorana site correlation $i\gamma_{1}\gamma_{j}$
and observe an exclusive correlation between the ends of the wire at $\mu=0$
which breaks down with increasing $\mu$.

##  II Results

Figure 3: Fidelity, error, and energy. (Top) One minus the fidelity witness
and the average error in energy (expectation value of the Hamiltonian). Note
that the fidelity witness is only guaranteed to be a lower bound on the true
fidelity, so it can be negative. The data for the 6-mode Kitaev chain is shown
on the left, and the data for the 7-mode Kitaev chain is shown on the right.
The different lines in each figure correspond to successive applications of
error mitigation techniques. As error mitigation is applied, the fidelity
witness improves and error decreases. “+MEM” refers to measurement error
mitigation. “+PS” refers to postselection of bitstrings based on parity.
“+Pur.” refers to purification of the measured correlation matrix. All
circuits were executed with dynamical decoupling pulses added. (Bottom) The
measured excitation energies of the first and second excitations above the
ground state, and their symmetric hole counterparts. “Raw” refers to raw data
from circuits executed with dynamical decoupling pulses, and “Mit.” refers to
the data after all error mitigation techniques are applied. The signature of
Majorana zero modes is the zero-energy first excitation separated from the
finite-energy second excitation at $\mu=0$ and the robustness of this property
to perturbations in $\mu$. This property can be clearly seen in the two
leftmost data points in each plot. All error bars indicate a confidence
interval of two standard deviations (95% confidence) as estimated from the
sample covariance.  Figure 4: Majorana site correlation. The Majorana site
correlation at site $j$ is defined as the operator $i\gamma_{1}\gamma_{j}$
where $\gamma_{j}$ denotes the $j$-th Majorana operator. The data for the
6-mode Kitaev chain is shown on the left, and the data for the 7-mode Kitaev
chain is shown on the right. For each system size, we include plots for
several different values of $\mu$, as indicated on the plots. Each plot
includes data for the ground state (ideal values indicated by the dashed black
line) and the first excited state (ideal values indicated by the dashed gray
line). “Raw” refers to raw data without error mitigation, and “Mit.” refers to
the data after all error mitigation techniques are applied. At $\mu=0$ the
correlation is only nonzero for $j=2n$, indicating an exclusive correlation
between Majorana fermions at the ends of the chain. As $\mu$ increases this
exclusive correlation breaks down. All error bars indicate a confidence
interval of two standard deviations (95% confidence) as estimated from the
sample covariance.

###  II.1 Circuits and observable measurement

Since the Kitaev chain Hamiltonian is quadratic in the fermionic creation and
annihilation operators, its eigenstates are fermionic Gaussian states which
can be prepared efficiently using the algorithm given in Reference [15]. This
algorithm has linear circuit depth and requires only linear qubit
connectivity. It assumes the Jordan-Wigner transform is used to map fermionic
operators to qubit operators. Figure 1 displays an example circuit that shows
the general structure. Besides single-qubit Z rotations and X gates, the only
other type of gate present is the so-called Givens rotation gate, with matrix

$\displaystyle G(\theta)=\begin{pmatrix}1&0&0&0\\\
0&\cos(\theta)&-\sin(\theta)&0\\\ 0&\sin(\theta)&\cos(\theta)&0\\\
0&0&0&1\end{pmatrix}.$ (4)

On hardware for which CNOT is the native two-qubit interaction, this gate can
be implemented using the decomposition shown in Figure 2, which uses two CNOT
gates in addition to single-qubit rotations.

Eigenstates of a quadratic Hamiltonian are prepared by effecting a basis
change that maps the fermionic creation operators $\\{a^{\dagger}_{j}\\}$ to a
new set of creation operators $\\{b^{\dagger}_{j}\\}$ such that the
Hamiltonian takes the diagonal form

$\displaystyle H=\sum_{j}\varepsilon_{j}b^{\dagger}_{j}b_{j}+\text{constant}$
(5)

where $0\leq\varepsilon_{1}\leq\cdots\leq\varepsilon_{n}$. The operators
$\\{b^{\dagger}_{j}\\}$ also satisfy the fermionic anticommutation relations,
so they can be regarded as creation operators for fermionic excitations with
excitation energies given by $\\{\varepsilon_{j}\\}$. The
$\\{b^{\dagger}_{j}\\}$ are linear combinations of the original creation and
annihilation operators:

$\displaystyle\begin{pmatrix}b^{\dagger}_{1}\\\ \vdots\\\ b^{\dagger}_{n}\\\
\end{pmatrix}=W\begin{pmatrix}a^{\dagger}_{1}\\\ \vdots\\\ a^{\dagger}_{n}\\\
a_{1}\\\ \vdots\\\ a_{n}\end{pmatrix}$ (6)

where $W$ is an $n\times 2n$ matrix. The matrix $W$ can be efficiently
computed from the description of the Hamiltonian and is used to produce the
quantum circuit that prepares an eigenstate of the Hamiltonian. In Appendix A,
we review the quantum algorithm for preparing fermionic Gaussian states.

For each state prepared, all observables of interest can be determined from
the correlation matrix. The correlation matrix $\Gamma$ of a state $\rho$ is
defined as the block matrix

$\displaystyle\Gamma=\begin{pmatrix}T&S\\\ -S^{*}&I-T^{T}\end{pmatrix}$ (7)

where

$\displaystyle T_{jk}$
$\displaystyle=\operatorname{Tr}\left[a^{\dagger}_{j}a_{k}\rho\right]$ (8)
$\displaystyle S_{jk}$
$\displaystyle=\operatorname{Tr}\left[a^{\dagger}_{j}a^{\dagger}_{k}\rho\right]$
(9)

and $I$ is the identity matrix.

We measured the correlation matrix using a protocol similar to the one used in
Reference [12] to measure the one-particle reduced density matrix (1-RDM),
which is the matrix $T$ in our notation.

The diagonal entries of the correlation matrix are occupation numbers that can
be measured straightforwardly in the computational basis. To obtain the off-
diagonal entries, we need to measure the operators

$\displaystyle a_{j}^{\dagger}a_{k}+a_{k}^{\dagger}a_{j}$ (10)
$\displaystyle-i(a_{j}^{\dagger}a_{k}-a_{k}^{\dagger}a_{j})$ (11)
$\displaystyle a_{j}^{\dagger}a_{k}^{\dagger}+a_{k}a_{j}$ (12)
$\displaystyle-i(a_{j}^{\dagger}a_{k}^{\dagger}-a_{k}a_{j})$ (13)

Under the Jordan-Wigner transformation, the operators between neighboring
modes (i.e., $k=j+1$) can be measured using a two-qubit basis change. To
measure the operators between all pairs of modes, we generate new circuits by
permuting the columns of $W$; each permutation corresponds to a relabeling of
the fermionic modes which cause new pairs to become adjacent. This strategy
allows us to measure the operators between all pairs of modes using the same
circuit structure. In total, $\lceil n/2\rceil\times 8+1$ different circuits
are required to measure the full correlation matrix. In Appendix B, we provide
a detailed description of our measurement protocol.

###  II.2 Error mitigation

We applied a number of error mitigation techniques to improve results.

_Dynamical decoupling._ Dynamical decoupling is a technique to reduce phase
errors stemming from time-correlated low-frequency noise by applying
refocusing pulses on idle qubits [16, 17]. There are many possible pulse
sequences that could be applied. We used the 4-pulse sequence

$\displaystyle X_{\pi}\rightarrow Y_{\pi}\rightarrow X_{-\pi}\rightarrow
Y_{-\pi}$ (14)

where $X_{\pi}$ and $X_{-\pi}$ denote $X$ gates implemented using opposite
sign pulse amplitudes. We used Qiskit [18] to schedule the dynamical
decoupling pulses. The software detects idle periods in the compiled circuit
and in each idle period inserts one pulse sequence, distributing the 4 pulses
with even temporal spacing.

_Measurement error mitigation._ The effect of measurement errors can be
mitigated by treating it as a classical noise channel and approximately
inverting it [19]. We used the software package mthree [20, 21] to perform
measurement error mitigation. The error mitigation procedure converts raw
bitstring counts into error-mitigated bitstring quasiprobabilities. The error
mitigation does not come for free; rather, there is increased uncertainty in
computed quantities.

_Postselection of bitstrings._ In Reference [12] which prepared the Hartree-
Fock state, the ideal final state had a well-defined particle number, so
measured bitstrings with the incorrect particle number could be discarded to
improve results. In our case, the final state does not have a well-defined
particle number, but it does have a well-defined parity. Therefore, we can
still perform postselection on the bitstrings, discarding those with the
incorrect parity. A technical detail is that here we actually apply
postselection not on the bitstrings directly, but on the quasiprobability
distribution over bitstrings returned by the measurement error mitigation
procedure. In Table 1, we show the quasiprobability mass discarded by the
postselection.

_State purification._ Reference [12] exploited the fact that the 1-RDM is
idempotent (it is equal to its square) to perform purification of the measured
1-RDM. That is, due to experimental error, the measured 1-RDM is not
idempotent, and it was projected onto the space of idempotent matrices using a
procedure called McWeeny purification [22]. In our case, it is the correlation
matrix that is idempotent [23]. Therefore, McWeeny purification can also be
applied here to purify the measured correlation matrix. The purification is
accomplished by repeating until convergence the following numerical operation
to update $\Gamma$ at iteration $k$:

$\displaystyle\Gamma_{k+1}=\Gamma_{k}^{2}(3I-2\Gamma_{k}).$ (15)

###  II.3 Experiments

For our experiments, we set $t=-1$, $\Delta=1$, and used 5 different values
for $\mu$ evenly spaced between 0 and 3. For each choice of Hamiltonian
parameters, we prepared 6 eigenstates: the ground state and the first and
second excited states, as well as the 3 corresponding eigenstates from the
opposite end of the spectrum. We executed our circuits on the ibmq_guadalupe
device accessed through the IBM Quantum service. We used Qiskit [18] to
compile the circuits into basis gates supported by the hardware. The Givens
rotation gates were compiled using a decomposition similar to the one shown in
Figure 2, requiring 2 CNOT gates for each Givens rotation. For each circuit we
collected 100,000 measurement shots.

To execute each circuit, we needed to pick a line of qubits to use. Because
gate errors vary over the device, the choice of qubits can have a significant
impact on performance. To pick the qubits, we used the software package
mapomatic [24], which attempts to minimize the expected error in executing the
circuit using a subgraph isomorphism algorithm scored on gate errors reported
for the device.

Reference [25] shows how to compute a fidelity witness for experiments that
prepare fermionic Gaussian states. The fidelity witness gives a lower bound on
the fidelity of the experimentally measured state with the ideal state and can
be easily computed from the correlation matrix; see Appendix C for a review of
this result. Figure 3 (top panel) shows the fidelity witness and average error
in energy.

Figure 3 (bottom panel) shows the measured excitation energies of the first
and second excitations above the ground state, and their symmetric hole
counterparts. We show both the values obtained from the raw data and those
obtained after applying error mitigation.

Figure 4 shows the measured expectation value of the Majorana site correlation
$i\gamma_{1}\gamma_{j}$. Again, both raw and error-mitigated data are
displayed.

System size | Vacuum | Occupied
---|---|---
6 qubits | 0.283 | 0.348
7 qubits | 0.344 | 0.398
Table 1: Quasiprobability mass discarded by postselection on bitstring parity.
The “Vacuum” column indicates circuits where the initial state is the all
zeros state; due to an optimization, these circuits had fewer gates than
circuits with an “occupied” initial state, and hence a lower expected fraction
of bitstrings with the incorrect parity.  Figure 5: Effectiveness of dynamical
decoupling. This figure shows the fidelity witness and the energy error for
experiments without dynamical decoupling (No DD) and with dynamical decoupling
(DD) on the Kitaev chain of length 6.

##  III Discussion

We created Majorana zero modes on a noisy superconducting qubit processor by
preparing eigenstates of the Kitaev chain Hamiltonian. The largest chain that
we simulated used 7 qubits. Simulating this chain required executing circuits
containing dozens of two-qubit gates, yet our experimental results closely
matched theory despite their implementation on noisy hardware. We measured
zero-energy excitations at $\mu=0$ which were robust to small perturbations in
$\mu$. We also observed the exclusive correlation between Majorana fermions at
the ends of the chain at $\mu=0$ and increasing correlations with interior
sites with increasing $\mu$. In the limit of infinite chain length, the value
of $\mu=2t$ separates two topological phases, but with a finite length chain
this value is smaller; at $\mu=1.5t$ in our experiments the correlation
between the first site and interior sites is as strong as that between the
ends of the chain. At small chemical potential, the wavefunction for a finite-
length chain decays exponentially as $\exp{\left(-(j-1)/\xi\right)}$, where
$j$ is the site and $\xi$ is the characteristic MZM decay length [26]

$\xi=2\begin{cases}\left|\ln{\left(\frac{t-\Delta}{t+\Delta}\right)}\right|^{-1}&|t|\geq|\Delta|,\\\
\left|\ln{\left(\frac{\Delta-t}{\Delta+t}\right)}\right|^{-1}&|\Delta|\geq|t|.\end{cases}$
(16)

The quality of our results was made possible by our utilization of error
mitigation techniques. We applied dynamical decoupling pulses to idle qubits
to mitigate dephasing errors. To see whether these pulses actually improved
results, we ran experiments with and without dynamical decoupling (while still
applying the rest of the error mitigation techniques). Figure 5 shows the
fidelity witness and energy error for these experiments on the 6-mode Kitaev
chain. Applying dynamical decoupling pulses does indeed yield a significant
improvement, which suggests that low frequency noise on idle qubits is a major
source of dephasing error. We also applied measurement error mitigation; this
is a straightforward and widely applicable technique that is becoming common
practice.

The other techniques we applied were physically-motivated postselection of
measured bitstrings and state purification. These techniques have previously
been used in the preparation of Slater determinants [12]. Here, we showed how
to extend these techniques to the general case of fermionic Gaussian states so
they can be used for the preparation of arbitrary eigenstates of quadratic
Hamiltonians such as the Kitaev chain Hamiltonian. These techniques were
highly effective at improving the fidelity and lowering the error of our
simulations.

The combined application of all of these error mitigation techniques enabled
us to simulate systems of up to 7 qubits, whereas a previous experiment
preparing Majorana zero modes used only 3 qubits. We note that References [27,
28] performed larger experiments (up to 21 and 47 qubits, respectively) with
Majorana modes on noisy quantum processors by periodically driving the qubits
with a Floquet unitary, implementing time-varying Hamiltonians in both non-
interacting and interacting regimes. Those works do not directly prepare
eigenstates, but rather extract experimental signatures of the Majorana modes
via spectroscopic measurements. This contrasts with our work, which focuses on
the exact preparation and measurement of eigenstates of the static Kitaev
model.

Although in this work we deal with the non-interacting Kitaev chain model, a
modified version of the model with an added interaction term has received much
attention [29, 30, 31, 32, 33, 34]. The interacting model does not have an
analytic solution in the general case. Its eigenstates are not fermionic
Gaussian states, so the algorithm we used in this work cannot be applied
directly to its solution. However, our work does open the path to the study of
the interacting Kitaev chain on quantum computers. Depending on the strength
of the interaction, the ground state of the model may have a non-negligible
overlap with the ground state of a non-interacting model. Thus, the ground
state of the non-interacting model, prepared using the methods in this work,
may be used as the initial state for a variational [35, 36] or adiabatic [37,
38] algorithm for preparing the ground state of the interacting model.

Our results build on previous experiments suggesting that error mitigation
will be crucial to achieving practical applications on noisy near-term quantum
computers, and they contribute to the growing library of experiments that can
serve as device benchmarks as we work towards those practical applications.

### Acknowledgments

The authors acknowledge the use of IBM Quantum Services for this work. This
experiment was implemented and executed using Qiskit [18]. The circuit
diagrams in this paper were created using
$\langle\mathsf{q}|\mathsf{pic}\rangle$ [39]. The data plots were created
using Matplotlib [40].

### Data availability

The experimental data for this work is available at
https://doi.org/10.5281/zenodo.6603265.

### Code availability

A snapshot of the source code is included at
https://doi.org/10.5281/zenodo.6603265. An up-to-date version is maintained at
https://github.com/qiskit-research/qiskit-research.

## References

  * Aspuru-Guzik  _et al._ [2005] A. Aspuru-Guzik, A. D. Dutoi, P. J. Love, and M. Head-Gordon, Simulated quantum computation of molecular energies, Science 309, 1704 (2005).
  * Georgescu  _et al._ [2014] I. M. Georgescu, S. Ashhab, and F. Nori, Quantum simulation, Rev. Mod. Phys. 86, 153 (2014).
  * Preskill [2018] J. Preskill, Quantum Computing in the NISQ era and beyond, Quantum 2, 79 (2018).
  * Arute  _et al._ [2019] F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, R. Biswas, S. Boixo, F. G. S. L. Brandao, D. A. Buell, B. Burkett, Y. Chen, Z. Chen, B. Chiaro, R. Collins, W. Courtney, A. Dunsworth, E. Farhi, B. Foxen, A. Fowler, C. Gidney, M. Giustina, R. Graff, K. Guerin, S. Habegger, M. P. Harrigan, M. J. Hartmann, A. Ho, M. Hoffmann, T. Huang, T. S. Humble, S. V. Isakov, E. Jeffrey, Z. Jiang, D. Kafri, K. Kechedzhi, J. Kelly, P. V. Klimov, S. Knysh, A. Korotkov, F. Kostritsa, D. Landhuis, M. Lindmark, E. Lucero, D. Lyakh, S. Mandrà, J. R. McClean, M. McEwen, A. Megrant, X. Mi, K. Michielsen, M. Mohseni, J. Mutus, O. Naaman, M. Neeley, C. Neill, M. Y. Niu, E. Ostby, A. Petukhov, J. C. Platt, C. Quintana, E. G. Rieffel, P. Roushan, N. C. Rubin, D. Sank, K. J. Satzinger, V. Smelyanskiy, K. J. Sung, M. D. Trevithick, A. Vainsencher, B. Villalonga, T. White, Z. J. Yao, P. Yeh, A. Zalcman, H. Neven, and J. M. Martinis, Quantum supremacy using a programmable superconducting processor, Nature 574, 505 (2019).
  * Wright  _et al._ [2019] K. Wright, K. M. Beck, S. Debnath, J. M. Amini, Y. Nam, N. Grzesiak, J.-S. Chen, N. C. Pisenti, M. Chmielewski, C. Collins, K. M. Hudek, J. Mizrahi, J. D. Wong-Campos, S. Allen, J. Apisdorf, P. Solomon, M. Williams, A. M. Ducore, A. Blinov, S. M. Kreikemeier, V. Chaplin, M. Keesan, C. Monroe, and J. Kim, Benchmarking an 11-qubit quantum computer, Nature Communications 10, 5464 (2019).
  * Jurcevic  _et al._ [2021] P. Jurcevic, A. Javadi-Abhari, L. S. Bishop, I. Lauer, D. F. Bogorin, M. Brink, L. Capelluto, O. Günlük, T. Itoko, N. Kanazawa, A. Kandala, G. A. Keefe, K. Krsulich, W. Landers, E. P. Lewandowski, D. T. McClure, G. Nannicini, A. Narasgond, H. M. Nayfeh, E. Pritchett, M. B. Rothwell, S. Srinivasan, N. Sundaresan, C. Wang, K. X. Wei, C. J. Wood, J.-B. Yau, E. J. Zhang, O. E. Dial, J. M. Chow, and J. M. Gambetta, Demonstration of quantum volume 64 on a superconducting quantum computing system, Quantum Science and Technology 6, 025020 (2021).
  * Pino  _et al._ [2021] J. M. Pino, J. M. Dreiling, C. Figgatt, J. P. Gaebler, S. A. Moses, M. S. Allman, C. H. Baldwin, M. Foss-Feig, D. Hayes, K. Mayer, C. Ryan-Anderson, and B. Neyenhuis, Demonstration of the trapped-ion quantum ccd computer architecture, Nature 592, 209 (2021).
  * O’Malley  _et al._ [2016] P. J. J. O’Malley, R. Babbush, I. D. Kivlichan, J. Romero, J. R. McClean, R. Barends, J. Kelly, P. Roushan, A. Tranter, N. Ding, B. Campbell, Y. Chen, Z. Chen, B. Chiaro, A. Dunsworth, A. G. Fowler, E. Jeffrey, E. Lucero, A. Megrant, J. Y. Mutus, M. Neeley, C. Neill, C. Quintana, D. Sank, A. Vainsencher, J. Wenner, T. C. White, P. V. Coveney, P. J. Love, H. Neven, A. Aspuru-Guzik, and J. M. Martinis, Scalable quantum simulation of molecular energies, Phys. Rev. X 6, 031007 (2016).
  * Kandala  _et al._ [2017] A. Kandala, A. Mezzacapo, K. Temme, M. Takita, M. Brink, J. M. Chow, and J. M. Gambetta, Hardware-efficient variational quantum eigensolver for small molecules and quantum magnets, Nature 549, 242 (2017).
  * Hempel  _et al._ [2018] C. Hempel, C. Maier, J. Romero, J. McClean, T. Monz, H. Shen, P. Jurcevic, B. P. Lanyon, P. Love, R. Babbush, A. Aspuru-Guzik, R. Blatt, and C. F. Roos, Quantum chemistry calculations on a trapped-ion quantum simulator, Phys. Rev. X 8, 031022 (2018).
  * Kandala  _et al._ [2019] A. Kandala, K. Temme, A. D. Córcoles, A. Mezzacapo, J. M. Chow, and J. M. Gambetta, Error mitigation extends the computational reach of a noisy quantum processor, Nature 567, 491 (2019).
  * Arute  _et al._ [2020] F. Arute, K. Arya, R. Babbush, D. Bacon, J. C. Bardin, R. Barends, S. Boixo, M. Broughton, B. B. Buckley, D. A. Buell, B. Burkett, N. Bushnell, Y. Chen, Z. Chen, B. Chiaro, R. Collins, W. Courtney, S. Demura, A. Dunsworth, E. Farhi, A. Fowler, B. Foxen, C. Gidney, M. Giustina, R. Graff, S. Habegger, M. P. Harrigan, A. Ho, S. Hong, T. Huang, W. J. Huggins, L. Ioffe, S. V. Isakov, E. Jeffrey, Z. Jiang, C. Jones, D. Kafri, K. Kechedzhi, J. Kelly, S. Kim, P. V. Klimov, A. Korotkov, F. Kostritsa, D. Landhuis, P. Laptev, M. Lindmark, E. Lucero, O. Martin, J. M. Martinis, J. R. McClean, M. McEwen, A. Megrant, X. Mi, M. Mohseni, W. Mruczkiewicz, J. Mutus, O. Naaman, M. Neeley, C. Neill, H. Neven, M. Y. Niu, T. E. O’Brien, E. Ostby, A. Petukhov, H. Putterman, C. Quintana, P. Roushan, N. C. Rubin, D. Sank, K. J. Satzinger, V. Smelyanskiy, D. Strain, K. J. Sung, M. Szalay, T. Y. Takeshita, A. Vainsencher, T. White, N. Wiebe, Z. J. Yao, P. Yeh, and A. Zalcman, Hartree-fock on a superconducting qubit quantum computer, Science 369, 1084 (2020).
  * Rančić [2022] M. J. Rančić, Exactly solving the Kitaev chain and generating Majorana-zero-modes out of noisy qubits, Scientific Reports 12, 19882 (2022).
  * Lutchyn  _et al._ [2018] R. M. Lutchyn, E. P. A. M. Bakkers, L. P. Kouwenhoven, P. Krogstrup, C. M. Marcus, and Y. Oreg, Majorana zero modes in superconductor–semiconductor heterostructures, Nature Reviews Materials 3, 52 (2018).
  * Jiang  _et al._ [2018] Z. Jiang, K. J. Sung, K. Kechedzhi, V. N. Smelyanskiy, and S. Boixo, Quantum algorithms to simulate many-body physics of correlated fermions, Phys. Rev. Applied 9, 044036 (2018).
  * Viola  _et al._ [1999] L. Viola, E. Knill, and S. Lloyd, Dynamical decoupling of open quantum systems, Phys. Rev. Lett. 82, 2417 (1999).
  * Ali Ahmed  _et al._ [2013] M. A. Ali Ahmed, G. A. Álvarez, and D. Suter, Robustness of dynamical decoupling sequences, Phys. Rev. A 87, 042309 (2013).
  * qis [2022] Qiskit: An open-source framework for quantum computing (2022).
  * Bravyi  _et al._ [2021] S. Bravyi, S. Sheldon, A. Kandala, D. C. Mckay, and J. M. Gambetta, Mitigating measurement errors in multiqubit experiments, Phys. Rev. A 103, 042605 (2021).
  * [20] mthree: Matrix-free Measurement Mitigation, https://github.com/Qiskit-Partners/mthree, accessed: 2022-03-30.
  * Nation  _et al._ [2021] P. D. Nation, H. Kang, N. Sundaresan, and J. M. Gambetta, Scalable mitigation of measurement errors on quantum computers, PRX Quantum 2, 040326 (2021).
  * McWeeny [1960] R. McWeeny, Some recent advances in density matrix theory, Rev. Mod. Phys. 32, 335 (1960).
  * Bach  _et al._ [1994] V. Bach, E. H. Lieb, and J. P. Solovej, Generalized Hartree-Fock theory and the Hubbard model, Journal of Statistical Physics 76, 3 (1994).
  * [24] mapomatic: Automatic mapping of compiled circuits to low-noise sub-graphs, https://github.com/Qiskit-Partners/mapomatic, accessed: 2022-03-30.
  * Gluza  _et al._ [2018] M. Gluza, M. Kliesch, J. Eisert, and L. Aolita, Fidelity witnesses for fermionic quantum simulations, Phys. Rev. Lett. 120, 190501 (2018).
  * Leumer  _et al._ [2020] N. Leumer, M. Marganska, B. Muralidharan, and M. Grifoni, Exact eigenvectors and eigenvalues of the finite Kitaev chain and its topological properties, Journal of Physics: Condensed Matter 32, 445502 (2020).
  * Harle  _et al._ [2022] N. Harle, O. Shtanko, and R. Movassagh, Observing and braiding topological Majorana modes on programmable quantum simulators (2022), arXiv:2203.15083 [quant-ph] .
  * Mi  _et al._ [2022] X. Mi, M. Sonner, M. Y. Niu, K. W. Lee, B. Foxen, R. Acharya, I. Aleiner, T. I. Andersen, F. Arute, K. Arya, A. Asfaw, J. Atalaya, J. C. Bardin, J. Basso, A. Bengtsson, G. Bortoli, A. Bourassa, L. Brill, M. Broughton, B. B. Buckley, D. A. Buell, B. Burkett, N. Bushnell, Z. Chen, B. Chiaro, R. Collins, P. Conner, W. Courtney, A. L. Crook, D. M. Debroy, S. Demura, A. Dunsworth, D. Eppens, C. Erickson, L. Faoro, E. Farhi, R. Fatemi, L. Flores, E. Forati, A. G. Fowler, W. Giang, C. Gidney, D. Gilboa, M. Giustina, A. G. Dau, J. A. Gross, S. Habegger, M. P. Harrigan, M. Hoffmann, S. Hong, T. Huang, A. Huff, W. J. Huggins, L. B. Ioffe, S. V. Isakov, J. Iveland, E. Jeffrey, Z. Jiang, C. Jones, D. Kafri, K. Kechedzhi, T. Khattar, S. Kim, A. Y. Kitaev, P. V. Klimov, A. R. Klots, A. N. Korotkov, F. Kostritsa, J. M. Kreikebaum, D. Landhuis, P. Laptev, K.-M. Lau, J. Lee, L. Laws, W. Liu, A. Locharla, O. Martin, J. R. McClean, M. McEwen, B. M. Costa, K. C. Miao, M. Mohseni, S. Montazeri, A. Morvan, E. Mount, W. Mruczkiewicz, O. Naaman, M. Neeley, C. Neill, M. Newman, T. E. O’Brien, A. Opremcak, A. Petukhov, R. Potter, C. Quintana, N. C. Rubin, N. Saei, D. Sank, K. Sankaragomathi, K. J. Satzinger, C. Schuster, M. J. Shearn, V. Shvarts, D. Strain, Y. Su, M. Szalay, G. Vidal, B. Villalonga, C. Vollgraff-Heidweiller, T. White, Z. Yao, P. Yeh, J. Yoo, A. Zalcman, Y. Zhang, N. Zhu, H. Neven, D. Bacon, J. Hilton, E. Lucero, R. Babbush, S. Boixo, A. Megrant, Y. Chen, J. Kelly, V. Smelyanskiy, D. A. Abanin, and P. Roushan, Noise-resilient edge modes on a chain of superconducting qubits, Science 378, 785 (2022), https://www.science.org/doi/pdf/10.1126/science.abq5769 .
  * Fidkowski and Kitaev [2010] L. Fidkowski and A. Kitaev, Effects of interactions on the topological classification of free fermion systems, Phys. Rev. B 81, 134509 (2010).
  * Fidkowski and Kitaev [2011] L. Fidkowski and A. Kitaev, Topological phases of fermions in one dimension, Phys. Rev. B 83, 075103 (2011).
  * Gangadharaiah  _et al._ [2011] S. Gangadharaiah, B. Braunecker, P. Simon, and D. Loss, Majorana edge states in interacting one-dimensional systems, Phys. Rev. Lett. 107, 036801 (2011).
  * Rahmani  _et al._ [2015] A. Rahmani, X. Zhu, M. Franz, and I. Affleck, Emergent supersymmetry from strongly interacting Majorana zero modes, Phys. Rev. Lett. 115, 166401 (2015).
  * Miao  _et al._ [2017] J.-J. Miao, H.-K. Jin, F.-C. Zhang, and Y. Zhou, Exact solution for the interacting Kitaev chain at the symmetric point, Phys. Rev. Lett. 118, 267701 (2017).
  * Stenger  _et al._ [2022] J. P. T. Stenger, G. Ben-Shach, D. Pekker, and N. T. Bronn, Simulating spectroscopy experiments with a superconducting quantum computer, Physical Review Research 4, 043106 (2022).
  * Peruzzo  _et al._ [2014] A. Peruzzo, J. McClean, P. Shadbolt, M.-H. Yung, X.-Q. Zhou, P. J. Love, A. Aspuru-Guzik, and J. L. O’Brien, A variational eigenvalue solver on a photonic quantum processor, Nature Communications 5, 1 (2014).
  * Cerezo  _et al._ [2021] M. Cerezo, A. Arrasmith, R. Babbush, S. C. Benjamin, S. Endo, K. Fujii, J. R. McClean, K. Mitarai, X. Yuan, L. Cincio, and P. J. Coles, Variational quantum algorithms, Nature Reviews Physics 3, 625 (2021).
  * Farhi  _et al._ [2000] E. Farhi, J. Goldstone, S. Gutmann, and M. Sipser, Quantum computation by adiabatic evolution (2000).
  * Aharonov  _et al._ [2007] D. Aharonov, W. van Dam, J. Kempe, Z. Landau, S. Lloyd, and O. Regev, Adiabatic quantum computation is equivalent to standard quantum computation, SIAM Journal on Computing 37, 166 (2007), https://doi.org/10.1137/S0097539705447323 .
  * [39] qpic: Creating quantum circuit diagrams in TikZ, https://github.com/qpic/qpic, accessed: 2022-04-07.
  * Hunter [2007] J. D. Hunter, Matplotlib: A 2d graphics environment, Computing in Science & Engineering 9, 90 (2007).
  * McClean  _et al._ [2020] J. R. McClean, N. C. Rubin, K. J. Sung, I. D. Kivlichan, X. Bonet-Monroig, Y. Cao, C. Dai, E. S. Fried, C. Gidney, B. Gimby, P. Gokhale, T. Häner, T. Hardikar, V. Havlíček, O. Higgott, C. Huang, J. Izaac, Z. Jiang, X. Liu, S. McArdle, M. Neeley, T. O’Brien, B. O’Gorman, I. Ozfidan, M. D. Radin, J. Romero, N. P. D. Sawaya, B. Senjean, K. Setia, S. Sim, D. S. Steiger, M. Steudtner, Q. Sun, W. Sun, D. Wang, F. Zhang, and R. Babbush, OpenFermion: the electronic structure package for quantum computers, Quantum Science and Technology 5, 034014 (2020).

### Author contributions

N.T.B. and O.T.L. conceived the project. K.J.S. developed the error mitigation
techniques and collected and analyzed the experimental data. K.J.S. and N.T.B.
wrote the software for the experiment. K.J.S. and M.J.R. wrote the manuscript
with the assistance of N.T.B. and O.T.L. All authors contributed to
discussions that shaped the project.

### Competing interests

The authors declare no competing interests.

##  Appendix A Fermionic Gaussian states

In this section, we provide background material on fermionic Gaussian states
and review the quantum algorithm given in Reference [15] for preparing them.

Fermionic Gaussian states can be defined in several equivalent ways. One
definition is that fermionic Gaussian states are eigenstates of quadratic
fermionic Hamiltonians. The general form of a quadratic fermionic Hamiltonian
can be written as

$\displaystyle
H=\sum_{p,q=1}^{n}M_{pq}a^{\dagger}_{p}a_{q}+\frac{1}{2}\sum_{p,q=1}^{n}(\Delta_{pq}a^{\dagger}_{p}a^{\dagger}_{q}-\Delta_{pq}^{*}a_{p}a_{q}),$
(17)

where $M$ and $\Delta$ are $n\times n$ matrices. The operators
$\\{a_{p}\\}_{p=1}^{n}$ are fermionic annihilation operators which satisfy the
fermionic anticommutation relations

$\displaystyle a_{p}a_{q}+a_{q}a_{p}$ $\displaystyle=0,$ (18) $\displaystyle
a_{p}a^{\dagger}_{q}+a^{\dagger}_{q}a_{p}$ $\displaystyle=\delta_{pq}.$ (19)

The adjoint $a^{\dagger}_{p}$ of an annihilation operator $a_{p}$ is called a
creation operator. Since $H$ is Hermitian, we must have $M=M^{\dagger}$ and
$\Delta=-\Delta^{T}$. Any quadratic Hamiltonian can be rewritten in the
following form:

$\displaystyle
H=\sum_{p=1}^{n}\varepsilon_{p}b^{\dagger}_{p}b_{p}+\text{constant},$ (20)

where the $\varepsilon_{p}$ are non-negative real numbers. The $\\{b_{p}\\}$
are a new set of fermionic annihilation operators that also satisfy the
anticommutation relations (18) and (19). They are linear combinations of the
original creation and annihilation operators:

$\displaystyle\begin{pmatrix}b^{\dagger}_{1}\\\ \vdots\\\ b^{\dagger}_{n}\\\
b_{1}\\\ \vdots\\\ b_{n}\end{pmatrix}=W\begin{pmatrix}a^{\dagger}_{1}\\\
\vdots\\\ a^{\dagger}_{n}\\\ a_{1}\\\ \vdots\\\ a_{n}\end{pmatrix},$ (21)

where $W$ is a $2n\times 2n$ matrix. The matrix $W$ is unitary and has the
block form

$\displaystyle W=\begin{pmatrix}W^{*}_{1}&W^{*}_{2}\\\
W_{2}&W_{1}\end{pmatrix},$ (22)

where the fermionic anticommutation relations imply that

$\displaystyle W_{1}W_{2}^{T}+W_{2}W_{1}^{T}$ $\displaystyle=0,$ (23)
$\displaystyle W_{1}W_{1}^{\dagger}+W_{2}W_{2}^{\dagger}$ $\displaystyle=I.$
(24)

The matrix $W$ can be efficiently computed from $M$ and $\Delta$ using a Schur
decomposition; we refer the reader to Appendix A of Reference [15] for a
detailed description of how to perform this computation. Source code for
performing this computation is available in both OpenFermion [41] and Qiskit
Nature [18].

A fermionic Gaussian state can be prepared as an eigenstate of the Hamiltonian
(17) by effecting a unitary transformation $\mathcal{W}$ such that

$\displaystyle\mathcal{W}a_{p}\mathcal{W}^{\dagger}=b_{p},\qquad
p=1,\ldots,n.$ (25)

Up to a global phase, this unitary is determined by the matrix $W$. The ground
state of $H$ is

$\displaystyle\lvert\Psi_{0}\rangle=\mathcal{W}\lvert\text{vac}\rangle,$ (26)

and the other eigenstates are of the form

$\displaystyle\left(b^{\dagger}_{1}\right)^{i_{1}}\cdots\left(b^{\dagger}_{n}\right)^{i_{n}}\lvert\Psi_{0}\rangle,$
(27)

where $i_{p}\in\\{0,1\\}$ for $p=1,\ldots,n$. Therefore, a fermionic Gaussian
state is prepared by applying $\mathcal{W}$ to a state of the form

$\displaystyle\left(a^{\dagger}_{1}\right)^{i_{1}}\cdots\left(a^{\dagger}_{n}\right)^{i_{n}}\lvert\text{vac}\rangle,$
(28)

a computational basis state under the Jordan-Wigner transformation.

To implement the unitary, we used the algorithm described in Reference [15].
The algorithm starts with the matrix $W$ as input. Actually, due to the
redundancy in $W$ only the lower half $W_{L}$ is used:

$\displaystyle W_{L}=(W_{2}\quad W_{1}).$ (29)

The algorithm works by finding a decomposition of $W_{L}$

$\displaystyle VW_{L}U^{\dagger}=(0\quad I),$ (30)

where $I$ is the identity matrix, $V$ is an $n\times n$ unitary matrix, and
$U$ is further decomposed into elementary matrix operations as

$\displaystyle U=BG_{n_{G}}\cdots BG_{3}G_{2}BG_{1}B.$ (31)

Here, each $G_{i}$ is a matrix of the form

$\displaystyle
G(\theta,\varphi)=\left(\begin{array}[]{cc|cc}\cos\theta&-e^{i\varphi}\sin\theta&0&0\\\
\sin\theta&e^{i\varphi}\cos\theta&0&0\\\ \hline\cr
0&0&\cos\theta&-e^{-i\varphi}\sin\theta\\\
0&0&\sin\theta&e^{-i\varphi}\cos\theta\end{array}\right),$ (36)

and

$\displaystyle
B=B^{\dagger}=\begin{pmatrix}I-e_{n}e_{n}^{T}&e_{n}e_{n}^{T}\\\\[4.0pt]
e_{n}e_{n}^{T}&I-e_{n}e_{n}^{T}\end{pmatrix},$ (37)

where $e_{n}=(0,\ldots,0,1)^{T}$ is a vector of length $n$. The decomposition
(30) corresponds to a decomposition

$\displaystyle\mathcal{W}=\mathcal{B}\mathcal{G}_{1}\mathcal{B}\mathcal{G}_{2}\mathcal{G}_{3}\mathcal{B}\cdots\mathcal{G}_{n_{G}}\mathcal{B}\cdot\mathcal{V}=\mathcal{U}\cdot\mathcal{V}$
(38)

of the desired unitary in terms of elementary gates. Here each
$\mathcal{G}_{i}$ is a complex Givens rotation gate of the form

$\displaystyle\mathcal{G}(\theta,\varphi)=\exp\left[i\varphi
a_{q}^{\dagger}a_{q}\right]\exp\left[\theta(a_{p}^{\dagger}a_{q}-a_{q}^{\dagger}a_{p})\right]$
(39)

acting on neighboring modes, and $\mathcal{B}$ is the particle-hole
transformation on the last fermionic mode,

$\displaystyle\mathcal{B}a_{n}\mathcal{B}^{\dagger}$
$\displaystyle=a_{n}^{\dagger},$ (40)
$\displaystyle\mathcal{B}a_{p}\mathcal{B}^{\dagger}$
$\displaystyle=a_{p}\qquad\text{for }p=1,\ldots,n-1.$ (41)

Under the Jordan-Wigner transformation, the Givens rotation between
neighboring modes is a two-qubit gate with matrix

$\displaystyle G(\theta,\varphi)=\begin{pmatrix}1&0&0&0\\\
0&e^{i\varphi}\cos(\theta)&-e^{i\varphi}\sin(\theta)&0\\\
0&\sin(\theta)&\cos(\theta)&0\\\ 0&0&0&e^{i\varphi}\end{pmatrix},$ (42)

and the particle-hole transformation is a single-qubit $X$ gate on the last
qubit. The unitary $\mathcal{V}$ can also be decomposed into Givens rotations,
but this is not necessary when the initial state of the circuit is the all
zeros state, i.e., when the ground state is being prepared. The total number
of Givens rotations used by the algorithm is

$\displaystyle\frac{n(n-1)}{2}+\eta(n-\eta)$ (43)

where $\eta$ is the number of pseudoparticles. The circuit depth is at most
$3n-2$.

In summary, this algorithm yields a quantum circuit for preparing the
fermionic Gaussian state under the Jordan-Wigner transformation with linear
depth and which uses only linear connectivity. Source code for this algorithm
is available in both OpenFermion [41] and Qiskit Nature [18].

##  Appendix B Measurement of the correlation matrix

In this section, we provide details on our strategy for measuring the
correlation matrix of a fermionic Gaussian state. Our strategy is similar to
the one used in Reference [12] to measure the one-particle reduced density
matrix (1-RDM).

The correlation matrix $\Gamma$ of a state $\rho$ is defined as the block
matrix

$\displaystyle\Gamma=\begin{pmatrix}T&S\\\ -S^{*}&I-T^{T}\end{pmatrix}$ (44)

where

$\displaystyle T_{jk}$
$\displaystyle=\operatorname{Tr}\left[a^{\dagger}_{j}a_{k}\rho\right]$ (45)
$\displaystyle S_{jk}$
$\displaystyle=\operatorname{Tr}\left[a^{\dagger}_{j}a^{\dagger}_{k}\rho\right]$
(46)

and $I$ is the identity matrix.

The diagonal entries of the correlation matrix are occupation numbers that can
be measured straightforwardly in the computational basis. To obtain the off-
diagonal entries, we need to measure the operators

$\displaystyle a_{j}^{\dagger}a_{k}+a_{k}^{\dagger}a_{j}$
$\displaystyle\mapsto\frac{X_{j}X_{k}+Y_{j}Y_{k}}{2}Z_{j+1}\cdots Z_{k-1}$
(47) $\displaystyle-i(a_{j}^{\dagger}a_{k}-a_{k}^{\dagger}a_{j})$
$\displaystyle\mapsto\frac{X_{j}Y_{k}-Y_{j}X_{k}}{2}Z_{j+1}\cdots Z_{k-1}$
(48) $\displaystyle a_{j}^{\dagger}a_{k}^{\dagger}+a_{k}a_{j}$
$\displaystyle\mapsto\frac{X_{j}X_{k}-Y_{j}Y_{k}}{2}Z_{j+1}\cdots Z_{k-1}$
(49) $\displaystyle-i(a_{j}^{\dagger}a_{k}^{\dagger}-a_{k}a_{j})$
$\displaystyle\mapsto\frac{-X_{j}Y_{k}-Y_{j}X_{k}}{2}Z_{j+1}\cdots Z_{k-1}$
(50)

where $j<k$ and we have shown how the operators map under the Jordan-Wigner
transformation. For the case of neighboring modes, i.e., $k=j+1$, we have

$\displaystyle a_{j}^{\dagger}a_{k}+a_{k}^{\dagger}a_{j}$
$\displaystyle\mapsto\frac{X_{j}X_{k}+Y_{j}Y_{k}}{2}$ (51)
$\displaystyle-i(a_{j}^{\dagger}a_{k}-a_{k}^{\dagger}a_{j})$
$\displaystyle\mapsto\frac{X_{j}Y_{k}-Y_{j}X_{k}}{2}$ (52) $\displaystyle
a_{j}^{\dagger}a_{k}^{\dagger}+a_{k}a_{j}$
$\displaystyle\mapsto\frac{X_{j}X_{k}-Y_{j}Y_{k}}{2}$ (53)
$\displaystyle-i(a_{j}^{\dagger}a_{k}^{\dagger}-a_{k}a_{j})$
$\displaystyle\mapsto\frac{-X_{j}Y_{k}-Y_{j}X_{k}}{2}.$ (54)

If the correlation matrix is real, then only the first and third operators
need to be measured. A sufficient condition for the correlation matrix to be
real is that the circuit used to prepare the state contains only gates with
real-valued matrices, up to global phase. In our experiment, we checked for
this condition by directly inspecting the gates in the circuit.

Between neighboring modes, these operators can be measured by diagonalizing
them with a parity-preserving two-qubit gate. For example, the third operator
is diagonalized by the gate with matrix

$\displaystyle\begin{pmatrix}\frac{1}{\sqrt{2}}&0&0&\frac{1}{\sqrt{2}}\\\
0&1&0&0\\\ 0&0&1&0\\\
-\frac{1}{\sqrt{2}}&0&0&\frac{1}{\sqrt{2}}\end{pmatrix}.$ (55)

Using parity-preserving gates for measurement enables the error mitigation
technique of postselection on bitstring parity, described below. These gates
can be implemented on hardware similarly to the Givens rotation gates by
decomposing them into two CNOT gates plus single-qubit rotations.

To measure the operators between non-neighboring modes, there are several
possible approaches. One could measure them directly in the Pauli basis using
single-qubit rotations to effect the basis changes. This approach has the
drawback that the single-qubit rotations do not preserve the parity, so we
would not be able to perform bitstring postselection on parity. Alternatively,
one could perform fermionic swap gates to swap the modes until they are
neighboring. However, this approach involves adding additional gates to the
circuits, which increases the errors due to execution on a noisy device.

Here, we take a different approach, which was described in Reference [12] for
the case of measuring the 1-RDM of a Slater determinant. Recall that the
fermionic Gaussian state is prepared by effecting a unitary transformation
$\mathcal{W}$ such that

$\displaystyle\mathcal{W}a_{p}\mathcal{W}^{\dagger}=b_{p},\qquad
p=1,\ldots,n.$ (56)

The $\\{b^{\dagger}_{j}\\}$ are linear combinations of the original creation
and annihilation operators:

$\displaystyle\begin{pmatrix}b^{\dagger}_{1}\\\ \vdots\\\ b^{\dagger}_{n}\\\
\end{pmatrix}=W\begin{pmatrix}a^{\dagger}_{1}\\\ \vdots\\\ a^{\dagger}_{n}\\\
a_{1}\\\ \vdots\\\ a_{n}\end{pmatrix}$ (57)

where $W$ is an $n\times 2n$ matrix. The matrix $W$ can be efficiently
computed from the description of the Hamiltonian and is used to produce the
quantum circuit that prepares an eigenstate of the Hamiltonian, as described
in Appendix A. Note that the columns of $W$ are indexed by the operators
$\\{a^{\dagger}_{j}\\}$ and $\\{a_{j}\\}$. However, the ordering of the
operators $\\{a^{\dagger}_{j}\\}$ is arbitrary, so we can reorder them without
changing the definition of the $\\{b^{\dagger}_{j}\\}$ and the target
fermionic Gaussian state. A reordering of the operators
$\\{a^{\dagger}_{j}\\}$ corresponds to a permutation of the first $n$ columns
of $W$. We want to use the same order for both the $\\{a^{\dagger}_{j}\\}$ and
the $\\{a_{j}\\}$, so we will always apply the same permutation to the first
$n$ columns of $W$ and the last $n$ columns. Each permutation causes different
pairs of modes to be mapped to neighboring qubits. This procedure enables the
measurement of operators between all pairs of modes without the need to add
fermionic swap gates to the circuits. By generating the permutations according
to a “parallel bubble sort” pattern, we can minimize the total number of
permutations needed.

As an example, consider a system of 6 fermionic modes, initially labeled as

$\displaystyle(0,1,2,3,4,5)$ (58)

In this configuration, we can measure the operators between 0–1, 1–2, etc. The
parallel bubble sort pattern performs a sequence of swaps starting on even
indices, followed by a sequence of swaps on odd indices:

$\displaystyle(0,1,2,3,4,5)\rightarrow(1,0,3,2,5,4)\rightarrow(1,3,0,5,2,4).$
(59)

Now, we can measure the operators between 1–3, 0–5, etc. Repeating this
procedure one more time yields the configuration (3, 5, 1, 4, 0, 2), allowing
the rest of the operators to be measured. In total, $\lceil n/2\rceil$
permutations are required, including the identity permutation corresponding to
the initial configuration. For each permutation, four different basis changes
are required to measure the operators (51-54), and each basis change gives
rise to two circuits, one to measure pairs of qubits starting on even indices,
and one for odd indices. Together with the circuit for measuring the diagonal
entries, measuring the correlation matrix of a state requires $\lceil
n/2\rceil\times 8+1$ circuits in total. In our experiments the correlation
matrix was real, so only two of the basis changes were required and the total
number of circuits was $\lceil n/2\rceil\times 4+1$.

Figure 6: Effectiveness of post-selection. Data is presented for the Kitaev
chain of length 7. (Top) Fidelity witness and energy error for the data
analyzed without postselection (No PS) and with postselection (PS). (Bottom)
Measured excitation energies with and without postselection.

##  Appendix C Fidelity witness

Reference [25] shows how to obtain a fidelity witness for experiments
preparing fermionic Gaussian states. In this section we review this result and
describe how we computed the fidelity witness in our experiment.

Consider an experiment that aims to prepare a known pure fermionic Gaussian
target state $\rho_{t}$. Let $\rho_{p}$ denote the imperfect state that is
actually prepared in the experiment. The closeness between the two states is
measured by the fidelity

$\displaystyle
F(\rho_{t},\rho_{p})=\left(\operatorname{Tr}\left[\left(\sqrt{\rho_{t}}\rho_{p}\sqrt{\rho_{t}}\right)^{\frac{1}{2}}\right]\right)^{2}.$
(60)

Since $\rho_{t}$ is pure, this equation simplifies to

$\displaystyle
F(\rho_{t},\rho_{p})=\operatorname{Tr}\left[\rho_{t}\rho_{p}\right].$ (61)

A fidelity witness is an observable $W$ for which the value
$F_{W}(\rho_{p})=\operatorname{Tr}\left[W\rho_{p}\right]$ gives a lower bound
on the fidelity between $\rho_{t}$ and $\rho_{p}$. Reference [25] describes
such a witness and gives an expression for the fidelity lower bound in terms
of the covariance matrices $M_{t}$ and $M_{p}$ of $\rho_{t}$ and $\rho_{p}$:

$\displaystyle
F_{W}(\rho_{p})=1+\frac{1}{4}\operatorname{Tr}[\left(M_{p}-M_{t}\right)^{T}M_{t}]$
(62)

The covariance matrix $M$ of a state $\rho$ has entries

$\displaystyle
M_{jk}=\frac{i}{2}\operatorname{Tr}\left[\left(\gamma_{j}\gamma_{k}-\gamma_{k}\gamma_{j}\right)\rho\right]$
(63)

where the $\gamma_{j}$ are Majorana fermion operators. To relate the
covariance matrix to the correlation matrix it is convenient to use the
following alternative indexing convention for the Majorana operators:

$\displaystyle\gamma_{j}=a_{j}+a^{\dagger}_{j},\quad\gamma_{j+n}=-i\left(a_{j}-a^{\dagger}_{j}\right).$
(64)

Under this convention, the covariance matrix is related to the correlation
matrix $\Gamma$ by the identity

$\displaystyle M=i\Omega\left(2\Gamma-I\right)\Omega^{\dagger}$ (65)

where $\Omega$ is the block matrix

$\displaystyle\Omega=\frac{1}{\sqrt{2}}\begin{pmatrix}I&I\\\
iI&-iI\end{pmatrix}.$ (66)

Using this relation, the expression for the fidelity lower bound can be
written in terms of the correlation matrices $\Gamma_{t}$ and $\Gamma_{p}$ of
$\rho_{t}$ and $\rho_{p}$:

$\displaystyle
F_{W}(\rho_{p})=1-\operatorname{Tr}\left[\left(\Gamma_{t}-\Gamma_{p}\right)\left(\Gamma_{t}-\frac{I}{2}\right)\right].$
(67)

While Reference [25] describes an efficient protocol for measuring the
fidelity lower bound without needing to measure the entire covariance or
correlation matrix, in our experiment we measured the entire correlation
matrix and directly used Equation (67) to compute the fidelity lower bound.

##  Appendix D Effect of postselection

In this section, we provide additional data demonstrating the effect of the
error mitigation technique of postselection on bitstring parity. Figure 6
shows the fidelity witness, energy error, and excitation energies for the data
from the 7-qubit experiment, analyzed with and without postselection. All the
other error mitigation techniques are still applied. The data shows that while
postselection does give a noticeable improvement to fidelity and energy
precision, the energy curves are still reproduced quite well without it,
including the measurement of the zero-energy excitation states.


# Hand Gesture Recognition Using Temporal Convolutions and Attention Mechanism

###### Abstract

Advances in biosignal signal processing and machine learning, in particular
Deep Neural Networks (DNNs), have paved the way for the development of
innovative Human-Machine Interfaces for decoding the human intent and
controlling artificial limbs. DNN models have shown promising results with
respect to other algorithms for decoding muscle electrical activity,
especially for recognition of hand gestures. Such data-driven models, however,
have been challenged by their need for a large number of trainable parameters
and their structural complexity. Here we propose the novel Temporal
Convolutions-based Hand Gesture Recognition architecture (TC-HGR) to reduce
this computational burden. With this approach, we classified $17$ hand
gestures via surface Electromyogram (sEMG) signals by the adoption of
attention mechanisms and temporal convolutions. The proposed method led to
$81.65\%$ and $80.72\%$ classification accuracy for window sizes of $300$ms
and $200$ms, respectively. The number of parameters to train the proposed TC-
HGR architecture is $11.9$ times less than that of its state-of-the-art
counterpart.

Index Terms—  Attention Mechanism, Temporal Convolutions, surface
Electromyogram, Hand Gesture Recognition.

##  1 Introduction

Hand gesture recognition via surface Electromyogram (sEMG) signals [1, 2, 3,
4, 5] has been investigated in the literature as the most promising approach
for myoelectric control of prosthetic systems. In particular, Hand Gesture
Recognition (HGR) has been the focus of different research works [6, 7], given
its unique potentials to improve the quality of control and consequently to
enhance the quality of life of amputees. Although academic researchers have
used advanced Machine Learning (ML) and Deep Neural Network (DNN) models to
achieve promising laboratory results in HGR, translating these new techniques
into the daily lives of amputees has faced several critical challenges [8, 9].
One of the key challenges is the dependency of DNN models on a large number of
trainable parameters, which leads to structural complexity and limits their
applicability to clinical settings [10]. Therefore, there is an urgent and
unmet quest to develop DNN-based learning frameworks that focus on reducing
the number of parameters and maintaining high performance.

The performance of DNN models developed based on sparse multi-channel sEMG is
still significantly lower than that of High-Density sEMG (HD-sEMG) systems
which has a high number of densely located electrodes to significantly
increase the information rate [11, 12, 13]. For instance, in Reference [12],
the HGR accuracy of $99.7\%$ is reported using HD-sEMG, which is reduced to
$84.4\%$ when sparse multi-channel sEMG signals are used. In this context, we
aim to design a novel DNN architecture using sparse multi-channel sEMG signals
provided by the Ninapro [14, 15] database, which is one of the most widely
accepted sparse multi-channel sEMG benchmark datasets. We designed the novel
Temporal Convolutions-Hand Gesture Recognition architecture (TC-HGR) to reduce
computational burden while maintaining high accuracy, which is of paramount
importance to translate the classification results into smooth actions.

A common strategy for classifying hand movements with DNN-based algorithms is
converting sEMG signals into images and then using Convolutional Neural
Networks (CNNs) to detect hand movements [11, 12, 16, 17]. sEMG signals are,
however, sequential in nature, and CNNs cannot extract temporal features. In
this regard, recent literature [13, 10] used recurrent architectures such as
Long Short Term Memory (LSTM) networks to consider the sequential nature of
sEMG signals. In addition, LSTMs and CNNs can be combined as a hybrid
architecture [6] to jointly extract the temporal and spatial properties of
sEMG signals. Although sequence modeling with recurrent networks is a common
approach, it can have disadvantages, such as lack of parallelism during
training, exploding/vanishing gradient, and extensive memory/computation
requirements [18]. Therefore, Reference [18] proposed Temporal Convolutions
(TCs) for extracting temporal information in time series tasks while
addressing the aforementioned challenges of the recurrent architectures. In
addition Reference [10] proposed the concept of temporal dilation of LSTM to
reduce the computational cost, memory, requirement, and model complexity. On
the other hand, attention-based architectures such as Transformers [20, 19]
show great potentials for widespread adoption in different Artificial
Intelligence (AI) applications. In particular, the transformer-based
architectures could improve the recognition accuracy compared to their state-
of-the-art counterparts (where LSTM or hybrid LSTM-CNN are adopted). However,
transformers are limited by the memory and computation requirements of the
quadratic operation in attention for long sequences or images. Therefore, in
[19], the authors proposed dividing the images into patches and then using the
flattened patches as the input for the transformers. Inspired by the progress
of attention mechanism and TCs, recent literature [21, 22, 1] proposed a Few-
shot learning architecture, which is based on the combination of attention and
temporal convolutions.

In this paper, to address the challenges with recurrent architectures and
achieve high accuracy for sparse multichannel sEMG, we proposed the design of
the TC-HGR, which is based on TCs and attention mechanism. More specifically,
TCs use the dilated causal convolutions, which can increase the receptive
field of the network and extract the temporal features of the sEMG signals.
Moreover, by inspiring from [19], we divided the sEMG signals into patches to
reduce the computational cost. The contributions of the paper can be
summarized as follows:

  * •

The TC-HGR framework is proposed based on self-attention mechanism and
temporal convolution to address the aforementioned challenges with the
recurrent architectures.

  * •

The TC-HGR reduces the number of parameters, which is a key step forward to
embed the DNN models into prostheses controllers.

  * •

The TC-HGR divides the sEMG signals into patches, which reduces the
computational burden of the system.

  * •

The TC-HGR can access a long history through temporal convolutions and also
can pinpoint specific information in the sEMG signals through the attention
mechanism.

##  2 The Proposed TC-HGR Architecture

Developing a DNN architecture with fewer parameters can tackle the challenge
of structural complexity and reduce the gap between academic research and
practical settings for myoelectric prosthesis control. In what follows, first,
we present the pre-processing step of the proposed TC-HGR and then present its
detailed architecture.

###  2.1 Preprocessing Step

For developing TC-HGR architecture, we used the raw time-domain sEMG signals.
Following the recent literature [23, 11, 24, 15], the sEMG signals are pre-
processed and smoothed using a $1^{\text{st}}$ order low-pass Butterworth
filter. Moreover, to amplify the magnitude of sensors with small values, we
scaled the sEMG signals logarithmically [2]. This technique is known as
$\mu$-law transformation and is used for quantization in the speech domain.
However, we use it for normalizing the sEMG signals, i.e.,

$F(x_{t})=\text{sign}(x_{t})\frac{\ln{\big{(}1+\mu|x_{t}|\big{)}}}{\ln{\big{(}1+\mu\big{)}}},$
(1)

where $t$ represents the time; $x_{t}$ shows the sEMG signal, and $\mu$ is the
parameter that indicates the new range. In Reference [2], the authors showed
that scaling sEMG signals with $\mu$-law technique results in better
performance than normalizing with Minmax. This completes the steps performed
to pre-process the sEMG signals and prepare the input to be provided to the
TC-HGR architecture. Next, we present the detailed structure of the proposed
architecture.

###  2.2 The TC-HGR Architecture

Fig. 1: The proposed TC-HGR architecture: (a) Each input segment $\bm{X}$ (for
simplicity, we dropped the index $i$) is divided into $N$ non-overlapping
patches. Then, each patch is flattened and mapped to model dimension $D$ (blue
block). We refer to the output of this process as Embedded Patches. The
sequence of the Embedded Patches is passed into the Self-Attention module,
which includes the residual connection (purple block). Afterward, we used
$\bm{Z}$ number of Temporal Convolution Blocks to access a long history
(orange block). (b) Each Temporal Convolution Block consists of two dilated
causal convolutions, each followed by a ReLU activation function. Again, we
used residual connections to concatenate the output and input. Finally, a
Linear Layer (LL) is adopted to output the class label.

In this section, the proposed TC-HGR architecture is described in detail.
After pre-processing, we segment the sEMG signals based on a window of size
$\mathit{W}$ $\in\\{200ms,300ms\\}$, resulting in the dataset
$\mathcal{D}=\\{(\bm{X}_{i},\mathrm{y}_{i})\\}_{i=1}^{M}$. More specifically,
$\bm{X}_{i}\in\mathbb{R}^{C\times L}$ is the $i^{{}^{\text{th}}}$ segment with
label $\mathrm{y}_{i}$, for ($1\leq i\leq M$). Here, $C$ indicates the number
of channels in the input segment, and $L$ is the length of the segmented
sequence, which represents the number of samples obtained at a frequency of
$2$ kHz for a window of size $\mathit{W}$. As illustrated in Fig. 1, the TC-
HGR framework has been developed based on “Embedded Patches” and two modules,
namely Temporal Convolution Block and Self-Attention Module with Residual
Connection, which is described below:

(i) Embedded Patches: In a similar way to the Vision Transformer (ViT)
architecture [19], the input segment $\bm{X}_{i}$ is divided into $N$ non-
overlapping patches. Here, $N=L/P$, where $P$ shows the size of each patch.
This patching mechanism helps reduce memory and computation requirements. As
shown in Fig. 1, the sequence of linear projections of these patches are fed
as input to the TC-HGR architecture. More specifically, each patch is first
flattened and then is mapped into the model dimension $D$ with a trainable
linear projection. The output of this projection is called the “Embedded
Patches”.

(ii) Temporal Convolution Block: In recent literature (such as [18]), the
authors represented TCs for the sequence modeling tasks and showed that
temporal convolutions could outperform recurrent networks such as LSTMs in a
wide range of datasets and time-series tasks. More specifically, TCs offer
several advantages over recurrent networks such as processing the input
sequence as a whole rather than sequential training, low memory requirements,
stable gradient, and capturing the past information with flexible receptive
field size. Inspired by the performance of TCs for the sequential data, we
used “Temporal Convolution Block” (represented via an orange box in Fig. 1)
instead of recurrent networks for the sEMG-based HGR. As shown in Fig. 1, each
Temporal Convolution Block consists of dilated causal convolutions, where the
dilation rate $R$ increases exponentially, i.e., ($\mathrm{1,2,4,8,\ldots}$),
to access a receptive field that exceeds the length of the input sequence.
Moreover, each dilated causal convolution is followed by a ReLU activation
function. The number of Temporal Convolution Blocks are based on the
logarithmic scale with the number of patches $N$. More specifically, we used
$Z=\left\lceil{\log_{2}N}\right\rceil$ number of Temporal Convolution Block
for an input segment $\bm{X}$ with a sequence length of $L$.

(iii) Self-Attention Module with Residual Connection: In the proposed TC-HGR
architecture, we used the “Temporal Convolution Block” along with the
“Attention” mechanism. In [20], the authors showed that the attention
mechanism allows a model to present important information in a given input
sequence. Moreover, the attention mechanism has recently been used [1] in the
context of sEMG-based hand gesture recognition, where experiments have
demonstrated the ability of attention to identifying specific pieces of
information in the sequential nature of the sEMG signals. On the other hand,
in References [21, 22], it was shown that temporal convolutions and attention
are complementary mechanisms, i.e., the former captures a long history while
the latter identifies a specific type of information.

An attention block measures the pairwise similarity of each query and all keys
to assign a weight to each value. Then, the output is computed, which is the
weighted sum of the values [20]. The keys, values, and queries are packed
together into matrices $\bm{K}$, $\bm{V}$, and $\bm{Q}$, respectively. The
output matrix is then computed as follows

$\text{Attention}(\bm{Q},\bm{K},\bm{V})=\text{softmax}(\frac{\bm{Q}\bm{K}^{T}}{\sqrt{d_{k}}})\bm{V},$
(2)

where $\mathit{d_{k}}$ denotes the dimension of $\bm{K}$ and $\bm{Q}$. In the
TC-HGR architecture, we also used residual connections to concatenate the
output and input. This completes the description of the proposed TC-HGR
architecture, next, we present our results to evaluate its HGR performance.

Table 1: Descriptions of TC-HGR architecture variants.

Window size $\mathit{W}$ | Model ID | Number of Patches $N$ | Model dimension $D$ | Params
---|---|---|---|---
200ms | 1 | 10 | 12 | 49,186
2 | 10 | 16 | 68,445
3 | 16 | 12 | 69,076
4 | 16 | 16 | 94,965
300ms | 1 | 10 | 12 | 52,066
2 | 10 | 16 | 72,285
3 | 15 | 12 | 67,651
4 | 15 | 16 | 92,945

Table 2: classification accuracies for TC-HGR architectures variants. The STD
denotes the standard variation in accuracy over the $40$ subjects.

Window size
200ms | Model ID | 1 | 2 | 3 | 4
---|---|---|---|---|---
Accuracy ($\%$) | $80.29$ | $80.63$ | $80.51$ | 80.72
|  STD ($\%$) | $6.7$ | $6.8$ | $6.7$ | 6.6
Window size
300ms | Model ID | 1 | 2 | 3 | 4
Accuracy ($\%$) | $80.84$ | $81.59$ | $80.95$ | 81.65
|  STD ($\%$) | $6.4$ | $6.5$ | $6.5$ | 6.7

Table 3: Comparison between the proposed TC-HGR methodology and previous works [10], which used recurrent architectures (LSTM). Reference [10] |  | 200ms | 300ms
---|---|---|---
| Params | Accuracy ($\%$) | Params | Accuracy ($\%$)
4-layer 3rd Order Dilation | $1,102,801$ | $79.0$ | $1,102,801$ | $82.4$
4-layer 3rd Order Dilation (pure LSTM) | $\\_$ | $\\_$ | $466,944$ | $79.7$
SVM | $\\_$ | $26.9$ | $\\_$ | $30.7$
Our Method | Model 1 | 49,186 | $80.29$ | 52,066 | $80.84$
Model 4 | $94,965$ | 80.72 | $92,945$ | 81.65

##  3 Experiments and Results

In this section, first, the database used for evaluation is described followed
by the presentation of different experiments and results.

###  3.1 Database

To train and evaluate the proposed TC-HGR architecture, we used the second
Ninapro dataset [15] called DB2, which is a widely used public dataset. More
specifically, DB2 is collected by the Delsys Trigno Wireless EMG system, which
has $12$ channels and records the electrical activities of muscles at $2$ kHz.
Moreover, the DB2 dataset consists of the sEMG signals from $40$ healthy
subjects ($28$ males and $12$ females with age $29.9\pm 3.9$ years among which
$34$ are right-handed and six are left-handed) performing $50$ different hand
gestures. Each gesture is repeated $6$ times, each lasting for $5$ seconds
followed by $3$ seconds of rest. The $50$ different gestures in the DB2
dataset are presented in three sets of exercises (i.e., B, C, and D). In this
paper, we focus on Exercise B, which consists of $17$ different gestures. More
specifically, Exercise B consists of $9$ basic wrist movements with $8$
isometric and isotonic hand movements. Following the recommendations provided
by the Ninapro dataset, the training set consists of $2/3$ of the repetitions
of each gesture (i.e., $1,3,4$, and $6$), and the test set consists of the
remaining repetitions (i.e., $2$ and $5$). Please refer to [15] for a more
detailed description of the Ninapro database.

###  3.2 Results and Discussions

In this section, the performance of the proposed TC-HGR architecture is
evaluated through a comprehensive set of experiments. In Table 1, different
variants of the TC-HGR architecture are presented based on a window size of
$\mathit{W}$ $\in\\{200ms,300ms\\}$. For training, Adam optimizer was used
across all the models with a learning rate of $0.0001$. Furthermore, we used a
mini-batch size of $32$. The performance of each model is evaluated using
Cross-entropy loss. In Table 2, the averaged recognition accuracy of the
proposed TC-HGR architecture and its variants are reported over all subjects.
In what follows, we focus on three different experiments:

Experiment 1 - Effect of the Model’s Dimension $D$: In this experiment, the
objective is to investigate the effect of $D$ of the proposed TC-HGR
architecture on the recognition accuracy. In this regard, Table 2 has shown
the results for $D$ $\in\\{12,16\\}$ for both window sizes. From Table 1 and
Table 2, it is observed that the accuracy of the model will improve when the
$D$ is increased from $12$ to $16$ for the same Number of Patches $N$. More
specifically, “Model $2$ versus Model $1$” and “Model $4$ versus Model $3$”
are more accurate in both the $200$ms and $300$ms window sizes. However, from
Table 1, it can be observed that the number of trainable parameters has
increased when $D$ is increased from $12$ to $16$, which leads to more
complexity. For instance, for $\mathit{W}=200$ms and $N=10$, Model $2$ has
$68,445$ parameters, while this number is $49,186$ for Model $1$ (Table 1).
While increasing $D$ can potentially improve performance, the implementation
of prosthetic controllers is limited by its structural complexity.

Experiment 2 - Effect of the Number of Patches $N$: This experiment is
included to evaluate the effect of increasing $N$ on the performance of the
proposed TC-HGR. From Tables 1 and 2, it is observed that for the same
$\mathit{W}$ and $D$, accuracy increases as the number of patches $N$
increases from $10$ to $16$. More specifically, “Model $3$ versus Model $1$”
and “Model $4$ versus Model $2$” classified the hand gestures with higher
accuracies in both window sizes. This is because use of more patches results
in a larger effective sequence length, which in turn improves the overall
performance. Increasing the number of patches, however, makes the structure
more complex. For instance, for $\mathit{W}=300$ms and $D=12$, Model $3$ has
$67,651$ parameters, while Model $1$ has $52,066$ parameters (Table 1).

Fig. 2: The accuracy boxplots for all TC-HGR architecture variants for window
size $300$ms. Each boxplot is representing the IQR of each model across $40$
users. We used Wilcoxon signed-rank to compare the model with the least number
of paramaters (i.e.,Model $1$) with the remaining models; i.e., Model $2$,
Model $3$, and Model $4$. (ns: $0.05<\text{p-value}\leq 1$,
${}^{*}:0.01<\text{p-value}\leq 0.05$, ${}^{**}:0.001<\text{p-value}\leq
0.01$, ${}^{***}:0.0001<\text{p-value}\leq 0.001$,
${}^{****}:\text{p-value}\leq 0.0001$).

Experiment 3 - Effect of Window size $\mathit{W}$: As shown in Table 2,
increasing the window size leads to more accuracy. This is because the larger
the window size, the more information is provided for the proposed TC-HGR
architecture. In other words, machine learning model would have higher
exposure to the signals from the gesture. For instance, for both “Models $2$
and $1$”, the window size $300$ms leads to greater accuracy and complexity.
However, both “Models $3$ and $4$” classified hand gestures more accurately
while reducing the complexity because number of patches for $\mathit{W}=300ms$
is less than $\mathit{W}=200ms$. Although choosing a larger window size
increases accuracy, using shorter windows (e.g., $200$ms) provides extra time
($100$ms) for pre-processing or post-processing tasks.

Statistical Comparisons of the Different TC-HGR Variants for Window Size
300ms: To examine the importance and significance of TC-HGR variants, we
perform statistical tests for all models considering $\mathit{W}=300ms$. By
following [22], the Wilcoxon signed-rank test [25] is used in which each user
is considered as a separate dataset. As illustrated in Fig. 2, we conduct
comparison between the model with the least number of parameters (i.e., Model
$1$) and other models. (i.e., Model $2$, $3$, and $4$). Using Wilcoxon signed-
rank test, it can be mentioned that no statistical significance was observed
comparing Model $1$ and Model $3$ in Fig. 2. However, Model $1$ is significant
versus Model $2$ (or Model $4$) because the $p$-value is less than $0.05$.
Further details are provided in Fig. 2 where the $p$-value is indicated by the
following symbols:

  * •

Not significant (ns): p-value is between 0.05 and 1,

  * •

${}^{*}:$ p-value is between 0.01 and 0.05,

  * •

${}^{**}:$ p-value is between 0.001 and 0.01,

  * •

${}^{***}:$ p-value is between 0.0001 and 0.001,

  * •

${}^{****}:$p-value is smaller than 0.0001.

The performance distribution between $40$ users for each model is illustrated
in Fig. 2. More specifically, each model is represented by a boxplot in which
the performance distribution is divided into quartiles across all users (i.e.,
Interquartile Range (IQR)), and the median performance is represented by a
horizontal line.

Comparison with the State-of-the-art Research [10]: We have also compared the
results with a recent state-of-the-art model [10] in which the same dataset is
used for performance evaluations. More specifically, Reference [10] proposed
models based on recurrent architectures (i.e., LSTM) with dilation. As shown
in Table 3, for window size of $200$ms, our methodology can outperform both
recurrent networks and traditional ML approaches such as Support Vector
Machine (SVM). For instance, it can be observed that the accuracy for our
proposed Model $4$ is $80.72\%$ with only $94,965$ number of parameters, while
the best accuracy for the Reference [10] is $79\%$ with $1,102,801$
parameters. Moreover, as shown in Table 3, for window size of $300$ms, the
accuracy of the proposed Model $4$ is $81.65\%$, while for “pure LSTM with
dilation” and SVM proposed in [10], the accuracy is $79.9\%$ and $30.7\%$,
respectively. Although in [10] the authors reached to $82.4\%$ accuracy with
“4-layer 3rd Order Dilation” which is a hybrid dilation-based LSTM, they used
$1,102,801$ number of parameters which is $11.9$ times larger than the number
of parameters used in our proposed Model $4$. Therefore, we provided a compact
DNN model with a far fewer number of trainable parameters compared to previous
works, and took a step forward towards designing more proportional, intuitive,
and dexterous prostheses for clinical applications.

##  4 Conclusion

In this paper, we proposed a novel architecture referred to as the TC-HGR for
Hand Gesture Recognition from sparse multichannel sEMG signals. The proposed
model showed strong capability in addressing several existing challenges of
gesture recognition based on the temporal convolutions and attention
mechanism. We showed that by proper design of convolution-based architectures,
we can extract temporal information of the sEMG signal and improve the
performance. Moreover, the proposed architecture can reduce the required
number of trainable parameters with respect to the state-of-the-art, which is
a key enabling factor to reduce the complexity and embed DNN-based models into
prostheses controllers.

## References

  * [1] E. Rahimian, S. Zabihi, A. Asif, S.F. Atashzar, and A. Mohammadi,  “Few-Shot Learning for Decoding Surface Electromyography for Hand Gesture Recognition,”  IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2021, pp. 1300-1304.
  * [2] E. Rahimian, S. Zabihi, F. Atashzar, A. Asif, A. Mohammadi,  “XceptionTime: Independent Time-Window XceptionTime Architecture for Hand Gesture Classification,”  International Conference on Acoustics, Speech, and Signal Processing (ICASSP), pp. 1304-1308, 2020.
  * [3] P. Tsinganos, B. Cornelis, J. Cornelis, B, Jansen, and A. Skodras,  “Improved Gesture Recognition Based on sEMG Signals and TCN,”  International Conference on Acoustics, Speech, and Signal Processing (ICASSP), pp. 1169-1173, 2019.
  * [4] N. Jiang, S. Dosen, K.R. Muller, D. Farina,  “Myoelectric Control of Artificial Limbs. Is There A Need to Change Focus?”  IEEE Signal Processing Magazine, vol. 29, pp. 150-152, 2012.
  * [5] D. Farina, R. Merletti, R.M. Enoka,  “The Extraction of Neural Strategies from the Surface EMG,”  Journal of Applied Physiology, vol. 96, pp. 1486-95, 2004.
  * [6] E. Rahimian, S. Zabihi, S. F. Atashzar, A. Asif, and A. Mohammadi,  “Surface EMG-Based Hand Gesture Recognition via Hybrid and Dilated Deep Neural Network Architectures for Neurorobotic Prostheses,”  Journal of Medical Robotics Research, pp. 1-12, 2020.
  * [7] E. Rahimian, S. Zabihi, S. F. Atashzar, A. Asif, and A. Mohammadi,  “Semg-based Hand Gesture Recognition via Dilated Convolutional Neural Networks,”  Global Conference on Signal and Information Processing, GlobalSIP, 2019.
  * [8] C. Castellini, et al.,  “Proceedings of the First Workshop on Peripheral Machine Interfaces: Going Beyond Traditional Surface Electromyography,”  Frontiers in neurorobotics, 8, p. 22, 2014.
  * [9] D. Farina, et al.,  “The Extraction of Neural Information from the Surface EMG for the Control of Upper-limb Prostheses: Emerging Avenues and Challenges,”  Transactions on Neural Systems and Rehabilitation Engineering, vol 22, no.4, pp. 797-809, 2014.
  * [10] T. Sun, Q. Hu, P. Gulati, and S.F. Atashzar,  “Temporal Dilation of Deep LSTM for Agile Decoding of sEMG: Application in Prediction of Upper-limb Motor Intention in NeuroRobotics.,”  IEEE Robotics and Automation Letters, 2021.
  * [11] W. Geng, et al.,  “Gesture Recognition by Instantaneous Surface EMG Images,”  Scientific reports, 6, p. 36571, 2016.
  * [12] W. Wei, Y.Wong, Y. Du, Y. Hu, M. Kankanhalli, and W. Geng,  “A multi-stream convolutional neural network for sEMG-based gesture recognition in muscle-computer interface.,”  Pattern Recognition Letters, 2017.
  * [13] Y. Hu, et al.,  “A Novel Attention-based Hybrid CNN-RNN Architecture for sEMG-based Gesture Recognition,”  PloS one, vol. 13, no. 10, p.e0206049, 2018.
  * [14] M. Atzori, A. Gijsberts, I. Kuzborskij, S. Heynen, A.G.M Hager, O. Deriaz, C. Castellini, H. Müller, and B. Caputo,  “A Benchmark Database for Myoelectric Movement Classification,”  Transactions on Neural Systems and Rehabilitation Engineering, 2013.
  * [15] M. Atzori, et al.,  “Electromyography Data for Non-Invasive Naturally-Controlled Robotic Hand Prostheses,”  Scientific data 1, vol. 1, no. 1, pp. 1-13, 2014.
  * [16] Z. Ding, et al.,  “sEMG-based Gesture Recognition with Convolution Neural Networks,”  Sustainability 10, no. 6, p. 1865, 2018.
  * [17] W. Wei, et al.,  “Surface Electromyography-based Gesture Recognition by Multi-view Deep Learning,”  IEEE Transactions on Biomedical Engineering, vol. 66, no. 10, pp. 2964-2973, 2019.
  * [18] S. Bai, J.Z. Kolter, and V. Koltun,  “ An Empirical Evaluation of Generic Convolutional and Recurrent Networks for Sequence Modeling,”  arXiv preprint arXiv:1803.01271, 2018.
  * [19] A. Dosovitskiy, et al.,  “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale,”  arXiv preprint arXiv:2010.11929, 2020.
  * [20] A. Vaswani, N. Shazeer, J. Uszkoreit, L. Jones, A. Gomez N., L. Kaiser, and I. Polosukhin,  “Attention is All You Need,”  arXiv preprint arXiv:1706.03762, 2017a.
  * [21] N. Mishra, M. Rohaninejad, X. Chen, and P. Abbeel,  “A Simple Neural Attentive Meta-Learner,”  arXiv preprint arXiv:1707.03141, 2017.
  * [22] E. Rahimian, S. Zabihi, A. Asif, D. Farina, S.F. Atashzar, and A. Mohammadi,  “FS-HGR: Few-shot Learning for Hand Gesture Recognition via ElectroMyography,”  IEEE Trans. Neural Syst. Rehabil. Eng., 2021.
  * [23] W. Wei, et al. “A Multi-stream Convolutional Neural Network for sEMG-based Gesture Recognition in Muscle-computer Interface,”  Pattern Recognition Letters, 119, pp. 131-138, 2019.
  * [24] M. Atzori, M. Cognolato, and H. Müller,  “Deep Learning with Convolutional Neural Networks Applied to Electromyography Data: A Resource for the Classification of Movements for Prosthetic Hands,”  Frontiers in neurorobotics 10, p.9, 2016.
  * [25] F. Wilcoxon,  “Individual comparisons by ranking methods,”  Biometrics Bull.,vol. 1, no. 6, pp. 80–83, 1945.