Quantum Computing Algorithms and Computational Complexity
Quantum Computing Algorithms and Computational Complexity
Quantum Computing
Algorithms and
Computational Complexity
Edited by
Fernando L. Pelayo and Mauro Mezzini
www.mdpi.com/journal/mathematics
Quantum Computing Algorithms and
Computational Complexity
Quantum Computing Algorithms and
Computational Complexity
Editors
Fernando L. Pelayo
Mauro Mezzini
MDPI • Basel • Beijing • Wuhan • Barcelona • Belgrade • Manchester • Tokyo • Cluj • Tianjin
Editors
Fernando L. Pelayo Mauro Mezzini
University of Roma Tre University,
Castilla-La Mancha, Rome, Italy
Albacete, Spain
Editorial Office
MDPI
St. Alban-Anlage 66
4052 Basel, Switzerland
This is a reprint of articles from the Special Issue published online in the open access journal
Mathematics (ISSN 2227-7390) (available at: https://www.mdpi.com/si/mathematics/Quantum
Comput Algorithm Comput Complex).
For citation purposes, cite each article independently as indicated on the article page online and as
indicated below:
LastName, A.A.; LastName, B.B.; LastName, C.C. Article Title. Journal Name Year, Volume Number,
Page Range.
© 2023 by the authors. Articles in this book are Open Access and distributed under the Creative
Commons Attribution (CC BY) license, which allows users to download, copy and build upon
published articles, as long as the author and publisher are properly credited, which ensures maximum
dissemination and a wider impact of our publications.
The book as a whole is distributed by MDPI under the terms and conditions of the Creative Commons
license CC BY-NC-ND.
Contents
Mauro Mezzini, Jose J. Paulet, Fernando Cuartero, Hernan I. Cruz and Fernando L. Pelayo
On the Amplitude Amplification of Quantum States Corresponding to the Solutions of the
Partition Problem
Reprinted from: Mathematics 2021, 9, 2027, doi:10.3390/math9172027 . . . . . . . . . . . . . . . . 29
v
About the Editors
Fernando L. Pelayo
Fernando L. Pelayo has been an Associate Professor at Universidad de Castilla- La Mancha
and Tutor Professor at UNED since 2000. He has published about sixty research papers, with
one third of them being in JCR journals. He obtained the best university paper award in the IFIP
TC10: International Embedded Systems Symposium (IESS’2005). He has been a Guest Editor
for the Special Issues ”Quantum Computing Algorithms and Computational Complexity” and
“Quantum Computing Algorithms and Quantum Computing Simulators”, both belonging to the
Mathematics and Computer Science sections of the Mathematics Journal. He chaired the First
European Performance Engineering Workshop (EPEW’2004) and the Third and Fourth Workshops
on Formal Methods in the Development of Software (WFMDS’2013–2014). His research interests
include quantum computing, algorithm complexity, formal models of concurrency and discrete
dynamical systems.
Mauro Mezzini
Mauro Mezzini has been an Assistant Professor of Computer Science at the Roma Tre University
since 2012. Previously, he was Adjunct Professor at La Sapienza University (2005–2011) and Project
Manager at Telecom Italia (1990–2012). Some of his works have been published in SIAM Journals on
computing, aCm transaction on information and system security, discrete applied mathematics and
theoretical computer science. He has been a Guest Editor for the Special Issues ”Quantum Computing
Algorithms and Computational Complexity” and “Quantum Computing Algorithms and Quantum
Computing Simulators”, both belonging to the Mathematics and Computer Science sections of the
Mathematics journal. His research interests include quantum computing, machine learning, graph
theory and algorithm, databases and discrete mathematics.
vii
mathematics
Editorial
Preface to the Special Issue on “Quantum Computing
Algorithms and Computational Complexity”
Fernando L. Pelayo 1, *and Mauro Mezzini 2, *
k”, “the most frequent string search problem”, and “searching intersection of two
sequences of strings”.
√ Based on the quantum procedure for comparing two strings of
O( k) queries, they are able to reduce time complexities, thus moving the
length k in √
factor k to k in all its instances as parameters.
Another four papers deal with former quantum algorithms (or part of them) for which
some improvements or different perspectives have been addressed:
• Daniil Rabinovich, Richik Sengupta, Ernesto Campos, Vishwanathan Akshay, and
Jacob Biamonte, in their paper “Progress towards Analytically Optimal Angles in
Quantum Approximate Optimisation”: [3], present proof that the optimal quantum
approximate optimisation algorithm’s (QAOA) parameters for a single layer reduce to
one free variable and that optimal angles can be recovered in the thermodynamic limit.
They also demonstrate that conditions for vanishing gradients of the overlap function
are so similar that reveals a linear relationship between both parameters regardless
the number of qubits.
• Tieyu Zhao, Tianyu Yang, and Yingying Chi, in their paper “Quantum Weighted Frac-
tional Fourier Transform” [4], present a reformulation of the weighted fractional Fourier
transform (WFRFT) and prove its unitarity, thereby proposing a quantum weighted frac-
tional Fourier transform (QWFRFT) which seems to be very usable for signal processing.
• Mauro Mezzini, Jose J. Paulet, Fernando Cuartero, Hernan I. Cruz, and Fernando L.
Pelayo, in their paper “On the Amplitude Amplification of Quantum States Corre-
sponding to the Solutions of the Partition Problem” [5], present a quantum computing
piece of code that increases the amplitude of the states corresponding to the solutions
of the partition problem by a factor of almost two. Unfortunately, this algorithm cannot
be iterated in contrast to the amplitude amplification part of Grover’s algorithm.
• Serena Di Giorgio and Paulo Mateus, in their paper “On the Complexity of Finding
the Maximum Entropy Compatible Quantum State” [6], follow Jaynes’ principle in
order to characterize a compatible density operator with maximum entropy. They
first stated that comparing the entropy of compatible density operators is complete
for the quantum computational complexity class QSZK, even for the simplest case of
three chains. They show that for the case of quantum Markov chains and trees, there
exists a procedure which is polynomial in the number of subsystems that constructs
the maximum entropy compatible density operator. An extension of the Chow–Liu
algorithm to the same subclass of quantum states is also provided.
Finally, there is a paper that researches a classical Operational Research problem by
means of quantum annealing:
• Saul Gonzalez-Bermejo, Guillermo Alonso-Linaje, and Parfait Atchade-Adelomou, in
their paper “GPS: A New TSP Formulation for Its Generalizations Type QUBO” [7],
propose a new Quadratic Unconstrained Binary Optimization (QUBO) formulation of
the Travelling Salesman Problem (TSP) with a smaller number of necessary variables,
together with a thorough study of the constraints and their management. This study
includes a practical test over D-wave quantum annealers platform.
As Guest Editors of this Special Issue, we would like to thank all the authors who
make contributions on these quite conceptually similar fields of research.
We also would like to thank all the reviewers for their big effort in developing so
constructive reports that contribute to improve the quality and quantity of the results
provided within this Special Issue on “Quantum Computing Algorithms and Computa-
tional Complexity”.
We hope that the research papers published in this Special Issue promote more ex-
tensive research and lend further support to quantum computing. We are believers of
the wide and crucial effect that quantum computing can have in our society, from the
domain of energy-efficient computing, through to high-performance computing, up to the
management of many of the most challenging problems which still remain open.
2
Mathematics 2022, 10, 4032
Author Contributions: All authors have contributed equally. All authors have read and agreed to
the published version of the manuscript.
Funding: This research received no external funding.
Conflicts of Interest: The authors declare no conflict of interest.
References
1. Li, Y.; Hao, D.; Xu, Y.; Lai, K. A Fast Quantum Image Component Labeling Algorithm. Mathematics 2022, 10, 2718. [CrossRef]
2. Khadiev, K.; Ilikaev, A.; Vihrovs, J. Quantum Algorithms for Some Strings Problems Based on Quantum String Comparator.
Mathematics 2022, 10, 377. [CrossRef]
3. Rabinovich, D.; Sengupta, R.; Campos, E.; Akshay, V.; Biamonte, J. Progress towards Analytically Optimal Angles in Quantum
Approximate Optimisation. Mathematics 2022, 10, 2601. [CrossRef]
4. Zhao, T.; Yang, T.; Chi, Y. Quantum Weighted Fractional Fourier Transform. Mathematics 2022, 10, 1896. [CrossRef]
5. Mezzini, M.; Paulet, J.J.; Cuartero, F.; Cruz, H.I.; Pelayo, F.L. On the Amplitude Amplification of Quantum States Corresponding
to the Solutions of the Partition Problem. Mathematics 2021, 9, 2027. [CrossRef]
6. Di Giorgio, S.; Mateus, P. On the Complexity of Finding the Maximum Entropy Compatible Quantum State. Mathematics 2021,
9, 193. [CrossRef]
7. Gonzalez-Bermejo, S.; Alonso-Linaje, G.; Atchade-Adelomou, P. GPS: A New TSP Formulation for Its Generalizations Type
QUBO. Mathematics 2022, 10, 416. [CrossRef]
3
mathematics
Article
On the Complexity of Finding the Maximum Entropy
Compatible Quantum State
Serena Di Giorgio 1,2, *,† and Paulo Mateus 1,2,†
1 Departamento de Matemática, Instituto Superior Técnico, Universidade de Lisboa, Av. Rovisco Pais,
1049-001 Lisboa, Portugal; [email protected]
2 Instituto de Telecomunicações, Universidade de Lisboa, Av. Rovisco Pais, 1049-001 Lisboa, Portugal
* Correspondence: [email protected]
† These authors contributed equally to this work.
Abstract: Herein we study the problem of recovering a density operator from a set of compatible
marginals, motivated by limitations of physical observations. Given that the set of compatible density
operators is not singular, we adopt Jaynes’ principle and wish to characterize a compatible density
operator with maximum entropy. We first show that comparing the entropy of compatible density
operators is complete for the quantum computational complexity class QSZK, even for the simplest
case of 3-chains. Then, we focus on the particular case of quantum Markov chains and trees and
establish that for these cases, there exists a procedure polynomial in the number of subsystems that
constructs the maximum entropy compatible density operator. Moreover, we extend the Chow–Liu
algorithm to the same subclass of quantum states.
1. Introduction
Citation: Di Giorgio, S.; Mateus, P. Quantum tomography [1] allows us to associate a unique quantum state over a
On the Complexity of Finding the finite-dimensional Hilbert space provided that multiple copies of the quantum system are
Maximum Entropy Compatible
available, together with a complete set of measurements. Observe that when the degrees
Quantum State. Mathematics 2021, 9,
of freedom increase, the amount of resources for performing the latter grows exponen-
193. https://doi.org/10.3390/math
tially. However, physically relevant phenomena are entirely determined by few-body
9020193
correlations—their Hamiltonians are in general highly local [2]—and when we restrict
ourselves to k-order dependencies, the data collection results in an exponential speed-up in
Received: 15 December 2020
the number of subsystems, leading to efficient tomography techniques [3]. Clearly, a partial
Accepted: 15 January 2021
Published: 19 January 2021
dataset admits many possible compatible density operators. The overlap between (quan-
tum) statistical mechanics and quantum information theory provides a well-established
Publisher’s Note: MDPI stays neutral
tool, entropy maximization, to dealing with the remaining degrees of freedom. By using
with regard to jurisdictional claims in
von Neumann entropy within Jaynes’ principle [4], we define a criterion to estimate density
published maps and institutional affil-
operators, maximally unbiased with regards to the provided partial information.
iations. Problem statement.
A question that naturally arises is the following: is there an efficient and effective
procedure for inferring the aforementioned quantum state? More concretely, is it possible
to find a density operator describing a finite-dimensional multipartite quantum system
that maximizes the von Neumann entropy under the constraints given by its few-body
Copyright: © 2021 by the authors.
Licensee MDPI, Basel, Switzerland.
marginals? In this work, we focus on this problem for the case of direct correlations, that is,
This article is an open access article
2-body marginals.
distributed under the terms and
The problem we address is strictly related to the (quantum) Hamiltonian learning
conditions of the Creative Commons problem [5–7]—every density operator is thermal for a determined Hamiltonian. In general,
Attribution (CC BY) license (https:// the Hamiltonian is given, and one tries to find out its properties, so the problem of its
creativecommons.org/licenses/by/ characterization is not well explored. Recent developments in (quantum) machine learning
4.0/). techniques [8] renewed the interest in the Hamiltonian learning problem. In [9], an effective
neural-networks approach to the problem has been proposed, and an upper bound, which
is polynomial in the number of qudits, has been established for its sample complexity [10].
One of the main reasons for the little background on the problem at hand relies on
the computational hardness of well-known problems that reduce to it. First, the quantum
marginal problem [11,12], that consists of determining whether a set of marginal quantum
states has a global density operator compatible with them, and for which a solution is
known just in some particular cases [13–15]. Then, the classical inference problem of
a probability distribution via graphical models [16] also leads to a maximum entropy
estimation. Density operators naturally encompass classical probability distributions on
the finite-dimensional setup; therefore, when considering direct correlations between
the subsystems, the hardness results for classical graph-inference should be considered.
In particular, the classical problem is well known for being computationally hard [17,18].
The only cases for which a polynomial procedure is known is when the direct correlations
have the structure of a tree (undirected acyclic graph), and moreover, for this case, there
exists an efficient procedure for determining the most likely tree from a general graph—the
Chow–Liu algorithm [19]. The speed-up is due to the Markov condition, which can be
directly inferred from the graphical structure, resulting in the factorization of the maximum
entropy joint probability distribution. Many attempts have been made for developing
appropriate operatorial graphical models [20,21], but none of them naturally encodes
the desired generalization of Markovianity. For obtaining a compression of the learning
procedure, further conditions [22] need to be verified.
In this article, we study the aforementioned problem restricted to a tree-structured set
of marginals density operators and the abstraction of the Chow–Liu algorithm. Namely,
we focus on two questions. First, is the inference efficiency limited to mutually commuting
(and acyclic connected) density operators, which encode classical probability distributions?
Second, can we determine a broader set of density operators for which an extended efficient
procedure is similarly achieved?
Contributions of the paper.
We start by showing that comparing the entropies of 3-chains—quantum states compat-
ible with two given 2-body marginals—is a complete problem for the class QSZK [23–25]—
Quantum Statistical Zero Knowledge. This result hints that finding the maximum entropy
compatible state given two marginals should be not feasible, even for a quantum com-
puter [26], at least by performing an entropy-monotonic step-by-step optimization into the
compatibility space of the provided marginals. Indeed, the complexity class QSZK, originally
defined by J. Watrous in 2002 [25], collects promise problems whose true instances can be
verified by a zero knowledge quantum proof between two quantum entities, generalizing the
class Statistical Zero Knowledge (SZK) to quantum computers. Natural complete problems
for the class represent its hardness, including distinguishing two quantum states (Problem 4)
and determining their quantum entropy difference [27].
Next, we restrict the class of quantum states to make the problem feasible. We con-
sider quantum Markov trees, states for which each 3-subchains form a quantum Markov
chain [28]. In this case, we show that the maximum entropy compatible problem is in P,
and also that there exists a polynomial-time quantum circuit that constructs the maximal
entropy compatible state. Finally, we use this result to extend the Chow–Liu algorithm [19]
for quantum states whose all 3-subchains are quantum Markov chains. The results obtained
in this paper provide a natural extension of prior work [29] to the many-body scenario.
Organization of the paper.
In Section 2, we give some background and state clearly the problems we are address-
ing. In Section 3, we attain the hardness of comparing the entropy of a compatible chain.
In Section 4, we consider the restriction of the maximum entropy problem to quantum
Markov trees. There, we provide the polynomial-time solution for this case, how to con-
struct the solution with a polynomial-quantum circuit, and the generalization of Chow–Liu
algorithm. Some of the proofs are left to the appendices. Finally, we draw some conclusions
and leave some open problems in Section 5.
6
Mathematics 2021, 9, 193
The family C is said to be admissible when Comp(C) = 0, that is, if it admits at least
one density operator whose marginals coincide with those in C .
We start by noticing that, the problem of the admissibility for a compatible set where
all marginal density operators are diagonal for the same basis—that is, density operators
encoding discrete probability distributions—collapses in the classical compatible marginal
problem [30]. This classical problem has been shown to be NP-complete for the three-
dimensional case [31]. There are many cases for which it is solvable [32], and there is
always a solution if we consider only two-body marginals (bipartite marginals) that form
an acyclic graph.
The relevant case where the marginals are not diagonal for the same basis has been the
target of several research works and is called the quantum compatible marginal problem.
Liu showed that this problem is Quantum Merlin Arthur (QMA)-complete, that is, it is
one of the hardest problem in the computational complexity class QMA [12]. The class
Quantum Merlin Arthur (QMA) [33] collects promise problems whose “yes” answer can
be verified by a 1-message quantum interactive proof, generalizing to the quantum realm
the class NP of problems classically verifiable in poly-time.
In some cases, we know that C is admissible, for instance when we are promised that
the marginals ρ J are indeed partial traces of a global state. In Physics, it is reasonable to
assume that we can prepare many copies of a global system, but in general, we can only
partially observe it. In this case, given that we have many copies of the global system,
we would be able to characterize in full detail the partial traces and know that they form
an admissible set. The question now is to infer the global state with maximum entropy
among those in the compatibility set. This leads to the following problem.
Given the general complexity of this problem, we focus on the more straightforward
case where all sets J in I have two indexes. Thus, we consider that we are given a set of
7
Mathematics 2021, 9, 193
compatible two-body marginals, and we want to reconstruct the maximum entropy state
compatible with those marginals. For this two-body case, it is possible to construct an
associated graph, where each two-body marginal denotes an edge.
In the simplest non-trivial case, we have that n = 3 and I = {{1, 2}, {2, 3}}. We call
this case a 3-chain. In the next section, we show that given two density operators ρ0 and ρ1
in the compatible set of a 3-chain, comparing who has higher entropy is QSZK-complete.
We denote the subspaces H1 , H2 and H3 by H A , H B and HC , respectively.
Clearly, 3cQED is a particular case of QED, wherein the latter the Hilbert space of ρ0
and ρ1 does not have to be the same, nor do the densities need to be tripartite.
Obviously, 3cQED is reducible to QED, and therefore it lies in QSZK. It remains to
show that it is QSZK hard. To do so, we adapt the proof of Ben-Aroya et al., and reduce
QSDα,β , natural complete problem for the class QSZK [25], to 3cQED, for 0 ≤ α < β2 ≤ 1.
In Problem 4, ||ρ0 − ρ1 ||tr denotes the trace distance between the operators ρ0 and ρ1 .
Proof of Theorem 1. The idea of the proof is the following. From quantum circuits Q0
and Q1 acting on m bits that generate, respectively, ρ0 and ρ1 fulfilling the promise of
QSDα,β , we are going to construct, in polynomial-time, two quantum circuits Q0 and
8
Mathematics 2021, 9, 193
Q1 that generate tripartite density operators ρ0 and ρ1 , fulfilling the promise of 3cQED,
such that QSDα,β ( Q0 , Q1 ) NO iff 3cQED( Q0 , Q1 ) NO .
Concretely, given circuits Q0 , Q1 , that construct ρ0 and ρ1 , we first apply the polariza-
tion lemma (Lemma A1 in Appendix A) with n = m and obtain circuits R0 and R1 that
output density operators μ0 , μ1 , respectively. We then construct two circuits Z0 and Z1 as
follows. Z1 is implemented by a circuit which first applies a Hadamard gate on a single
qubit b, measures b and then conditioned on the result it applies either R0 or R1 . The output
of Z1 is ξ 1 = 12 |0 0| ⊗ μ0 + 12 |1 1| ⊗ μ1 . Since we need to construct a tripartite system,
we introduce a non-orthodox, but useful, notation ξ 1AC to denote a copy of ξ 1 where the
qubit part of ξ 1 belongs to the system of A and the remaining part belongs to system of
C. Similarly, we denote by ξ 1CA to indicate a copy of ξ 1 where the qubit part belongs to C
and remaining part to A. Circuit Z0 is the same as Z1 except that the qubit b is traced out.
The output of Z0 is ξ 0 = 12 μ0 + 12 μ1 . We shall denote by ξ 0A and ξ 0C a copy of ξ 0 belonging
to the subsystem of A or C, respectively.
Finally, we denote by |φ±
AC
two maximally entangled states between A and C.
Moreover, take ζ = 2 |φ
1 + φ | + 12 |φ− φ− | and note that S(ζ ) = 1. We denote by Q the
+
from both ρ and ρ . So, ρ and ρ have compatible marginals.
Part 1
If ( Q0 , Q1 ) ∈ (QSDα,β ) NO then ( Z0 ⊗ Z0 ⊗ Q, Z1 ⊗ Z1 ) ∈ 3cQED NO .
We know that ρ0 − ρ1 tr ≤ α. By the Polarization lemma (Lemma A1 in Appendix A)
we get μ0 − μ1 tr ≤ 2−m . By the joint-entropy theorem (Lemma A2),
1
S(ξ 1 ) = (S(μ0 ) + S(μ1 )) + 1. (3)
2
On the other hand, ξ 0 is very close both to μ0 and to μ1 . Specifically, ξ 0 − μ1 tr =
1
2 μ0 − 12 μ1 ≤ 2−m . Thus, by Fannes’ inequality (Lemma A3 in Appendix A) |S(ξ 0 ) −
tr
S(μ1 )| ≤ 2−m · poly(m) ≤ 0.1 , for large enough m0 . Similarly, |S(ξ 0 ) − S(μ0 )| ≤ 0.1.
It follows that
1
|S(ξ 0 ) − (S(μ0 ) + S(μ1 ))| ≤ 0.1. (4)
2
Combining the two equations we get S(ξ 1 ) − S(ξ 0 ) ≥ 0.9. Thus, S(ρ ) − S(ρ ) ≥
2 × 0.9 − 1 = 0.8. Therefore, ( Z0 ⊗ Z0 ⊗ Q, Z1 ⊗ Z1 ) ∈ 3cQED NO .
Part 2
If ( Q0 , Q1 ) ∈ (QSDα,β )YES then ( Z0 ⊗ Z0 ⊗ Q, Z1 ⊗ Z1 ) ∈ 3cQEDYES .
By the Polarization lemma (Lemma A1 in Appendix A) μ0 − μ1 tr ≥ 1 − 2−m .
Using Lemma A5 (in Appendix A), we get that S(ξ 0 ) ≥ 12 [S(μ0 ) + S(μ1 )] + 1 − H ( 12 +
μ0 − μ1
2
tr
) ≥ 12 [S(μ0 ) + S(μ1 )] + 1 − H (2−m0 ). By Lemma A2 (in Appendix A) we know
that S(ξ 1 ) = 12 (S(μ0 ) + S(μ1 )) + 1. Therefore, S(ξ 1 ) − S(ξ 0 ) = H (2−m ) < 0.1 for suffi-
ciently large m.
9
Mathematics 2021, 9, 193
Definition 2 ([36]). A quantum Markov chain (QMC) is a 3-chain A − B − C for which there
exists a recovery map R B→ BC : B(H B ) → B(H BC ), i.e., an arbitrary trace-preserving completely
positive (CPTP) map (see, for instance, [37,38]), s.t. ρ ABC = (I A ⊗ R B→ BC )(ρ AB ), where I A
denotes the identity map on B(H A ).
10
Mathematics 2021, 9, 193
(n)
Definition 3. A family of QMC’s {ρ ABC }n∈N is said to be constructed in polynomial time if all
(n)
elements ρ ABC rely in the same (finite) Hilbert space H A ⊗ H B ⊗ HC (that does not depend on n)
(n) (n)
and there is polynomial-time family of quantum circuits that generate both ρ AB and R B→ BC .
Given that the dimension of (a polynomial-time) quantum Markov chain does not
grow with n, it can be represented in matrix form in polynomial-time by multiplying all
(n) (n)
the gates involved in the circuits that generate ρ AB and R B→ BC . We stress that to design
circuits for density operators and CPTP maps we require only an ancilla space of the same
dimension of the support of these operators/maps [39]. Therefore, the number of gates
is polynomial in n, but the full dimension of the space (including ancillae) does not grow
with n.
From this point on, we assume that ρ ABC is invertible (on its support), as invertible
density operators are dense. To derive the main result of the paper, we need to establish
a central lemma listing some known characterizations of QMCs. We give the proof in
Appendix B.
Lemma 1. Let ρ ABC be an invertible density operator. The following four assertions are equivalent:
1. ρ ABC is a QMC over the chain A − B − C.
2. Iρ ( A : C | B) = 0, where Iρ ( A : C | B) := S(ρ AB ) + S(ρ BC ) − S(ρ B ) − S(ρ ABC ).
1 −1 −1 1
3. P B→ BC ( X ) := ρ BC
2
((ρ B 2 Xρ B 2 ) ⊗ idC )ρ BC
2
, is a CPTP map for any X ∈ B(H B ) and pre-
serves the partial trace ρ AB .
4. log ρ ABC − (log ρ AB ) ⊗ idC = id A ⊗ (log ρ BC ) − id A ⊗ (log ρ B ) ⊗ idC .
The map P B→ BC ( X ) is known as Petz recovery map or transpose map. Again, to ease
notation, we drop the identities whenever they are obvious, for instance, we drop them
1 −1 −1 1 1 −1 −1 1
in the expressions ρ BC2
((ρ B 2 Xρ B 2 ) ⊗ idC )ρ BC
2
to just ρ BC
2
ρ B 2 Xρ B 2 ρ BC
2
, and the same for
log ρ ABC − (log ρ AB ) ⊗ idC , which we write just log ρ ABC − log ρ AB .
Observe that we can also recover a tripartite density operator from ρ BC
through P B→ AB (·):
1 −1 −1 1
ρ AB
2
ρ B 2 ρ BC ρ B 2 ρ AB
2
, (5)
and by uniqueness, since the von Neumann entropy is operator-concave [40,41], we have
P B→ BC (ρ AB ) = P B→ AB (ρ BC ). However, it is not known whether, given a family of QMC
(n) (n)
that can be constructed in polynomial time via P B→ BC ( X ), it is possible to build P B→ AB ( X )
in polynomial-time. The next result states that solution to MECMP (Problem 2) and also
QCMP (Problem 1), for 3-chains can be fully determined when a QMC belongs to the
compatibility set, the proofs can be found in [29].
Lemma 2. Given a 3-chain {ρ AB , ρ BC } compatible with a QMC, say ρ ABC , then the solution of the
maximum entropy estimator ρ ABC is precisely ρ ABC . Moreover, the 3-chain {ρ AB , ρ BC } is compati-
1 −1 1
ble with a QMC in B(H ABC ) iff Tr A (ρ AB ) = TrC (ρ BC ) and the operator Θ ABC = ρ BC
2
ρ B 2 ρ AB
2
is normal. Moreover, if two marginals {ρ AB , ρ BC } are compatible with a QMC on B(H ABC ),
say ρ ABC , then the operator Θ ABC is its square root.
11
Mathematics 2021, 9, 193
Proposition 1. If GC is a tree, than all the subgraphs Gk are trees, and moreover, Xk is a leaf of Gk .
We now define a quantum Markov tree, which, as we shall see later on, generalizes
the notion of Markov random field, when the underlying graph is a tree.
1 −1
with Δk = ρ X2 idXk ⊗ ρY 2 ⊗ id{X , for all k = 3 . . . n.
k Yk k k Yk }
We note that for Equation (6) to be well defined, it must be the case that GC is a tree,
that is, that we are working under Assumption 1. It is relatively simple to extend the notion
to acyclic graphs (which may not be connected).
Theorem 2. Let ρ ∈ B(HX ) be an invertible density operator over (its support) and C is a (non-
trivial) set of two-body marginals s.t. GC is a spanning tree over X, then there exists ρ ∈ Comp(C)
factorizable via Petz according to C iff there exists ρ ∈ B(HX ) such that, equivalently, one of the
following two hold:
(i) log ρ = ∑C log ρ Xi X j − ∑in=1 (deg( Xi ) − 1) log ρ Xi ;
(ii) we have
∀k = 2, . . . , n : ρk = TrV [ρ] is s.t. Iρk Xk : Yk |Yk = 0
k
(7)
for some constructive ordering X1 < · · · < Xn .
Proof of Theorem 2. The proof follows by induction on k, that is, by adding one edge per
node following a constructive ordering in C . Therefore, we have that
C = ρ Xk Yk ∈ B H Xk Yk : Yk ∈ { X1 , . . . , Xk−1 }; k = 2, . . . , n , (8)
(Basis k = 3): The first chain occurs when the third node is added, that is, when k = 3.
Assume there exists ρ3 ∈ Comp(C3 ) that is factorizable via Petz, i.e.,
1 1 −1 1 1 −1 1
Θ3 = ρ32 = ρ X2 3 Y3 ρY32 ρ 2 = ρ X2 3 Y3 ρY32 ρ X2 1 X2 . (9)
Y3 Y3
12
Mathematics 2021, 9, 193
Observe that we can use Lemma 2 and so, Θ3 is exactly the operator described in the
lemma, and since it is a square root,
it is normal.
Then, by Lemma 1, we have the following
equivalences: ρ3 is a QMC iff Iρ3 X3 : Y3 |Y3 = 0 iff log ρ3 = log ρ X3 Y3 + log ρ X1 X2 − log ρY3 .
The other direction follows immediately.
(Induction step k −→ k + 1):
Complete induction hypothesis: ∀ j = 3, . . . , k ∃ ρ j ∈ Comp C j factorizable via Petz
according with C j iff there exists ρ j ∈ B HVj such that, equivalently, one of the following
two hold:
j
• log ρ j = ∑C j log ρ Xi Xt − ∑i=1 (degG j ( Xi ) − 1) log ρ Xi ;
• Iρ j X j : Yj |Yj = 0.
Induction step: Assume there ∃ ρk+1 ∈ Comp(Ck+1 ) factorizable via Petz according
with Ck+1 , then, our goal is to show that the following holds for ρk+1 :
• log ρk+1 = ∑Ck+1 log ρ Xi Xt − ∑ik=+11 (degGk ( Xi ) − 1) log ρ Xi and ,
• Iρk+1 Xk+1 : Yk+1 |Yk+1 = 0.
Therefore, assume ∃ρk+1 ∈ Comp(Ck+1 ) factorizable via Petz, i.e.,
1 1 1 −1
Θk+1 = ρk2+1 = Δk+1 Δk . . . Δ3 ρ X2 1 X2 where Δi := ρ X2 Y ρY 2 . (10)
i i i
Then:
We can use Lemma 2 on the set { ρ Xk+1 Yk+1 , ρk } and conclude that ρk+1 is a QMC
order Xk+1 − Yk+1 − Yk+1 . Therefore, using Lemma 1, we have ρk+1 is a QMC iff
in the
Iρk+1 Xk+1 : Yk+1 |Yk+1 = 0 iff
The other direction is straightforward. Just notice that TrXk+1 (ρk+1 ) = ρk , and by
induction hypothesis ρk is compatible with Ck , and so is ρk+1 . Moreover, by construction of
ρk+1 it is also compatible with Ck+1 .
Note that the proof of the previous theorem does not depend on which construc-
tive ordering one chooses. This follows from the fact that condition (i) is equivalent to
condition (ii), and condition (i) does not assume any ordering.
The reader conversant in Markov random fields will identify condition (ii) as the
quantum analogue of the Local Markov Property of a Markov random field—any variable Xi
is conditionally independent of the remaining nodes given its adjacent nodes:
13
Mathematics 2021, 9, 193
where AdXi is the set of adjacent nodes to Xi . The notion of conditional independence is
equivalently replaced by the conditional mutual information being null, that is
which, for the case of the tree Gk and for the node Xk , we have
I ( Xk : Yk | Yk ) = 0. (15)
The following results state how to compute the solution Maximum Entropy Compati-
ble Marginal Problem when GC is a tree and there exists ρ ∈ Comp(C) that factorizes via
Petz according to C .
Corollary 1. Let ρ ∈ B(H) factorize via Petz according to C and GC a spanning tree. Then,
Proof of Corollary 1. It follows that in the case ρ ∈ B(H) factorizes via Petz according to
C , we have log ρ = ∑C log ρ Xi Xj − ∑in=1 (deg( Xi ) − 1) log ρ Xi , which saturates the subad-
ditivity of the von Neumann entropy for every 3-chain Yk − Yk − Xk , k = 3, . . . , n in the
spanning tree.
Iρ ( Xk : ad Yk | Yk ) = 0, ∀ ad Yk ∈ Vk−1 , k = 3, . . . , n. (19)
14
Mathematics 2021, 9, 193
(⇐) The proof follows again by complete induction in the number of nodes k, follow-
ing the assumed constructive ordering of C . Again, the simplest tree where the equation
has any meaning requires three nodes.
(Basis k = 3): for this case the statement of this theorem coincides with (ii) of
Theorem 2, since ad Y3 = Y3 .
(Induction step k −→ k + 1):
Induction hypothesis: We assume
Iρ ( Xk : ad Yk | Yk ) = 0, ∀ ad Yk ∈ Vk−1 , k = 3, . . . , n, (21)
and so, by hypothesis, ρ is factorizable via Petz according to C , and so, by Theorem 2,
we have
Iρ X : Y |Y = 0 ∀ = 3, . . . k. (22)
Induction step: We assume Iρ ( Xk+1 : adYk+1 |Yk+1 ) = 0 ∀ ad Yk+1 ∈ Vk and our goal is
to show that there exists ρk+1 factorizable via Petz according to Ck+1 such that its partial
traces hold
Iρk+1 Xk+1 : Yk+1 |Yk+1 = 0. (23)
Observe that, by definition, Yk+1 ∈ Vk , let mk+1 be some step in which Yk+1 was
connected to some node (note that it might connect to some node in many steps). Clearly,
we have 3 ≤ mk+1 ≤ k. We consider two cases, depending on the degree of Yk+1 in Gk .
Case (1) degYk+1 = 1, then by construction, it must be that Yk+1 = Xmk and by
Equation (22) we have that for ρmk its partial traces hold
Iρmk Xmk : Ymk |Ymk = 0. (24)
where the last equality is obtained by noticing that Xmk = Yk+1 and Ymk = adYk+1 .
Recall that we have,
Iρ ( Xk+1 : ad Yk+1 |Yk+1 ) = 0. (27)
Moreover, the set {Vk \{Yk+1 , adYk+1 }, ad Yk+1 , Yk+1 , Xk+1 }, forms the chain
by using Lemma A6 (a) (in Appendix C), there exists a density operator ρk+1 ∈
Then,
B HVk+1 such that its partial traces fulfill
Iρ ( Xi : Vi \{ Xi , Yi }|Yi ) = 0 ∀i : 2 ≤ i ≤ k + 1. (30)
(Case 2) degYk+1 > 1, then Gk+1 can be seen as a star centered in Yk+1 , with as many
branches, as many as adjacent nodes (adYk+1 )i in Gk+1 , whose number is precisely the
degree rk of Yk+1 in Gk , plus the new added node Xk+1 (c.f. Figure 1).
15
Mathematics 2021, 9, 193
Figure 1. The associate graph Gk+1 : can be seen as a star centered in Yk+1 , where every branch is
an adjacent of Yk+1 in Vk , plus the link to Xk+1 . Gi indicates the rest of the graph (a tree) that is
connected to the i-th adjacent (adYk+1 )i . The number of adjacent nodes to Yk+1 in Gk+1 is rk + 1 by
adding Xk+1 to other rk nodes in Gk .
We proceed to show Equation (32) by using Corollary A2 (in Appendix C). Indeed,
this results guarantees that the star
iff
Using Theorem 2 in Equation (37), we get the goal, stated in Equation (32). The condi-
tions in Equation (38) come from the complete induction hypothesis Equation (34). On the
other hand, the conditions stated in Equation (37), come from observing that, for every
(adYk+1 )i , there is a chain
16
Mathematics 2021, 9, 193
Equation (40) follows from induction hypothesis Equation (33). Moreover, Equation (41)
follows from the fact that, by hypothesis, ρk is a QMT, and so
is a quantum Markov chain. Therefore, by using Lemma A6 (a) (in Appendix C), we get
the desired condition
Iρ ( Xk+1 : (adYk+1 )i ∪ Gi | Yk+1 ) = 0. (43)
Since the argument holds for all the adjacent nodes (adYk+1 )i , we derive the whole
set of conditions (37), which ends the proof for case (2).
Finally, the fact that the obtained state maximizes the von Neumann entropy with the
provided marginals comes for free from Corollary 1.
We are now able to establish a sufficient condition for the MECMP problem to be in P.
Proof of Theorem 4. From Theorem 3, the density operator that maximizes the Entropy
is a QMT. Moreover, we can compute its entropy in polynomial time, by considering the
constructive ordering of point 2. Indeed, from Theorem 2 (i), when ρ is a QMT we have that
n
S(ρ) = ∑ S(ρXi Xj ) − ∑ (deg(Xi ) − 1)S(ρXi ). (44)
C i =1
17
Mathematics 2021, 9, 193
Figure 2. Quantum circuit that outputs the optimal quantum Markov trees (QMT). Note that the k-th
block IYk ⊗ RYk Xk operates only over two components Xk and Yk , for all k = 3 . . . n.
Theorem 5. If the set of two body marginals C is s.t. every 3-chain is compatible with a QMC
then every subtree is a QMT. A QMT that minimizes the quantum relative entropy with respect to
the (unknown) given quantum state, is the maximum weighted tree G TC where the weight of each
edge is given by the quantum mutual information. Such tree can be obtained efficiently using the
(generalized) Chow–Liu learning algorithm [19].
18
Mathematics 2021, 9, 193
Proof of Theorem 5. The proof consists in applying Theorem 3 to the main result of
Section 6 in the paper [29], that we are going to briefly recall.
Let ρX be the unknown quantum state that describes best the quantum system for
which the bipartite marginals are known (for instance, they have been measured and
collected in C ). Moreover, let ρCT be the maximum von Neumann entropy d.o. compatible
with a subset C T ⊆ C s.t. GCT is a tree. We refer to ρCT as quantum tree. Their relative
entropy can be written as
S ρX ||ρCT = −S(ρX ) − Tr ρX log ρCT = S ρCT − S(ρX ), (45)
Since the number of possible spanning trees is nn−2 [43], we can not choose the
best fitting tree efficiently, in general. However, in the case at hand, we can manipulate
Equation (45) and derive subcases for which the computation can be performed efficiently.
Observe that
n n
∑S ρ Xi X j − ∑ (degXi − 1)S ρ Xi = − ∑ Iρ ( Xi , X j ) + ∑ S ρ Xi , (47)
CT i =1 CT i =1
and set
n
ΔS(ρCT ) := ∑S ρ Xi X j − ∑ (degXi − 1)S ρ Xi − S(ρCT ), (48)
CT i =1
n
S ρX ||ρCT = − ∑ Iρ ( Xi , X j ) − ΔS(ρCT ) + ∑ S ρ Xi − S(ρX ). (50)
CT i =1
By using condition (i) of Theorem 2, we can replace the log term of S ρCT of
Equation (48) and thus, for a QMT, ΔS(ρC ) = 0. Moreover, we also have the converse,
that is, ΔS(ρC ) = 0 holds only for QMTs. The latter result can be derived by observing that
n −2
ΔS(ρCT ) = ∑ Iρ ( Xli : Vi \{ Xli , adXli }|adXli ), (51)
i =1
which, by positivity of quantum conditional mutual information, is 0 iff all the terms in the
sum are 0. Then, by Theorem 3, we have ΔS(ρC ) = 0 iff all the 3-chains in C T are QMC.
Therefore, when the provided set of marginals C is s.t. every 3-chain is compatible
with a QMC, ΔS(ρC ) = 0 in Equation (50). Therefore, the best tree is the one that maximizes
the term
∑ Iρ (Xi , Xj ), (52)
CT
i.e., the maximum weighted spanning sub-tree, where the weights are given by the mutual
information between every couple of linked nodes.
19
Mathematics 2021, 9, 193
This problem is efficiently solved for classical graphs by the Chow–Liu algorithm,
which we have here generalized to quantum states, be replacing the Shannon entropy with
the von Neumann entropy.
The general case of efficiently finding the optimal spanning tree which gives the
support to a quantum tree remains open. Minimizing the general form of Equation (50)
would require the maximization of the quantity ∑CT Iρ ( Xi , X j ) + ΔS(ρCT ) with S(ρCT ) > 0.
Already in the tripartite scenario, it is evident that the maximum weighted tree is not a
necessarily solution to the problem.
For the sake of completeness, we present the Chow–Liu algorithm in pseudo-code.
In its quantum version, the Shannon entropy is replaced by the von Neumann entropy,
so as the relative entropy with the quantum relative entropy.
5. Conclusions
In this paper, we addressed the problem of learning the maximum entropy density
operator, describing an unknown quantum system on a finite-dimensional Hilbert space,
from a set of two-body marginals.
First, we have shown that comparing the entropies of 3-chains—the simplest non-
trivial scenario, where two marginals are known in a tripartite quantum system—is QSZK-
complete. The result hints that finding the maximum entropy compatible state should be
in general not feasible, with a step by step entropy-monotonic procedure.
Then, we determined a subclass of density operators where the addressed problem is
in P. Concretely, by observing that the problem at hand naturally abstracts the inference
problem for classical probability distribution within graphical models, we ask whether an
exact efficient max-entropy learning procedure is limited to classical Markovian systems—
the set of constraints is a tree-structured set of mutually commuting density operators.
We generalize and extend the classical procedure to a larger subset of density operators,
namely two-body marginals compatible with a quantum Markov tree (QMT), whose 3-
chains are polynomial-time quantum Markov chains. In addition, for a general set of
quantum states whose 3-subchains are quantum Markov chains, we were able to generalize
the Chow–Liu algorithm for extracting the optimal QMT. Moreover, we showed that, in the
case at hand, the maximum entropy quantum state could be constructed by a polynomial-
time quantum circuit.
We stress that the obtained procedures overcome the quantum marginal problem,
for which a solution is known in the case of compatibility of the provided set of marginals
with a QMT.
Understanding other classes of quantum states for which this problem is tractable
(at least in quantum polynomial time) would be a relevant problem. In particular, a further
study on the robustness of the procedure can shed some light on the power of quantum ma-
chine learning techniques on solving the same problem beyond the Markovian assumption.
Indeed, differently from the classical scenario, quantum Markov chains have been proven
to be in general distant in trace distance from approximately-Markovian chains—that is,
tripartite density operators ρ ABC s.t. Iρ ( A : B|C ) , > 0—and the result naturally
extends to QMT and many body density operators.
20
Mathematics 2021, 9, 193
Author Contributions: Conceptualization, S.D.G. and P.M.; Formal analysis, S.D.G.; Funding ac-
quisition, P.M.; Investigation, S.D.G. and P.M.; Methodology, S.D.G. and P.M.; Supervision, P.M.;
Writing—original draft, P.M.; Writing—review & editing, S.D.G. and P.M. All authors have read and
agreed to the published version of the manuscript.
Funding: This work is supported by Security and Quantum Information Group of Instituto de
Telecomunicações, by Programme (COMPETE 2020) of the Portugal 2020 framework [Project Q.DOT
with Nr. 039728 (POCI-01-0247-FEDER-039728)] and the Fundação para a Ciência e a Tecnologia
(FCT) through national funds, by FEDER, COMPETE 2020, and by Regional Operational Program of
Lisbon, under UIDB/50008/2020 (actions QuRUNNER, QUESTS), Project QuantumMining POCI-01-
0145-FEDER-031826 and Project PREDICT PTDC/CCI-CIF/29877/2017.
Conflicts of Interest: The authors declare no conflict of interest.
Abbreviations
The following abbreviations are used in this manuscript:
ρ0 − ρ1 tr ≤α ⇒ μ0 − μ1 tr ≤ 2− n ,
ρ0 − ρ1 tr ≥β ⇒ μ0 − μ1 tr ≥ 1 − 2− n .
Lemma A2 (Joint entropy theorem [38]). Suppose pi are probabilities, |i are orthogonal states
for a system A and ρi is any set of density operators for another system B. Then,
S ∑ pi |i i | ⊗ ρi = H ( p i ) + ∑ p i S ( ρ i ). (A1)
i i
Lemma A3 (Fannes’ inequality [38]). Suppose ρ and σ are density matrices over a Hilbert space
of dimension d. Suppose further that the trace distance between them satisfies t = ρ − σ tr ≤
1/e. Then,
|S(ρ) − S(σ)| ≤ t(ln d − ln t). (A2)
21
Mathematics 2021, 9, 193
Lemma A4 (Lemma 3.2 in [44]). Let ρ0 and ρ1 be two density matrices, and let ρ = 12 (ρ0 + ρ1 ).
If there exists a measurement with outcome 0 or 1 such that making the measurement on ρb yields
the bit b with probability at least p, then
1
S(ρ) ≥ [S(ρ0 ) + S(ρ1 )] + (1 − H ( p)). (A3)
2
Lemma A5 (Theorem 1 in [25]). Let ρ0 and ρ1 be two density matrices, and let ρ = 12 (ρ0 + ρ1 ).
Then,
1 1 ρ0 − ρ1 tr
S(ρ) ≥ [S(ρ0 ) + S(ρ1 )] + (1 − H ( + )). (A4)
2 2 2
Definition A1. Let H be a finite dimensional Hilbert space and ρi ∈ B(H), i = 1,2, density
operators. Their relative entropy is defined as:
Trρ1 (log ρ1 − log ρ2 ) if supp(ρ1 ) ⊆ supp(ρ2 )
S ( ρ1 ρ2 ) : = (A5)
+∞ otherwise.
Theorem A1. Let H and K be finite dimensional Hilbert spaces, ρi ∈ B(H), i = 1,2, density
operators with supp(ρ1 ) ⊆ supp(ρ2 ). For a CPTP map Φ : B(H) → B(K) the following
inequality holds:
S(ρ1 ρ2 ) ≥ S(Φ(ρ1 ) Φ(ρ2 )). (A6)
Proof of Corollary A1. Observe that setting in (A6) ρ1 → ρ ABC , ρ2 → ρ AB ⊗ idC /dC
and φ(·) → Tr A [·], we obtain which is equivalent to the non-negativity of the quantum
conditional mutual information Iρ ( A : C | B) ≥ 0.
The following two theorems characterize the case of the equality and they will be the
core of the proof of Lemma 1.
Theorem A2 (Theorem 2 in [47]). Let Φ : B(H) → B(K) be a CPTP map and let ρi ∈ B(H),
i = 1,2, and φ(ρi ) ∈ B(K) be all invertible density operators. Then, the equality holds in the
Uhlmann theorem iff the following equivalent conditions hold:
(i) φ† φ(ρ2 )it φ(ρ1 )−it = ρ2it ρ1−it t ∈ R;
(ii) φ† (log φ(ρ1 ) − log φ(ρ2 )) = log ρ1 − log ρ2 ;
where (ii ) is obtained differentiating (i ) in t = 0.
The adjoint map φ† (·) is understood with respect to the Hilbert–Schmidt inner product.
22
Mathematics 2021, 9, 193
Theorem A3 (Theorem 5.2 in [35]). A tripartite state ρ ABC ∈ B(H ABC ) is a QMC in the order
A-B-C iff Iρ ( A : C | B) = 0. Furthermore, one can always choose as recovery map the rotated
Petz map:
1+it
1−it
− 1+it − 1−it
P Bt → BC ( X ) := ρ BC2 ρ B 2 Xρ B 2 ⊗ idC ρ BC2 , for any X ∈ B(H B ), t ∈ R. (A8)
Lemma A6. Let X = { A, B, C, D } be the labeling of parts of a finite dimensional Hilbert space
H and C = {ρ XY ∈ B(H XY ), X, Y ∈ X} an admissible set of two-body marginals. Assume
ρ AB , ρ BC ∈ C and ∃ ρ̃ ABC ∈ B(H ABC ) : ρ̃ ABC ∈ Comp(ρ AB , ρ BC ) such that
Iρ ( A : C | B) = 0. (A9)
A C D
then
∃ ρ̃ ∈ B(H) : ρ̃ ∈ Comp(C) s.t Iρ ( A : CD | B) = 0 iff (A12)
(i) ∃ ρ̃CBD ∈ Comp(ρ BC , ρ BD ), ρ̃ BCD ∈ B(H BCD ) s.t. Iρ (C : D | B) = 0 and
(ii) ∃ ρ̃ ABD ∈ Comp(ρ AB , ρ BD ), ρ̃ ABD ∈ B(H ABD ) s.t. Iρ ( A : D | B) = 0.
In both the cases, ρ̃ = arg max S(ρ) and factorizes over the elements of C via Petz following a
ρ∈Comp(C)
constructive ordering for C .
Proof of Lemma A6. We prove cases (a) and (b) together, but each direction of the equiva-
lence at a time. We notice than one direction follows easily from the chain rule, we start
with that direction (⇐) Recall the chain rule for quantum conditional mutual information:
Iρ ( A : X1 , . . . , Xn | B) = Iρ ( A : X1 | B)+ Iρ ( A : X2 | BX1 )+
(A13)
+ · · · + Iρ ( A : Xn | BX1 , . . . , Xn−1 )
23
Mathematics 2021, 9, 193
Case (a)
Iρ ( AB : D |C ) = Iρ ( B : D |C ) + Iρ ( B : D | AC ) = 0 ⇒ Iρ ( B : D |C ) = 0 (A14)
Iρ ( AC : D | B) = Iρ ( A : D | B) + Iρ ( A : D | BC ) = 0 ⇒ Iρ ( A : D | B) = 0
(A15)
Iρ ( AC : D | B) = Iρ (C : D | B) + Iρ (C : D | AB) = 0 ⇒ Iρ (C : D | B) = 0
(⇒) (a) To prove the other direction of the statement, we show that there exists a
ρ̃ ∈ B(H): ρ̃ ∈ Comp(ρ̃ ABC , ρ̃ BCD ) and QMC on the order AB-C-D.
By hypothesis and using Lemma 1, the tripartite states can be recovered from two of
its two-body marginals using the Petz recovery map:
1 −1 −1 1 1 −1 −1 1
Iρ ( A : C | B) = 0 iff ρ̃ ABC = ρ BC
2
ρ B 2 ρ AB ρ B 2 ρ BC
2
= ρ AB
2
ρ B 2 ρ BC ρ B 2 ρ AB
2
, (A16)
1 −1 −1 1 1 −1 −1 1
Iρ ( B : D |C ) = 0 iff ρ̃ BCD = ρ BC
2
ρC 2 ρCD ρC 2 ρ BC
2
= ρCD
2
ρC 2 ρ BC ρC 2 ρCD
2
. (A17)
Using Lemma 2, we check the compatibility of the two marginals with the desired
1 −1 1
QMC showing that the operator Θ ABCD := ρ̃ ABC
2
ρC 2 ρCD
2
is normal:
1 −1 −1 1
Θ ABCD Θ†ABCD = ρ̃ ABC
2
ρC 2 ρCD ρC 2 ρ̃ ABC
2
(A18)
1 −1 1 −1 −1 1 −1 1
= ρ AB
2
ρ B 2 ρ BC
2
ρC 2 ρCD ρC 2 ρ BC
2
ρ 2 ρ2 (A19)
B AB
ρ̃ BCD
1 − 12 1 − 12 −1 1 −1 1
= ρ AB ρ B ρCD ρC ρ BC ρC 2 ρCD
2 2 2
ρ 2 ρ2 (A20)
B AB
1 −1 1 −1 −1 1 −1 1
= ρCD
2
ρC 2 ρ AB
2
ρ B 2 ρ BC ρ B 2 ρ AB
2
ρ 2 ρ2 (A21)
C CD
ρ̃ ABC
Equality in Equation (A19) follows for Equation (A16) and Lemma 2. Equality in
Equation (A20) follows from permuting density operators in different Hilbert spaces.
(b) Similarly to (a), we show that there exists a ρ̃ ∈ B(H): ρ̃ ∈ Comp(ρ̃ ABC , ρ̃CBD , ρ̃ ABD )
and QMC on the order AC-B-D. Again, using Lemma 1, the tripartite states can be recovered
from two of its two-body marginals using the Petz recovery map:
1 −1 −1 1 1 −1 −1 1
Iρ ( A : C | B) = 0 iff ρ̃ ABC = ρ BC
2
ρ B 2 ρ AB ρ B 2 ρ BC
2
= ρ AB
2
ρ B 2 ρ BC ρ B 2 ρ AB
2
, (A23)
1 −1 −1 1 1 −1 −1 1
Iρ (C : D | B) = 0 iff ρ̃CBD = ρ BC
2
ρ B 2 ρ BD ρ B 2 ρ BC
2
= ρ BC
2
ρ B 2 ρ BD ρ B 2 ρ BC
2
, (A24)
1 −1 −1 1 1 −1 −1 1
Iρ ( A : D | B) = 0 iff ρ̃ ABD = ρ AB
2
ρ B 2 ρ BD ρ B 2 ρ AB
2
= ρ AB
2
ρ B 2 ρ BD ρ B 2 ρ AB
2
. (A25)
24
Mathematics 2021, 9, 193
First, by using Lemma 2, we check the compatibility of the two marginals ρ BD and
1 −1 1
ρ ABC with the desired QMC showing that the operator Θ ABCD := ρ̃ ABC
2
ρ B 2 ρ BD
2
is normal:
1 −1 −1 1
Θ ABCD Θ†ABCD = ρ̃ ABC
2
ρ B 2 ρ BD ρ B 2 ρ̃ ABC
2
(A26)
1 −1 1 −1 −1 1 −1 1
= ρ AB
2
ρ B 2 ρ BC
2
ρ B 2 ρ BD ρ B 2 ρ BC
2
ρ 2 ρ2 (A27)
B AB
ρ̃ BCD
1 −1 1 −1 −1 1 −1 1
= ρ AB
2
ρ B 2 ρ BD
2
ρ 2 ρ BC ρ B 2 ρ BD
2
ρ B 2 ρ AB
2
(A28)
B
ρ̃ ABD ρ̃ ABD
1 − 12 1 − 12 − 12 1 −1 1
= ρ BD ρ B ρ AB ρ B ρ BC ρ B ρ AB ρ B 2 ρ BD
2 2 2 2
(A29)
ρ̃ ABC
Moreover, the QMC ρ̃ = Θ ABCD Θ†ABCD is in Comp(ρ̃ ABC , ρ̃CBD , ρ̃ ABD ) by using
Equations (A23)–(A25).
The previous lemma can be trivially extended to the n-partite scenario, i.e., to an
arbitrary chain and a star:
Corollary A2. Let X = { X1 , . . . Xn } be the labeling set of the parts of a finite dimensional Hilbert
space H and C = {ρ XY ∈ B(H XY ), X, Y ∈ X} a set of two-body marginals on it classically
compatible. Assume GC is a star centered in some Y ∈ X, i.e., C = {ρ Xi Y , i = 1, . . . , n − 1} then
there exists ρ̃ ∈ B(H) : ρ̃ ∈ Comp(C) such that ρ̃ is a quantum Markov network iff
Iρ Xi : X j |Y = 0 ∀i = j ∈ 1, . . . , n − 1. (A31)
Moreover,
ρ̃ = arg max S(ρ) (A32)
ρ∈Comp(C)
and factorizes over the elements of C via Petz following a constructive ordering for C .
Proof of Corollary A2. The proof follows by adding at each step a node to the setting
of Lemma A6 (case b). Shortly, consider the constructive ordering for the graph X =
{Y, X1 , . . . , Xn }. Start from graph G3 , where V3 ≡ Y, X1 , X2 , X3 , clearly in this case we are
in the situation of Lemma A6 (b), then:
Iρ ( X2 : X1 |Y ) = 0 Iρ ( X3 : X1 |Y ) = 0 ⇔ Iρ ( X3 : X1 X2 |Y ) = 0. (A33)
Iρ ( X4 : X1 X2 X3 |Y ) = 0 iff
(A34)
Iρ ( X3 : X1 X2 |Y ) = 0 and Iρ ( X4 : X1 X2 |Y ) = 0.
where the first condition is the one we got in the previous step, the second comes from
Lemma A6 (b):
Iρ ( X4 : X1 X2 |Y ) = 0 iff
(A35)
Iρ ( X4 : X1 |Y ) = 0 and Iρ ( X4 : X2 |Y ) = 0.
25
Mathematics 2021, 9, 193
Then, we keep adding nodes and decomposing the next required condition by
Theorem 2. We notice that at each step, i.e., every time we add a node, in order to have a
Petz decomposable d.o. on the new graph we have to add to the previous set of 3-chains,
all the new 3-chains, i.e., the ones that involve the last added node.
Lemma A7. Let ρ ∈ B(H), where X = { X1 , . . . , Xn } and H = in=1 H Xi , such that ρ ∈
Comp(C) with GC a tree (i.e., we work under Assumption 1, and take X1 < · · · < Xn the
constructive order). If for some ≤ n the following conditions hold
Iρ j Xi : Yj | Yj = 0, ∀ j = 3, . . . , , (A36)
degXi |Gi = degXi |Gm and degYi |Gi = degYi |Gm , (A37)
i i
Proof of Lemma A7. Take that Equation (A36) with j = ρri . By Theorem 2, we know that
ρri factorizes via Petz over its two-body marginals according to Cri . Then, set
1 −1
Δk := ρ X2 ρY 2 , (A39)
k Yk k
ρ r i = Δ r i Δ r i − 1 . . . Δ i . . . . . . ρ X1 X2 . . . Δ i . . . Δ r i − 1 Δ r i , (A40)
where, in general, [Δi , Δ j ] = 0. Note that, from the definition of mi it must be the case
that [Δri , Δs ] = 0 ∀s : i ≤ s ≤ ri . This follows since Equation (A37) imposes that no more
nodes are connected to Xi and Yi when adding nodes from step i to mi ; and therefore,
the additional Δk ’s operate on different Hilbert spaces. Then, Equation (A40) is to be
written as:
ρ k = Δ i . . . Δ r i . . . ρ X1 X2 . . . Δ r i . . . Δ i . (A41)
Now consider a new, but equivalent, constructive ordering <
obtained from the order < by exchanging ri with i. By using Theorem 2 (ii) with the order
< , we get in Cri the condition
The latter equality is valid for all ri : i ≤ ri ≤ mi ≤ , since the only property used
was the fact that degXi |Gi = degXi |Gr .
i
26
Mathematics 2021, 9, 193
central node of only one 3-chain, aside for the root and the leaf; thus, #c = n − 2. The upper
bound is derived by counting the number of 3-chains in a n-star (there is a root and all
the remaining nodes are leaves). The root, say Y, has degY = n − 1, and the remaining
nodes (enumerate them as X1 , . . . Xn−1 ), have degree one. In this case, consider the first
edge X1 Y, it can be linked through Y to more n-2 nodes, which also gives the number of
3-chains it can be part of. The next edge X2 Y, it can be connected through Y to n − 3 nodes
to form n − 3 different chains (the chain X2 − Y − X1 is the same as X1 − Y − X2 , which
has been already counted for). It is now clear that the number of 3-chains in an n-star is
n n −2
1
#ci = ∑ (n − k) = ∑ k = 2 (n − 1)(n − 2). (A45)
k =2 k =1
The number of chains in a n-star is also the number of 3-chains that a node contributes
in a complete graph. Then, to obtain the number of 3-chains in a complete graph it is enough
to multiply Equation (A45) by the number of nodes, and so #c = n#ci = 12 n(n − 1)(n − 2).
Another way of obtaining this value consists in using well-known formulas from
combinatorial calculus, and observing that the number of 3-chains in a complete graph
of n vertices is the number of simple dispositions, i.e., the number of ordered sequences of
length 3 without repetitions in a set of n elements, divided by two. The factor 2 comes from
the symmetry of the 3-chains; that is, A − B − C is the same 3-chain as C − B − A. Then,
once again,
1 n! 1
#c = = n(n − 1)(n − 2) (A46)
2 ( n − 3) ! 2
References
1. D’Ariano, M.; G Paris, M.G.; Sacchi, M.F. Quantum tomography. Adv. Imaging Electron. Phys. 2003, 128, 206–309.
2. Huber, F.M.; Gühne, O. Characterizing ground and thermal states of few-body Hamiltonians. Phys. Rev. Lett. 2016, 117, 010403.
[CrossRef] [PubMed]
3. Cotler, J.; Wilczek, F. Quantum overlapping tomography. Phys. Rev. Lett. 2020, 124, 100401. [CrossRef] [PubMed]
4. Jaynes, E.T. Information theory and statistical mechanics. Phys. Rev. 1957, 106, 620. [CrossRef]
5. Bairey, E.; Arad, I.; Lindner, N.H. Learning a local Hamiltonian from local measurements. Phys. Rev. Lett. 2019, 122, 020504.
[CrossRef] [PubMed]
6. Bairey, E.; Guo, C.; Poletti, D.; Lindner, N.H.; Arad, I. Learning the dynamics of open quantum systems from their steady states.
New J. Phys. 2020, 22, 032001. [CrossRef]
7. Wiebe, N.; Granade, C.; Ferrie, C.; Cory, D.G. Hamiltonian Learning and Certification Using Quantum Resources. Phys. Rev. Lett.
2014, 112, 190501. [CrossRef]
8. Biamonte, J.; Wittek, P.; Pancotti, N.; Rebentrost, P.; Wiebe, N.; Lloyd, S. Quantum machine learning. Nature 2017, 549, 195.
[CrossRef]
9. Anshu, A.; Arunachalam, S.; Kuwahara, T.; Soleimanifar, M. Sample-efficient learning of quantum many-body systems. arXiv
2020, arXiv:2004.07266.
10. Cao, N.; Xie, J.; Zhang, A.; Hou, S.Y.; Zhang, L.; Zeng, B. Supervised learning for quantum maximum entropy estimation. arXiv
2020, arXiv:2005.01540.
11. Klyachko, A.A. Quantum marginal problem and N-representability. In Journal of Physics: Conference Series; IOP Publishing:
Bristol, UK, 2006; Volume 36, p. 72.
12. Liu, Y.K. Consistency of local density matrices is QMA-complete. In Approximation, Randomization, and Combinatorial Optimization
Algorithms and Techniques; Springer: Berlin/Heidelberg, Germany, 2006; pp. 438–449.
13. Higuchi, A.; Sudbery, A.; Szulc, J. One-qubit reduced states of a pure many-qubit state: Polygon inequalities. Phys. Rev. Lett.
2003, 90, 107902. [CrossRef] [PubMed]
14. Bravyi, S. Requirements for Compatibility between Local and Multipartite Quantum States. Quantum Inf. Comput. 2004, 4, 12–26.
15. Huber, F.M. Quantum States and Their Marginals: From Multipartite Entanglement to Quantum Error-Correcting Codes.
Ph.D. Thesis, University of Siegen (DE), Siegen, Germany, 2018.
16. Bishop, C.M. Pattern Recognition and Machine Learning; Springer: Berlin/Heidelberg, Germany, 2006.
17. Dagum, P.; Luby, M. Approximating probabilistic inference in Bayesian belief networks is NP-hard. Artif. Intell. 1993, 60, 141–153.
[CrossRef]
18. Valiant, L.G. The complexity of computing the permanent. Theor. Comput. Sci. 1979, 8, 189–201. [CrossRef]
27
Mathematics 2021, 9, 193
19. Chow, C.K.; Liu, C.N. Approximating discrete probability distributions with dependence trees. IEEE Trans. Inf. Theory 1968,
14, 462–467. [CrossRef]
20. Leifer, M.S.; Spekkens, R.W. Towards a formulation of quantum theory as a causally neutral theory of Bayesian inference.
Phys. Rev. A 2013, 88, 052130. [CrossRef]
21. Fitzsimons, J.F.; Jones, J.A.; Vedral, V. Quantum correlations which imply causation. Sci. Rep. 2015, 5, 18281. [CrossRef]
22. Horsman, D.; Heunen, C.; Pusey, M.F.; Barrett, J.; Spekkens, R.W. Can a quantum state over time resemble a quantum state at a
single time? Proc. R. Soc. A Math. Phys. Eng. Sci. 2017, 473, 20170395. [CrossRef]
23. Watrous, J. Quantum computational complexity. arXiv 2008, arXiv:0804.3401.
24. Bernstein, E.; Vazirani, U. Quantum complexity theory. Siam J. Comput. 1997, 26, 1411–1473. [CrossRef]
25. Watrous, J. Limits on the power of quantum statistical zero-knowledge. In Proceedings of the 43rd Annual IEEE Symposium on
Foundations of Computer Science, Vancouver, BC, Canada 16–19 November 2002; IEEE: New York, NY, USA, 2002; pp. 459–468.
26. Arora, S.; Barak, B. Computational Complexity: A Modern Approach; Cambridge University Press: Cambridge, UK, 2009.
27. Ben-Aroya, A.; Schwartz, O.; Ta-Shma, A. Quantum Expanders: Motivation and Construction. Theory Comput. 2020, 6, 47–79.
[CrossRef]
28. Fawzi, O.; Renner, R. Quantum conditional mutual information and approximate Markov chains. Commun. Math. Phys. 2015,
340, 575–611. [CrossRef]
29. Giorgio, S.D.; Mateus, P.; Mera, B. Recoverability from direct quantum correlations. J. Phys. A Math. Theor. 2020, 53, 185301.
[CrossRef]
30. Wang, Y.J. Compatibility among Marginal Densities. Biometrika 2004, 91, 234–239. [CrossRef]
31. De Loera, J.; Onn, S. The Complexity of Three-Way Statistical Tables. Siam J. Comput. 2004, 33, 819–836. [CrossRef]
32. Fritz, T.; Chaves, R. Entropic Inequalities and Marginal Problems. IEEE Trans. Inf. Theory 2013, 59, 803–817. [CrossRef]
33. Watrous, J. Succinct quantum proofs for properties of finite groups. In Proceedings of the 41st Annual Symposium on Foundations
of Computer Science, Redondo Beach, CA, USA, 12–14 November 2000; IEEE: New York, NY, USA, 2000; pp. 537–546.
34. Aaronson, S. Quantum computing, postselection, and probabilistic polynomial-time. Proc. R. Soc. A Math. Phys. Eng. Sci. 2005,
461, 3473–3482. [CrossRef]
35. Sutter, D. Approximate Quantum Markov Chains. In Approximate Quantum Markov Chains; Springer International Publishing:
Cham, Switzerland, 2018; pp. 75–100.
36. Sutter, D.; Fawzi, O.; Renner, R. Universal recovery map for approximate Markov chains. Proc. R. Soc. A 2016, 472, 20150623.
[CrossRef]
37. Choi, M.D. Completely positive linear maps on complex matrices. Linear Algebra Appl. 1975, 10, 285–290. [CrossRef]
38. Nielsen, M.A.; Chuang, I. Quantum Computation and Quantum Information; Cambridge University Press: Cambridge, UK, 2010.
39. Aharonov, D.; Kitaev, A.; Nisan, N. Quantum circuits with mixed states. In Proceedings of the Thirtieth Annual ACM Symposium
on Theory of Computing, Berkeley, CA, USA, 28–30 May 1998; pp. 20–30.
40. Löwner, K. Über monotone matrixfunktionen. Math. Z. 1934, 38, 177–216. [CrossRef]
41. Bengtsson, I.; Życzkowski, K. Geometry of Quantum States: An Introduction to Quantum Entanglement; Cambridge University Press:
Cambridge, UK, 2006.
42. Cover, T.M.; Thomas, J.A. Elements of Information Theory; John Wiley & Sons: New York, NY, USA, 2012.
43. Cayley, A. A theorem on trees. Quart. J. Math. 1889, 23, 376–378.
44. Ambainis, A.; Nayak, A.; Ta-Shma, A.; Vazirani, U. Dense quantum coding and quantum finite automata. J. Assoc. Comput. Mach.
(JACM) 2002, 49, 496–511. [CrossRef]
45. Umegaki, H. Conditional expectation in an operator algebra, IV (entropy and information). In Kodai Mathematical Seminar Reports;
Department of Mathematics, Tokyo Institute of Technology: Tokyo, Japan, 1962; Volume 14, pp. 59–85.
46. Uhlmann, A. Relative entropy and the Wigner-Yanase-Dyson-Lieb concavity in an interpolation theory. Commun. Math. Phys.
1977, 54, 21–32. [CrossRef]
47. Petz, D. Monotonicity of quantum relative entropy revisited. Rev. Math. Phys. 2003, 15, 79–91. [CrossRef]
28
mathematics
Article
On the Amplitude Amplification of Quantum States
Corresponding to the Solutions of the Partition Problem
Mauro Mezzini 1, *, Jose J. Paulet 2 , Fernando Cuartero 3 , Hernan I. Cruz 3 and Fernando L. Pelayo 3
Abstract: In this paper we investigate the effects of a quantum algorithm which increases the
amplitude of the states corresponding to the solutions of the partition problem by a factor of almost
two. The study is limited to one iteration.
O(1/ N ) (in the worst case in which there is only one configuration which is the solution
Publisher’s Note: MDPI stays neutral of the problem), where√N = 2n is the number of possible configurations. In this way,
with regard to jurisdictional claims in after approximately O( N ) iterations, the amplitudes of the states corresponding to the
published maps and institutional affil- solutions of the problem approach 1.
iations.
We exploit the parallelism of quantum computation, therefore devising a quantum
algorithm that is capable of doubling the amplitude of the states corresponding to the
solution of a problem. In this paper, we will focus on the subset sum problem, a well known
NP-complete problem. The subset sum problem is very important both at a theoretical
Copyright: © 2021 by the authors. level in complexity theory, and at a practical level in applications such as cryptography.
Licensee MDPI, Basel, Switzerland. The problem can be stated in the following way in which we denote by N+ , the set of
This article is an open access article non-zero natural numbers. Let E be a finite set of elements, s : E → N+ a function and
distributed under the terms and W ∈ N+ a target number. The subset sum problem wonders whether there exists a subset
conditions of the Creative Commons
E ⊂ E such that ∑e∈ E s(e) = W. Usually this problem can also be reformulated as follows.
Attribution (CC BY) license (https://
There exists a subset E ⊂ E such that ∑e∈ E s(e) = ∑e∈ E\ E s(e)? In this later formulation
creativecommons.org/licenses/by/
it is called the partition problem (PP) [4]. From now on we do not lose any generality in
4.0/).
considering the set E equals the set of the first | E| natural numbers; that is, we always
consider E = {0, 1, . . . , n − 1}. Furthermore, we note that if PP has a solution E then E − E
is also a solution of the PP.
The literature is abundant in the study of this problem, for which the dynamic pro-
gramming solving strategy is the most commonly applied. More recently, it has also been
approached from the point of view of quantum computing, among these references we
can mention [5] where an instance of the subset sum problem can be implemented by
a quantum algorithm using the nuclear magnetic resonance (NMR) technique. In that
paper, even at a very early stage and with a low number of qubits, they limit themselves to
showing that the problem can be approached from this new perspective.
In [6], the authors studied the problem through both an asymptotic heuristic and a new
data structure for using quantum gates. There, the possibility of obtaining an improvement
over classical algorithms is shown, specifically the Howgrave–Graham–Joux [7], which of
course is fully coherent with the NP ⊆ BQP conjecture, obtaining a bound time Õ(22/3n ).
More recently, in 2018, Helm and May [8] proposed a quantum algorithm that reduces
the heuristic time to Õ(20.226n ). A couple of years later, Li and Li [9] reduced this time
beyond that, i.e., to Õ(20.209n ).
In this work we will get rid of the heuristics of these studies to better go for the modest
approach of [5]. In this sense, we propose a piece of quantum code using a quantum
circuit to model the problem, consequently we devise a transformation that will allow us to
increase the amplitudes of those corresponding to the solution by 50%, leaving the line of
how and how many times this process could be iterated, as the key issue to be dealt with.
In fact, we think that we could find the same limitations as those from Grover’s algorithm.
Anyway, we believe that this line of research deserves to be addressed.
Let x ∈ N, 0 ≤ x < 2n then we say that | x is a computational state, the binary
representation of which is | xn−1 xn−2 . . . x0 with xn−1 being the most significant bit of the
binary representation of | x .
The S gate for a single qubit is represented by the following matrix:
1 0
S=
0 i
√
Other usual gates are Pauli X gate, also known as NOT gates, and X gates.
√
0 1 1 1+i 1−i
X= X=
1 0 2 1−i 1+i
The Hadamard gate for a single qubit is
√
2 1 1
H=
2 1 −1
While the same gate for n qubits is represented by the following matrix
n √
2 1 1
H⊗ =
n
2 1 −1
i =1
As stated before, we are interested in amplifying amplitudes for the search problem.
In order to do this we make use of sequences of quantum gates in the way of Hadamard-S-
Hadamard. Let us start by describing graphically the effect of such quantum gates and so
resorting to the positions of the state vector represented in the Bloch sphere.
The effect of applying an H q-gate over a qubit represented on the Bloch Sphere can
be seen as “first rotating an angle of π radians around the Z axis and then rotating an angle
of π2 radians around the Y axis” (fully equivalent to “first rotating an angle of π2 radians
around the Y axis and then rotating an angle of π radians around the X axis”, which are the
movements made by H in Figure 1). Hadamard q-gate application changes a qubit from a
computational basis to a Hadamard basis. To better understand the effects of the sequence
30
Mathematics 2021, 9, 2027
H-S-H we start, as usual, from a qubit initialized to |0 , i.e., located at the north pole of the
Bloch s. which, moved through a Hadamard gate, gets located at the equator of the Bloch
s., specifically on the X axis, in the position usually known as a |+ , which corresponds to
the qubit
√ √
2 2
|+ = |0 + |1
2 2
After this gate, we apply an S gate, the effect of which is a rotation of the state vector
through an angle of π2 radians around the Z axis. This places the qubit at position |i .
√ √
2 2
|i = |0 + i · |1
2 2
Finally, the effect of the second application of gate H is to reset the computational base,
and then the vector from position |i moves to the opposite point on the Y axis, that is, to
the position
√ √
2 2
|−i = |0 − i · |1
2 2
In general, we have the following result
√
HSH = X
That is, an HSH gate is equivalent to a π2 radians clockwise rotation around the X axis
as Figure 1 shows over a single qubit initialized to |0 .
n
2. The Effect of Applying Hadamard-S-Hadamard Gates to |0⊗
First of all we will introduce a notation which will be heavily used in the rest of
the paper. Let x ∈ N, 0 ≤ x < 2n and xn−1 . . . , x1 x0 be its binary representation. The
Hamming weight of x will be denoted as w( x ) = ∑nj=−01 x j . Let z ∈ N, 0 ≤ z < 2n ,
|z = |zn−1 zn−2 . . . z0 . The term x · z denotes ∑nj=−01 x j z j . Furthermore, ∀k ∈ N, 0 < k < n,
we denote by z-k a natural number obtained from z by considering only the least n − k
significant bits, that is, the binary representation of z-k is zn−k−1 zn−k−2 . . . z0 . In other
words z-k is the bitwise AND between z and 2n−k − 1.
In this section we want to determine the effect of applying Hadamard first, then S and
finally Hadamard gates on quantum state |0 ⊗ , that is, we want to determine a formula
n
2n − 1
1
|ψ = H ⊗ | x = √ ∑ (−1)x·z |z
n
(2)
2n z =0
31
Mathematics 2021, 9, 2027
S ⊗ | x = i w ( x ) | x n −1 x n −2 . . . x0
n
Proof. Induction on n is the base case with n = 1 straightforward. So suppose that the
statement holds for n − 1. Then
n −1
S ⊗ | x = S | x n −1 ⊗ S | x n −2 · · · ⊗ S | x0 = S ⊗
n
| x n −1 . . . x 1 ⊗ S | x 0 =
∑nj=−11 xj
=i | xn−1 . . . x1 ⊗ S| x0 = (by induction hypothesis)
∑nj=−11 x j
=i | x n −1 . . . x 1 ⊗ i x0 | x 0 =
= i w ( x ) | x n −1 x n −2 . . . x0
2n −1 2n −1
1 1
|ψ1 = S⊗ H ⊗ |0 ⊗n
= S⊗ √ i w( x ) | x
n n n
2n
∑ |x = √
2n
∑
x =0 x =0
2n −1
∑ iw( x) (−1) x·z (3)
x =0
for every 0 ≤ z < 2n . We will do this in the following two theorems. First of all we need
the next Lemma which will be heavily used in the rest of the paper.
Lemma 2. Let 0 ≤ z < 22m+1 and 0 ≤ x < 22m+1 and let z2m z2m−1 . . . z0 and x2m x2m−1 . . . x0
be the binary representation, respectively, of z and x. We have that
22m+1 −1 22m −1 −1
2m
zj ·xj ∑2m
j =0 z j · x j
∑ iw( x) (−1)∑ j=0 = i (−1)z2m ∑ iw( x) (−1) (4)
x =22m x =0
Proof. We note that, on the left hand of Equation (4), for every element of the sum, we
2m−1
have that x2m = 1. Therefore ∑2m
j=0 z j · x j = ∑ j=0 z j · x j + z2m . Based on this we have that
22m+1 −1 22m+1 −1 −1
2m
zj ·xj ∑2m
j =0 z j · x j
∑ iw( x) (−1)∑ j=0 = (−1)z2m ∑ iw( x) (−1)
x =22m x =22m
Furthermore for the same reason above, if 22m ≤ x < 22m+1 and if 0 ≤ x̄ < 22m then we
have that w( x ) = w( x̄ ) + 1 and this proves Equation (4).
32
Mathematics 2021, 9, 2027
2n −1
∑ iw( x) (−1)z· x = (−1)w(z) im+w(z) 2m (5)
x =0
Proof. We prove Equation (5) on induction on m being the base case with m = 1 being
easily verifiable for all z ∈ {0, 1, 2, 3}. So suppose the statement holds for all h ≤ m and for
all 0 ≤ z < 22m . Then, for any 0 ≤ z < 22m+2 we have
22m+2 −1 22m −1 −1
∑2m
j =0 z j · x j
∑ iw( x) (−1)z· x = ∑ iw( x) (−1) (6)
x =0 x =0
22m+1 −1 2m
zj ·xj
+ ∑ iw( x) (−1)∑ j=0 + (7)
x =22m
22m+2 −1 +1
∑2m
j =0 z j · x j
+ ∑ iw( x) (−1) (8)
x =22m+1
Now, by Equation (4) and by induction hypothesis, we have that (7) is equal to
22m+1 −1 22m −1 −1
2m
zj ·xj ∑2m
j =0 z j · x j
∑ iw( x) (−1)∑ j=0 = i (−1)z2m ∑ iw( x) (−1) =
x =22m x =0
Likewise, in the term (8), for each, x is the sum, the bit x2m+1 is always set to 1, so we have
that (8) is, by Equation (4), equal to
22m+2 −1 +1 22m+1 −1
∑2m
j =0 z j · x j
2m
zj ·xj
∑ iw( x) (−1) = i (−1)z2m+1 ∑ iw( x) (−1)∑ j=0 (10)
x =22m+1 x =0
Now by repeatedly applying Equation (4) and the induction hypothesis we have that the
sum in the right hand of Equation (10) is
22m+1 −1 2m
zj ·xj
∑ iw( x) (−1)∑ j=0 = (11)
x =0
22m −1 −1 22m+1 −1
∑2m
j =0 z j · x j
2m
zj ·xj
= ∑ iw( x) (−1) + ∑ iw( x) (−1)∑ j=0 =
x =0 x =22m
22m −1 −1
∑2m
j =0 z j · x j
= (−1)w(z-2 ) im+w(z-2 ) 2m + i (−1)z2m ∑ iw( x) (−1) =
x =0
= (−1)w(z-2 ) im+w(z-2 ) 2m [1 + i (−1)z2m ] (12)
So if we replace (12) in (10) and if we sum together (6), (9) and (10) we obtain
az =(−1)w(z-2 ) im+w(z-2 ) 2m 1 + i (−1)z2m + i (−1)z2m+1 + i2 (−1)z2m +z2m+1 =
=(−1)w(z-2 ) im+1+w(z-2 ) 2m −i + (−1)z2m + (−1)z2m+1 + i (−1)z2m +z2m+1 (13)
33
Mathematics 2021, 9, 2027
⎧
⎨ 2P if z2m = z2m+1 = 0
az = −2iP if z2m = z2m+1
⎩
−2P if z2m = z2m+1 = 1
for every 0 ≤ z < 22m+2 , and this proves the induction step.
Proof. First of all we note that Equation (14) holds if m = 0 and z ∈ {0, 1}. So in the
following we suppose that m > 1. We have that
22m+1 −1
az = ∑ iw( x) (−1)z· x =
x =0
22m −1 −1 22m+1 −1
∑2m
j =0 z j · x j
2m
zj ·xj
= ∑ iw( x) (−1) + ∑ iw( x) (−1)∑ j=0
x =0 x =22m
22m −1 −1
∑2m
j =0 z j · x j
az = (−1)w(z-1 ) im+w(z-1 ) 2m + i (−1)z2m ∑ iw( x) (−1) =
x =0
=(−1)w(z-1 ) im+w(z-1 ) 2m + i (−1)z2m (−1) w(z-1 ) m+w(z-1 ) m
i 2 =
w(z-1 ) m+w(z-1 ) m
=(−1) i 2 [1 + i (−1) z2m
] (15)
Let z2m z2m−1 . . . z0 be the binary representation of z. Suppose first that z2m = 0. Then
Equation (15) become
and the Theorem is therefore proved. So suppose that z2m = 1. Then Equation (15) become
34
Mathematics 2021, 9, 2027
|z az
|0000 −4
|0001 4i
|0010 4i
|z az |0011 4
|000 −2 + 2i |0100 4i
|001 2 + 2i |0101 4
|010 2 + 2i |0110 4
|011 2 − 2i |0111 −4i
|100 2 + 2i |1000 4i
|101 2 − 2i |1001 4
|110 2 − 2i |1010 4
|111 −2 − 2i |1011 −4i
|1100 4
|1101 −4i
|1110 −4i
|1111 −4
Figure 2. (Left) The amplitudes of az for n = 3. (Right) The amplitudes of az for n = 4. In order to
get the final amplitudes one should multiply them by a suitable normalization factor.
where σ is set to the two’s complement of −S and |c is set to |1 . Then, we apply the
Hadamard q-gate to the first n qubits, so obtaining
35
Mathematics 2021, 9, 2027
2n −1
1
| ϕ1 = H ⊗ ⊗ I m +1 | ϕ0 = √
n
2n
∑ | x |σ |c
x =0
Next, we use each qubit xe to conditionally sum the element s(e) to |σ . If there exists
a solution to the PP then, in the final superposition of |σ , the amplitude of the state
| x |0 ⊗ |c will not be 0. The states | x for which |σ is zero will be referred to as the
m
solutions states of the PP. The control qubit |c will be set to zero exactly for those states
for which |σ = |0 ⊗ . At this point we apply an uncomputational step in order to set
m
2n −1
1
| ϕ2 = S ⊗ ⊗ I m +1 | ϕ1 = √ i w( x ) | x | σ | c
n
2n
∑
x =0
Afterwards Hadamard gate is applied to the first n qubits controlled by the control qubit
|c such that it only affects non-solution states (see Figure 3). For the sake of simplicity we
suppose that PP has only two solutions whose numeric representation is y and its bitwise
complement y. By Equation (3), we obtain
n
contr H ⊗ 1
| ϕ2 −−−−−→ | ϕ3 = √ ∑ i w ( z ) | z | σ |0 +
2n z∈{y,y}
2n − 1
1
+ ∑ ∑ iw( x) (−1) x·z |z |σ |1 =
2n z =0 x ∈
/ {y,y}
⎡ ⎤
1 ⎣√ n w(z)
2n − 1
w( x ) x ·z
= n 2 ∑ i | z | σ |0 + ∑ ∑ i (−1) |z |σ |1 ⎦ (19)
2 z∈{y,y} z =0 x ∈
/ {y,y}
Now we want to quantify the amplitude of the state |y |σ |1 and |y |σ |1 of Equation (19).
We consider only the state |y |σ |1 since the same arguments can be applied to state
|y |σ |1 . The amplitude by of the state |y |σ |1 (in the following we disregard the nor-
malization factor 1/2n ) is given by the following formula
2n − 1
by = ∑ iw( x) (−1) x·y = ∑ iw( x) (−1) x·y − ∑ iw( x) (−1) x·y (21)
x∈
/ {y,y} x =0 x ∈{y,y}
We have that
• w(y) is odd
36
Mathematics 2021, 9, 2027
For simplicity of notation in the following we denote w(y) as simply w. We have that if
n = 2m is even then, by Theorem 1, by is
⎧
⎨ (−1)w im+w 2m − iw (1 + i2m ) if w is even
by = (25)
⎩
(−1)w im+w 2m + iw (1 + i2m ) if w is odd
It is immediate to check that in Equations (25) and (26) the term iw (1 + in ) becomes
negligible, with respect to the other term in the equation, as m becomes bigger. We
conclude that the amplitude of the state |y |σ |1 is almost the same as the amplitude of
state |y |σ |0 , thus effectively duplicating the chances of state |y at the end of the circuit.
Figure 3 captures on the Quirk simulator the instance of the PP where elements in
E are s(0) = 2, s(1) = 1 and s(2) = 3 depicted in rows 1–2, 3–4 and 5–6, bottom-up
referring to the number of the rows as well as the significance of the qubits. The 7th row
is used for the control qubit. Rows 8–11 encode −S = −3 which in two’s complement is
represented with four bits σ = 1101 (bootom-up). The last three qubits are used to be set
on the superposition as usual.
Since n = 2m + 1 = 3 and |y = |011 , we have that by = 3 − 3i, thus the probability of
1 √ 2 26
getting |y is, by (19), |2 2| + |3 − 3i |2 = = 0.40625 which is exactly the output
64 64
of Quirk simulator as it can be checked in [10].
37
Mathematics 2021, 9, 2027
As can be easily seen, this circuit resembles Grover’s algorithm. Both have an initial
superposition in the states where the solution will be encoded, afterwards the function
to be solved (also called oracle) is computed in order to identify the solution state that
should be marked in some way. Finally, a sort of transformation (Z axis turns, Hadamards)
before measuring is required. However, they have important differences in some of these
generic steps that can generate on the one hand why our proposal amplifies the probability
of the solution state more than Grover’s but on the other hand Grover’s one can be iterated;
meanwhile, ours cannot.
The main difference relies on how the algorithms mark the solution state. In our
proposal the X axis is used for that; i.e., formerly the control qubit is set to |1 which means
“no solution”; meanwhile, as soon as σ = −S + ∑e∈ E s(e) equals 0 (solution condition) it is
set to |0 . In Grover’s algorithm, the solution state is marked on the Z axis; that is, by means
of a negative sign in the solution state. This last fact allows the calculations to be carried
without any entanglement with the solution state.
Finally, the amplitude amplification part is also different but follows somehow the
same fashion. In our proposal, we perform the amplification of the probability amplitude
by means of turns in the Z axis and Hadamard transformations, which is very similar
to the inversion on the mean of Grover’s algorithm nevertheless, we apply Hadamard
gates controlled by a qubit in which the solution has been marked. This fact generates
an entanglement with the result of the function, which probably disables the interference
required to iterate the corresponding piece of code.
Since the proposed method doubles the amplitude of the states corresponding to a
solution of the referred problem, one can infer that the reiteration of the method could lead
us to a quantum polynomial algorithm that could solve the problem P = NP. Of course, we
emphasize, that this is not our intention. Due to the way in which we mark the solution state
pointed out at the end of the previous section, our piece of quantum code cannot directly
be iterated as it can in the case of Grover’s algorithm, therefore our proposal is simply to
research to what extent this circuit could be either iterated/modified to be iterable, or, used
as a shortcut to finish sooner some algorithms like Grover´s one.
The algorithm presented makes use of an oracle, and the approach is similar to
the black box model as described in [11]; the idea of iterating this algorithm will suffer
inevitably from the same limitation described there, and then the maximum speed-up
should be limited to the polynomial, as it occurs with Grover’s algorithm. It is our belief
that together with any transformation aimed to make iterable the proposed code, it would
come as drawback that its computational cost will compensate such an advantage.
Another idea related to our proposal is the possibility of application to the hidden
subgroup problem. It is described in Section 5.4.3 of [3] and it has a known quantum
solution by a variant of Shor’s algorithm for the specific case of finite Abelian groups.
However, the general problem remains open, with important consequences, for example
for the graph isomorphism problem. This problem is discussed in Section 16.3 of [12] by
using Boolean functions and their parity. This discussion is very similar to our Figure 2;
thus, we think that it is worth investigating the possible relationship between them and,
moreover, we also think that the problem of the hidden subgroup on Lie groups of general
nature, such as SU(2) groups representing the quantum states of a single qubit, SU(4) for
two qubits, and so on deserves to be studied. This could also offer an interesting research
line for future works.
Author Contributions: Individual contributions are as follows: Conceptualization M.M. and J.J.P.;
Formal analysis M.M., F.C. and F.L.P.; Investigation M.M., J.J.P., F.C., H.I.C. and F.L.P.; Writing—
38
Mathematics 2021, 9, 2027
original draft M.M., J.J.P., H.I.C. and F.C.; Writing—reviewing & editing M.M. and F.L.P. All authors
have read and agreed to the published version of the manuscript.
Funding: This research received non-external funding.
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: Not applicable.
Acknowledgments: The authors would like to thank the anonymous reviewer who has pointed out
the similarity between our treatment of the partition problem with the one discussed by Svozil for
the hidden subgroup problem. This work was supported by project “FAME (Formal modeling and
advanced testing methods. Applications to medicine and computing systems)”, reference RTI2018-
093608-B-C32, and by the Junta de Comunidades de Castilla-La Mancha project SBPLY/17/180501/
000276/01 (cofunded with FEDER funds, EU).
Conflicts of Interest: The authors declare non-conflict of interest.
References
1. Shor, P. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings of the 35th Annual Symposium
on Foundations of Computer Science, Santa Fe, NM, USA, 20–22 November 1994; pp. 124–134. [CrossRef]
2. Deutsch, D.; Jozsa, R. Rapid solution of problems by quantum computation. Proc. R. Soc. London Ser. Math. Phys. Sci. 1992,
439, 553–558. [CrossRef]
3. Nielsen, M.A.; Chuang, I.L. Quantum Computation and Quantum Information: 10th Anniversary Edition, 10th ed.; Cambridge
University Press: Cambridge, MA, USA, 2011.
4. Karp, R. Reducibility among combinatorial problems. In Complexity of Computer Computations; Miller, R., Thatcher, J., Eds.;
Plenum Press: Berlin, Germany, 1972; pp. 85–103.
5. Chang, W.L.; Ren, T.T.; Feng, M.; Lu, L.C.; Lin, K.W.; Guo, M. Quantum Algorithms of the Subset-Sum Problem on a Quantum
Computer. In Proceedings of the 2009 WASE International Conference on Information Engineering, Taiyuan, China, 10–11 July
2009; Volume 2, pp. 54–57. [CrossRef]
6. Bernstein, D.J.; Jeffery, S.; Lange, T.; Meurer, A. Quantum Algorithms for the Subset-Sum Problem. In Post-Quantum Cryptography;
Gaborit, P., Ed.; Springer: Berlin/Heidelberg, Germany, 2013; pp. 16–33.
7. Howgrave-Graham, N.; Joux, A. New Generic Algorithms for Hard Knapsacks. Cryptology ePrint Archive, Report 2010/189.
2010. Available online: https://eprint.iacr.org/2010/189 (accessed on 27 July 2021).
8. Helm, A.; May, A. Subset Sum Quantumly in 1.17n . In Proceedings of the 13th Conference on the Theory of Quantum
Computation, Communication and Cryptography, Sydney, Australia, 16 July 2018; pp. 5:1–5:16.
9. Li, Y.; Li, H. Improved quantum algorithm for the random subset sum problem. arXiv 2019, arXiv:1912.09264.
10. Mezzini, M. Quirk’s Url of an Instance of the Partition Problem. 2021. Available online: https://tinyurl.com/kp38rajd
(accessed on 27 July 2021).
11. Beals, R.; Buhrman, H.; Cleve, R.; Mosca, M.; de Wolf, R. Quantum Lower Bounds by Polynomials. J. ACM 2001, 48, 778–797.
[CrossRef]
12. Svocil, K. Quantum Queries Associated with Equi-partitioning of States and Multipartite Relational Encoding Across Space-Time.
Adv. Unconv. Comput. Emerg. Complex. Comput. 2017, 22, 429–438. [CrossRef]
39
mathematics
Article
Quantum Algorithms for Some Strings Problems Based on
Quantum String Comparator †
Kamil Khadiev 1, *, Artem Ilikaev 1 and Jevgenijs Vihrovs 2
Abstract: We study algorithms for solving three problems on strings. These are sorting of n strings of
length k, “the Most Frequent String Search Problem”, and “searching intersection of two sequences of
strings”. We construct quantum algorithms that are faster than classical (randomized or deterministic)
counterparts for each of these problems. The quantum algorithms are based on the quantum proce-
√
dure for comparing two strings of length k in O( k) queries. The first problem is sorting n strings
of length k. We show that classical complexity of the problem is Θ(nk ) for constant size alphabet,
√
but our quantum algorithm has Õ(n k ) complexity. The second one is searching the most frequent
string among n strings of length k. We show that the classical complexity of the problem is Θ(nk), but
√
our quantum algorithm has Õ(n k) complexity. The third problem is searching for an intersection of
two sequences of strings. All strings have the same length k. The size of the first set is n, and the size
of the second set is m. We show that the classical complexity of the problem is Θ((n + m)k ), but our
√
quantum algorithm has Õ((n + m) k ) complexity.
Citation: Khadiev, K.; Ilikaev, A.;
Vihrovs, J. Quantum Algorithms for Keywords: quantum computation; quantum algorithms; string processing; sorting
Some Strings Problems Based on
Quantum String Comparator.
Mathematics 2022, 10, 377. https://
doi.org/10.3390/math10030377
1. Introduction
Academic Editors: Fernando L. Quantum computing [1–3] is one of the hot topics in computer science in the last few
Pelayo, Mauro Mezzini and Jan decades. There are many problems where quantum algorithms outperform the best known
Sładkowski classical algorithms [4–12].
Received: 12 November 2021
One of these problems are problems for strings. Researchers show the power of
Accepted: 22 January 2022 quantum algorithms for such problems in [13–22].
Published: 26 January 2022 In this paper, we consider three problems:
algorithm for the search is described in [29]. Using this idea, we obtain quantum algorithms
for several problems.
The first problem is the String Sorting problem. Assume that we have n strings of
length k. It is known [30] that no quantum algorithm can sort arbitrary comparable objects
faster than O(n log n). At the same time, several researchers tried to improve the hidden
constant [31,32]. Other researchers investigated the space bounded case [33]. We focus on
sorting strings. In a classical case, we can use an algorithm that is better than arbitrary
comparable objects sorting algorithms. It is radix sort that has O(nk) query complexity [34]
for a finite size alphabet. It is also a lower bound for classical (randomized or deterministic)
algorithms that is Ω(nk)√ . Our quantum √ algorithm for the string sorting problem has query
complexity O(n(log n) · k ) = Õ(n k), where Õ does not consider log factors. It is based
on standard sorting algorithms [34] or Heapsort [34,35] and the quantum algorithm for
comparing strings. Additionally, we use the idea of a noisy comparison procedure for
sorting [36].
The second problem is the following. We have n strings of length k. We can assume
that string symbols are letters from any constant size alphabet, for example, binary, Latin
alphabet, or Unicode. The problem is finding the string that occurs in the sequence
most often. The problem [37] is one of the most well-studied ones in the area of data
streams [38–41]. Many applications in packet routing, telecommunication logging, and
tracking keyword queries in search machines are critically based on such routines. The best-
known classical (randomized or deterministic) algorithms require Ω(nk ) queries because
an algorithm should at least test all symbols of all strings. The deterministic solution can
use the radix sort algorithm [34] or the Trie (prefix tree) [42–45] that allow achieving the
required complexity.
We propose a quantum algorithm that is based on the sorting algorithm from the first
problem. Our√algorithm√ for the most frequent
√ string search problem has query complexity
O(n(log n) · k ) = Õ(n k ). If log2 n = o ( k ), then our algorithm is better than classical
counterparts. Note that this setup makes sense in practical cases.
The third problem is the Intersection of Two String Sequences problem. Assume that
we have two sequences of strings of length k. The size of the first set is n, and the size of
the second one is m. The first sequence is given, and the second one is given in an online
fashion, one by one. After each requested string from the second sequence, we want to
check whether this string belongs to the first sequence. We propose a quantum algorithm √ for
the problem √ with quantum query complexity O (( n + m ( log m + log log n )) · log n · k) =
Õ((n + m) k ). The algorithm uses a quantum algorithm for sorting strings. At the
same time, the best-known classical (randomized or deterministic) algorithm requires
Ω((n + m)k ) queries, and this bound is achieved using the radix sort algorithm or the Trie
data structure.
The paper is an extended version of a conference paper [46].
The structure of the paper is the following. Discussion on the computation model is
situated in Section 2. We present the quantum subroutine that compares two strings in
Section 3. Then, we discuss three problems: Strings Sorting problem in Section 4, the Most
Frequent String Search problem in Section 5, and Intersection of Two String Sequences
problem in Section 6. Section 7 contains the conclusions.
2. Preliminaries
We use the standard form of the quantum query model. Let f : D → {0, 1}, D ⊆
{0, 1} N be an N variable function. An input for the function is x ∈ D. We are given an
oracle access to the input x, i.e., it is realized by a specific unitary transformation usually
defined as |i |z |w → |i |z + xi (mod 2) |w , where the |i register indicates the index of
the variable we are querying, |z is the output register, and |w is some auxiliary work-
space. Note that we use Dirac notation vectors. An algorithm in the query model consists
of alternating applications of arbitrary unitaries independent of the input and the query
unitary and a measurement in the end.
42
Mathematics 2022, 10, 377
In the case of non-binary input, we present the input variables in binary form. Using
alternating unitaries independent of the input, we can store bits in auxiliary work-space
|w and use the obtained variable in an algorithm. In the case of computing a complex
function f and additionally non-binary input, we can consider a block of alternating
unitaries independent of the input and the query unitary that stores required variables in
the auxiliary work-space |w . Then, we compute the Boolean value of the function f on
arguments and store them in the auxiliary work-space |w . After that, we can use the value
of the function f in our algorithms.
The smallest number of queries for an algorithm that outputs f ( x ) with a probability
that is at least 23 on all x is called the quantum query complexity of the function f and is
denoted by Q( f ). We refer the readers to [1–3] for more details on quantum computing.
In the quantum algorithms in this article, we discuss quantum query complexity. We
use modifications of Grover’s search algorithm [27,28] as quantum subroutines. For these
subroutines, time complexity (number of gates in a circuit) is more than query complexity
for an additional log factor. Note that the query can be implemented using the CNOT gate.
Lemma 1 ([24,25], Theorem 10; [23], Section 2.2; [26], Proposition 4). Suppose we have a
function f : {1, . . . , N } → {0, 1} for some integer N. There is a quantum algorithm for finding
j0 =
&min{ j ∈ {1, . . . , N } : f ( j) = 1}. The algorithm finds j0 with the expected query complexity
O( j0 ) and error probability that is, at most, 12 .
Let us choose the function f ( j) = (s j = t j ). Thus, we search for j0 that is the index
of the first unequal symbol of the strings. Then, we can claim that s precedes t in the
lexicographical order if the symbol s j0 precedes the symbol t j0 . The claim is right by the
definition of the lexicographical order. If there are no unequal symbols, then the strings are
equal.
If we discuss the implementation of the f , then we can say that for computing the
value f ( j), we store the binary representation of s j and t j in the auxiliary work-space, for
example, |ψs and |ψt . Then, compute the value of f ( j) and store it in a qubit |φ . After
that, we can use this value in the algorithm. The last step is clearing |φ using values of
|ψs and |ψt and the CNOT gate; then, clearing |ψs and |ψt repeatedly using the same
queries (that use CNOT gates). All these manipulations take a constant number of queries
because of the constant size of the input alphabet.
We use T HE _ FIRST _ ONE _ SEARCH ( f , k) as a subroutine from Lemma 1, where f ( j) =
(s j = t j ). Assume that this subroutine returns k + 1 if it does not find any solution or the
found argument j is such that f ( j ) = 0.
We use the standard technique of boosting success probability. Thus, we repeat the
subroutine log2 (δ−1 ) times and return the minimal answer.
Suppose the subroutine has an error. There are two cases. The first one is finding the
index of unequal symbols that is not the minimal one. In the second case, the algorithm
does not find unequal symbols. Then, we assume that it returns k + 1. Thus, in a case of an
error, the subroutine returns a value that is bigger than the correct answer.
43
Mathematics 2022, 10, 377
Therefore, if at least one subroutine invocation has no error, then the whole algorithm
succeeds. All error events are independent. The error probability of the whole algorithm is
the probability of error for all invocations of the subroutine, that is O 1
−1 = O ( δ ).
2log2 (δ )
Let us present the Algorithm 1.
Algorithm 1 C OMPARE _ STRINGS (s, t, k ). The Quantum Algorithm for Comparing Two
Strings.
j0 ← T HE _ FIRST _ ONE _ SEARCH ( f , k ) The initial value
for i ∈ {1, . . . , log2 δ−1 } do
j0 ← min( j0 , T HE _ FIRST _ ONE _ SEARCH ( f , k))
end for
if j0 = k + 1 then
result ← 0 The strings are equal.
else
if (s j0 < t j0 ) then
result ← −1 s precedes t.
else
result ← 1 s succeeds t.
end if
end if
return result
Lemma 2. Algorithm
√ 1 compares two strings of length k in the lexicographical order with query
complexity O( k log δ−1 ) and error probability O(δ) for some integer k and 0 < δ < 1.
The algorithm finds the minimal index of unequal symbols j0 . We can say that j0 − 1
is the length of the longest common prefix for these strings. √
We can show that the lower bound for the problem is Ω( k).
√
Lemma 3. Any quantum algorithm for Comparing Two Strings problem has Ω( k ) query com-
plexity.
Proof. Let us show that the problem is at least as hard as the unstructured search problem.
Let sk/2 = 1 and s j = 0 for all j ∈ {1, . . . , k/2 − 1, k/2 + 1, . . . k }. The string t is such
that there is only one 1 in position z. In other words, there is z ∈ {1, . . . , k} such that tz = 1
and t j = 0 for all j ∈ {1, . . . , z − 1, z + 1, . . . k}.
If z < k/2, then t > s. If z = k/2, then t = s. If z > k/2, then t < s. Therefore,
the problem is at least as hard as the search for 1 among the first k/2 variables in the
string t.
It is known [14] that
√ the quantum query complexity of the unstructured search among
k/2 variables is Ω( k).
At the same time, the classical complexity of the problem is Θ(k ).
Lemma 4. Randomized query complexity for Comparing Two Strings problem is Θ(k).
Proof. Due to the proof of Lemma 3, the problem is at least as hard as the search for 1
among the first k/2 variables in the string t.
It is known [14] that the randomized query complexity of the unstructured search
among k/2 variables is Ω(k).
At the same time, we can check all symbols sequentially to search the first unequal
symbol. This algorithm has O(k ) query complexity.
44
Mathematics 2022, 10, 377
Additionally, we can compute the complexity of any algorithm based on the two
strings comparison procedure.
Lemma 5. Suppose we have some integer n, integer A = A(n) and ε such that lim ε/A = 0.
n→∞
Then, if a quantum algorithm does A √(n) comparisons of strings of length k and has O(ε) error
probability, then it does at most O( A k log( A/ε)) queries.
Lemma 6 ([36], Theorem 3.5). Suppose we have a comparison procedure that works with error
probability ε. Then there is a sorting algorithm with query complexity O(n log(n/ε)) and error
probability at most ε.
Proof. The correctness of the algorithm follows from the description. Let ε = 0.1. Then,
we apply the result from Lemma
√ 6 and use the
√ quantum comparison procedure that has
ε error probability and O( k log ε−1 ) = O( k )√query complexity. √Therefore, the
√ query
complexity of the algorithm is O(n(log(n/ε)) · k) = O(n(log n) · k ) = Õ(n k ), and
the error probability is ε.
Proof. Let us show that the problem is at least as hard as the unstructured search problem.
Assume that strings s1 , . . . , sn are such that
• There is a pair (u, v) such that suv = 1;
• For all pairs (i, j) = (u, v), sij = 0.
45
Mathematics 2022, 10, 377
In that case, the answer is ORDER = (i1 , . . . , in−1 , u), where (i1 , . . . , in−1 ) is a permu-
tation of integers from {1, . . . , u − 1, u + 1, . . . , n}. The searching for the required index u is
at least as hard as the search for the 1-value variable suv .
It is known√ [14] that the quantum complexity of the unstructured search among nk
variables is Ω( nk ).
The lower bound for classical complexity can be proven by the same way as in
Theorem 2.
Proof. Due to the proof of Theorem 2, the problem is at least as hard as the search for 1
among nk variables in the strings s1 , . . . , sn .
It is known [14] that the randomized query complexity of the unstructured search
among nk variables is Ω(nk).
The Radix sort [34] algorithm reaches this bound and has O(nk) complexity in a case
of a finite alphabet.
Proof. The correctness of the algorithm follows from the description. Let us discuss the
√ query
complexity. Because of Theorem 1, the sorting algorithm’s complexity is O(n(log n) k ), and
the error probability is constant. The second step does O(n) comparison operations. Let
ε = 0.1. Thus,
√ because of Lemma 5, the second step of the algorithm algorithm does
O(n(log n)√k) queries, and√ the error probability
√ is constant. The total complexity is
O(n(log n) k + n(log n) k) = O(n(log n) k ).
Error events of two steps are independent. Therefore, the error probability of the
whole algorithm is also constant. We can achieve any required constant error probability
by repetition. The technique is standard in both one-side and two-side errors. It can be
seen, for example, in [16].
46
Mathematics 2022, 10, 377
Algorithm 2 The Quantum Algorithm for the Most Frequent String Problem.
(i1 , . . . , in ) = ORDER ← S ORT _ STRINGS (s) We sort s = (s1 , . . . , sn ).
cmax ← 0, jmax ← −1
c ← 1, j ← i1
for b ∈ (1, . . . , n) do
if b = n or (b = n and C OMPARE _ STRINGS (sib , sib+1 , k ) = 0) then We find the end of
a segment
if c > cmax then If the current segment is longer than the current longest one
cmax ← c, jmax ← j
end if
c←1
if b = n then
j = i b +1
end if
else
c ← c+1
if ib+1 < j then j is the minimal index of the current segment
j ← i b +1 .
end if
end if
end for
return jmax
Theorem 5. Suppose we have a constant ε such that 0 < ε < 3/4. If the length of the strings
k ≥ log2 n, then any quantum algorithm for the Most Frequent String Search problem has
√
Ω( nk + n3/4−ε ) query complexity. If k < log2 n, then any quantum algorithm for the Most
√
Frequent String Search problem has Ω( nk) query complexity
Proof. Let us show that the problem is at least as hard as the unstructured search problem.
Assume that n = 2t and k > 1 for some integer t. Then, let st+1 , . . . , s2t = 0k , where 0k
is a string of k zeros. Other strings can be s1 , . . . , st = 1k or there are z ∈ {1, . . . , t} and
u ∈ {1, . . . , k } such that szu = 0 and szu = 1 for all u ∈ {1, . . . , u − 1, u + 1, . . . , k}.
In the first case, the answer is 1k . In the second case, the answer is 0k . Therefore,
solving the problem for this instance is equivalent to the search for 0 among the first
tk = nk/2 variables.
√According to [14], the quantum complexity of the unstructured search among nk/2 is
Ω( nk ).
In the case of odd n, we assign sn = 1k/2 0k/2 , and it is not used in the search. Then,
we can consider only n − 1 strings. Thus, n − 1 is even.
Let us consider the case of k = 1. If n is odd, then sn = 2. Let si = 0 for i ≥ t + 1,
and t = n/2. Let us consider two cases. The first one is si = 1 for all i ∈ {1, . . . , t}. The
second case is si = 1 for all i ∈ {1, . . . , t}\{i1 } and si1 = 0 for some i1 ∈ {1, . . . , t}. In
the first case, the answer is 1. In the second case, the answer is 0. Therefore, solving the
problem for this instance is equivalent to the search for 0 among the first t = n/2 = nk/2
variables.
Let us show that the problem is at least as hard as the d-distinctness problem [47]. Let
d be such that 4d 1
= ε/2. Let b be the maximal integer that satisfies n ≥ b · (d − 1) + 1. Let
u j be a binary representation of j for j ∈ {0, . . . , b}.
Assume that s1 = u1 for other strings. We have two cases:
• Case 1. The sequence s contains d − 1 copies of each u j , where j ≥ 1 and other strings
are u0 . Formally:
– #(u j ) = d − 1 for j ∈ {1, . . . , b};
– #( u0 ) = n − b · ( d − 1).
47
Mathematics 2022, 10, 377
Theorem 6. Any randomized algorithm for the Most Frequent String Search problem has Θ(nk)
query complexity.
Proof. The best-known classical algorithm uses the radix sort algorithm and does steps
similar to the steps of the quantum algorithm.
The running time of this algorithm is O(nk). At the same time, we can show that it is
also a lower bound.
As it was shown in the proof of Theorem 5, the problem is at least as hard as the
unstructured search problem among nk/2 variables. It is known [14] that the randomized
complexity of the unstructured search among nk/2 variables is Ω(nk ).
Algorithm 3 The Quantum Algorithm for Intersection of Two Sequences of Strings Problem
using sorting algorithm.
ORDER ← S ORT _ STRINGS (s) We sort s = (s1 , . . . , sn ).
for i ∈ {1, . . . , m} do
ans ← B INARY _ SEARCH _ FOR _ STRINGS (ti , s, ORDER) We search ti in the ordered
sequence.
return ans
end for
48
Mathematics 2022, 10, 377
Theorem 7. Algorithm 3 solves Intersection of Two Sequences of Strings Problem with query
√ √
complexity O((n + m) k · log n · log(n + m)) = Õ((n + m) k ) and error probability O n+1 m .
The lower bound for the classical case can be proven using a result stated in [48]
(Lemma 7, Section 5.1).
Theorem 8. The randomized query complexity of Intersection of Two Sequences of Strings Problem
is Θ((n + m)k ).
Proof. Assume that n > m. Let us consider t1 = 0k , and si contains only 0 s and 1 s, i.e.,
sij ∈ {0, 1} for all i ∈ {1, . . . , n}, j ∈ {1, . . . , k }.
'
k
For checking si = t1 , it is enough to check ¬ (sij = 1) because this implies sij = 0
j =1
for all j ∈ {1, . . . , k }. In that case, checking for the existence of t1 among si is the same as
checking the following condition:
(
n )
k
¬ (sij = 1)
i =1 j =1
This condition means that not all string si contains at least one 1.
'
k
The randomized complexity of computing ¬ (sij = 1) is the same as the complexity
j =1
of the unstructured search for 1 among k variables, which is Ω(k ). According to [48]
(Lemma 7, Section 5.1), the total complexity of the function is Ω(nk).
Assume that m > n. Let us consider si = 0k for all i ∈ {1, . . . , n}. The checking
j j
existence t j among s1 , . . . , sn is at least as hard as the search for 1 among t1 , . . . , tk that
requires Ω(k) queries. It is true for all j ∈ {1, . . . , m}. Therefore, the total randomized
complexity is Ω(mk ).
Hence, if we join both cases, the randomized complexity of solving the problem is
Ω(max (n, m) · k ) = Ω((n + m) · k ).
This complexity O((n + m)k ) can be reached if we use the radix sort algorithm and
perform the same operations as in the quantum algorithm.
Note that we can use the quantum algorithm for element distinctness [49,50] for
this problem. The algorithm solves the problem of finding two identical elements in the
sequence. The query complexity of the algorithm is O( D2/3 ), where D is the number of
elements in the sequence. The complexity is tight because of [51]. The algorithm can be the
following. On j-th request, we can add the string t j to the sequence s1 , . . . , sn and invoke the
element distinctness algorithm that finds a collision of t j with other strings. Such approach
49
Mathematics 2022, 10, 377
√ √
requires Ω(n2/3 k ) queries for each request and Ω(mn2/3 k ) for processing all requests.
Note that the online nature of requests does not allow us to access all t1 , . . . , tm . Thus, each
request should be processed separately.
In a case of n m, we can use √the Grover search algorithm for searching t among
j
7. Conclusions
In the paper, we propose a quantum algorithm for a comparison of strings and a
general idea for any algorithm that does A string comparison operations. Then, using these
results, we construct a quantum strings sorting algorithm that works faster than the radix
sort algorithm, which is the best known deterministic algorithm for sorting a sequence of
strings.
We propose quantum algorithms for two problems using the sorting algorithm: the
Most Frequent String Search and Intersection of Two String Sequences. These quantum
algorithms are more efficient√ than classical (deterministic or randomized) counterparts
in a case of log2 (n) = o ( k), where k is the length of strings and n is the number of
strings. In a case of the Intersection
√ of Two String Sequences problem, the condition is
log2 (n)(log2 m + log2 log2 n) = o ( k ), where n and m are the number of strings in two
sequences. Note that these assumptions are reasonable.
We discussed quantum and classical lower bounds for these problems. Classical
lower bounds are tight, and at the same time, there is room to improve the quantum
lower bounds.
Author Contributions: The main idea and algorithms, K.K. and A.I.; lower bounds, J.V. and K.K.;
constructions and concepts, K.K., A.I. and J.V. All authors have read and agreed to the published
version of the manuscript.
Funding: This paper has been supported by the Kazan Federal University Strategic Academic
Leadership Program (“PRIORITY-2030”). J.V. Supported by the ERDF project 1.1.1.5/18/A/020
“Quantum algorithms: from complexity theory to experiment”.
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Acknowledgments: We thank Aliya Khadieva, Farid Ablayev, Kazan Federal University quantum
group and Krišjānis Prūsis from the University of Latvia for useful discussions.
Conflicts of Interest: The authors declare no conflict of interest. The funders had no role in the design
of the study; in the collection, analyses or interpretation of data; in the writing of the manuscript; or
in the decision to publish the results.
References
1. Nielsen, M.A.; Chuang, I.L. Quantum Computation and Quantum Information; Cambridge University Press: Cambridge, UK, 2010.
2. Ambainis, A. Understanding Quantum Algorithms via Query Complexity. In Proceedings of the International Congress of
Mathematicians, Rio de Janeiro, Brazil, 1–9 August 2018; Volume 4, pp. 3283–3304.
3. Ablayev, F.; Ablayev, M.; Huang, J.Z.; Khadiev, K.; Salikhova, N.; Wu, D. On quantum methods for machine learning problems
part I: Quantum tools. Big Data Min. Anal. 2019, 3, 41–55. [CrossRef]
4. de Wolf, R. Quantum Computing and Communication Complexity; Institute for Logic, Language and Computation: Amsterdam,
The Netherlands, 2001.
5. Jordan, S. Quantum Algorithms Zoo. 2021. Available online: http://quantumalgorithmzoo.org/ (accessed on 12 November 2021).
6. Khadiev, K.; Safina, L. Quantum Algorithm for Dynamic Programming Approach for DAGs. Applications for Zhegalkin
Polynomial Evaluation and Some Problems on DAGs. In Proceedings of the UCNC, Tokyo, Japan, 3–7 June 2019; LNCS: Cham,
Switzerland, 2019; Volume 4362, pp. 150–163.
7. Khadiev, K.; Kravchenko, D.; Serov, D. On the Quantum and Classical Complexity of Solving Subtraction Games. In Proceedings
of the CSR 2019, Novosibirsk, Russia, 1–5 July 2019; LNCS: Cham, Switzerland, 2019; Volume 11532, pp. 228–236.
50
Mathematics 2022, 10, 377
8. Khadiev, K.; Mannapov, I.; Safina, L. The Quantum Version Of Classification Decision Tree Constructing Algorithm C5. 0. In
Proceedings of the CEUR Workshop Proceedings, Como, Italy, 9–11 September 2019; Volume 2500.
9. Kravchenko, D.; Khadiev, K.; Serov, D.; Kapralov, R. Quantum-over-Classical Advantage in Solving Multiplayer Games. Lect.
Notes Comput. Sci. 2020, 12448, 83–98.
10. Khadiev, K.; Mannapov, I.; Safina, L. Classical and Quantum Improvements of Generic Decision Tree Constructing Algorithm for
Classification Problem. CEUR Workshop Proc. 2021, 2842, 83–93.
11. Glos, A.; Nahimovs, N.; Balakirev, K.; Khadiev, K. Upper bounds on the probability of finding marked connected components
using quantum walks. Quantum Inf. Process. 2021, 20, 6. [CrossRef]
12. Khadiev, K.; Safina, L. The quantum version of random forest model for binary classification problem. CEUR Workshop Proc.
2021, 2842, 30–35.
13. Montanaro, A. Quantum pattern matching fast on average. Algorithmica 2017, 77, 16–39. [CrossRef]
14. Bennett, C.H.; Bernstein, E.; Brassard, G.; Vazirani, U. Strengths and weaknesses of quantum computing. SIAM J. Comput. 1997,
26, 1510–1523. [CrossRef]
√ √
15. Ramesh, H.; Vinay, V. String matching in O( n + m) quantum time. J. Discret. Algorithms 2003, 1, 103–110. [CrossRef]
16. Ambainis, A.; Balodis, K.; Iraids, J.; Khadiev, K.; Kl, evickis, V.; Prūsis, K.; Shen, Y.; Smotrovs, J.; Vihrovs, J. Quantum Lower
and Upper Bounds for 2D-Grid and Dyck Language. In Proceedings of the 45th International Symposium on Mathematical
Foundations of Computer Science (MFCS 2020), Prague, Czech Republic, 25–26 August 2020; Volume 170, pp. 8:1–8:14.
17. Khadiev, K.; Remidovskii, V. Classical and quantum algorithms for constructing text from dictionary problem. Nat. Comput.
2021, 20, 713–724. [CrossRef]
18. Khadiev, K.; Remidovskii, V. Classical and Quantum Algorithms for Assembling a Text from a Dictionary. Nonlinear Phenom.
Complex Syst. 2021, 24, 207–221. [CrossRef]
19. Khadiev, K.; Kravchenko, D. Quantum Algorithm for Dyck Language with Multiple Types of Brackets. In Proceedings of
Unconventional Computation and Natural Computation (UCNC 2021), Espoo, Finland, 18–22 October 2021; LNCS: Cham,
Switzerland, 2021; Volume 12984, pp. 68–83.
20. Gall, F.L.; Seddighin, S. Quantum Meets Fine-grained Complexity: Sublinear Time Quantum Algorithms for String Problems.
arXiv 2020, arXiv:2010.12122.
21. Akmal, S.; Jin, C. Near-Optimal Quantum Algorithms for String Problems. arXiv 2021, arXiv:2110.09696.
22. Ablayev, F.; Ablayev, M.; Khadiev, K.; Salihova, N.; Vasiliev, A. Quantum Algorithms for String Processing. arXiv 2020,
arXiv:2012.00372.
23. Kothari, R. An optimal quantum algorithm for the oracle identification problem. In Proceedings of the 31st International
Symposium on Theoretical Aspects of Computer Science, Lyon, France, 5–8 March 2014; p. 482.
24. Lin, C.Y.Y.; Lin, H.H. Upper Bounds on Quantum Query Complexity Inspired by the Elitzur-Vaidman Bomb Tester. In
Proceedings of the 30th Conference on Computational Complexity (CCC 2015), Portland, OR, USA, 17–19 June 2015; Schloss
Dagstuhl-Leibniz-Zentrum fuer Informatik: Dagstuhl, Germany, 2015.
25. Lin, C.Y.Y.; Lin, H.H. Upper Bounds on Quantum Query Complexity Inspired by the Elitzur–Vaidman Bomb Tester. Theory
Comput. 2016, 12, 1–35. [CrossRef]
26. Kapralov, R.; Khadiev, K.; Mokut, J.; Shen, Y.; Yagafarov, M. Fast Classical and Quantum Algorithms for Online k-server Problem
on Trees. CEUR Workshop Proc. 2022, 3072, 287–301.
27. Grover, L.K. A fast quantum mechanical algorithm for database search. In Proceedings of the Twenty-Eighth Annual ACM
Symposium on Theory of Computing, Philadelphia, PA, USA, 22–24 May 1996; ACM: New York, NY, USA, 1996; pp. 212–219.
28. Boyer, M.; Brassard, G.; Høyer, P.; Tapp, A. Tight bounds on quantum searching. Fortschritte Phys. 1998, 46, 493–505. [CrossRef]
29. Long, G.L. Grover algorithm with zero theoretical failure rate. Phys. Rev. A 2001, 64, 022307. [CrossRef]
30. Høyer, P.; Neerbek, J.; Shi, Y. Quantum complexities of ordered searching, sorting, and element distinctness. Algorithmica 2002,
34, 429–448.
31. Odeh, A.; Elleithy, K.; Almasri, M.; Alajlan, A. Sorting N elements using quantum entanglement sets. In Proceedings of the Third
International Conference on Innovative Computing Technology (INTECH 2013), London, UK, 29–31 August 2013; pp. 213–216.
32. Odeh, A.; Abdelfattah, E. Quantum sort algorithm based on entanglement qubits {00, 11}. In Proceedings of the 2016 IEEE Long
Island Systems, Applications and Technology Conference (LISAT), Farmingdale, NY, USA, 29–29 April 2016; pp. 1–5.
33. Klauck, H. Quantum time-space tradeoffs for sorting. In Proceedings of the Thirty-Fifth Annual ACM Symposium on Theory of
Computing, San Diego, CA, USA, 9–11 June 2003; ACM: New York, NY, USA, 2003; pp. 69–76.
34. Cormen, T.H.; Leiserson, C.E.; Rivest, R.L.; Stein, C. Introduction to Algorithms; MIT Press: Cambridge, UK, 2001.
35. Williams, J.W.J. Algorithm 232—Heapsort. Commun. ACM 1964, 7, 347–349.
36. Feige, U.; Raghavan, P.; Peleg, D.; Upfal, E. Computing with noisy information. SIAM J. Comput. 1994, 23, 1001–1018. [CrossRef]
37. Cormode, G.; Hadjieleftheriou, M. Finding frequent items in data streams. Proc. Vldb Endow. 2008, 1, 1530–1541. [CrossRef]
38. Muthukrishnan, S. Data streams: Algorithms and applications. Found. Trends Theor. Comput. Sci. 2005, 1, 117–236. [CrossRef]
39. Aggarwal, C.C. Data Streams: Models and Algorithms; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2007;
Volume 31.
40. Becchetti, L.; Chatzigiannakis, I.; Giannakopoulos, Y. Streaming techniques and data aggregation in networks of tiny artefacts.
Comput. Sci. Rev. 2011, 5, 27–46. [CrossRef]
51
Mathematics 2022, 10, 377
41. Boyar, J.; Larsen, K.S.; Maiti, A. The frequent items problem in online streaming under various performance measures. Int. J.
Found. Comput. Sci. 2015, 26, 413–439. [CrossRef]
42. De La Briandais, R. File searching using variable length keys. In Proceedings of the Papers Presented at the the Western Joint
Computer Conference, San Francisco, CA, USA, 3–5 March 1959; ACM: New York, NY, USA, 1959; pp. 295–298.
43. Black, P.E. Dictionary of Algorithms and Data Structures| NIST. 1998. Available online: http://www.nist.gov/dads (accessed on
12 November 2021).
44. Brass, P. Advanced Data Structures; Cambridge University Press: Cambridge, UK, 2008; Volume 193.
45. Knuth, D. Searching and Sorting, the Art of Computer Programming; Addison-Wesley: Reading, MA, USA, 1973; Volume 3.
46. Khadiev, K.; Ilikaev, A. Quantum Algorithms for the Most Frequently String Search, Intersection of Two String Sequences and
Sorting of Strings Problems. In Proceedings of the International Conference on Theory and Practice of Natural Computing,
Kingston, ON, Canada, 9–11 December 2019; pp. 234–245.
47. Mande, N.S.; Thaler, J.; Zhu, S. Improved Approximate Degree Bounds for k-Distinctness. In Proceedings of the 15th Conference
on the Theory of Quantum Computation, Communication and Cryptography (TQC 2020), Riga, Latvia, 9–12 June 2020; Schloss
Dagstuhl-Leibniz-Zentrum für Informatik: Dagstuhl, Germany, 2020.
48. Göös, M.; Jayram, T.; Pitassi, T.; Watson, T. Randomized communication vs. partition number. In Proceedings of the 44th
International Colloquium on Automata, Languages, and Programming (ICALP 2017), Warsaw, Poland, 10–14 July 2017; Schloss
Dagstuhl-Leibniz-Zentrum fuer Informatik: Dagstuhl, Germany, 2017.
49. Ambainis, A. Quantum walk algorithm for element distinctness. SIAM J. Comput. 2007, 37, 210–239. [CrossRef]
50. Ambainis, A. Quantum Walk Algorithm for Element Distinctness. In Proceedings of the 45th Annual IEEE Symposium on
Foundations of Computer Science, FOCS ’04, Rome, Italy, 17–19 October 2004; pp. 22–31.
51. Aaronson, S.; Shi, Y. Quantum lower bounds for the collision and the element distinctness problems. J. ACM 2004, 51, 595–605.
[CrossRef]
52. Høyer, P.; Mosca, M.; de Wolf, R. Quantum Search on Bounded-Error Inputs. In Automata, Languages and Programming; Baeten,
J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J., Eds.; Springer: Berlin/Heidelberg, Germany, 2003; pp. 291–299.
53. Brassard, G.; Høyer, P.; Mosca, M.; Tapp, A. Quantum amplitude amplification and estimation. Contemp. Math. 2002, 305, 53–74.
52
mathematics
Article
GPS: A New TSP Formulation for Its Generalizations
Type QUBO
Saul Gonzalez-Bermejo 1 , Guillermo Alonso-Linaje 1 and Parfait Atchade-Adelomou 2,3, *
1 Facultad de Ciencias, Campus Miguel Delibes, Universidad de Valladolid, C/Plaza de Santa Cruz, 8,
47002 Valladolid, Spain; [email protected] (S.G.-B.);
[email protected] or [email protected] (G.A.-L.)
2 Research Group on Data Science for the Digital Society, La Salle, Universitat Ramon Llull,
Carrer de Sant Joan de La Salle, 42, 08022 Barcelona, Spain
3 Lighthouse Disruptive Innovation Group, LLC, 7 Broadway Terrace, Apt. 1, Cambridge, MA 02139, USA
* Correspondence: [email protected] or [email protected]
Keywords: quantum computing; quantum annealing; combinatorial optimization; QUBO; TSP; VRP
achieving good results through the solvers dedicated to it, especially if it is going to be
implemented on a quantum computer.
Quantum annealing is the paradigm of using quantum processes to solve combinato-
rial optimization problems. This paradigm uses entropy as a target to force exploration,
given that any function that smoothes the probability in the search space can have the same
purpose according to the adiabatic theorem [8,9].
The D-Wave Quantum Processor Unit (QPU) is considered as a heuristic that mini-
mizes the objective QUBO functions using a physically performed version of quantum
annealing; this shows how the number of variables in the QUBO model is related to the
number of qubits in a quantum computer [10].
The VRP encompasses two different problems: one in which the distance travelled by
vehicles subject to capacity restrictions is minimized [11–14] and another, in which the time
taken for cars to complete their routes is minimized. In this article, everything related to
the VRP will optimize the time to complete these routes, equivalent to reducing the total of
the distances travelled by all vehicles.
As we will explain later in the section dedicated to the VRP, to generalise a QUBO
formulation from the TSP to the VRP, the objective function for calculating the distance
travelled by the vehicles must be linear so that the formulation discussed above with N 2
variables cannot be used.
The most widely used QUBO model of the TSP that can represent distance linearly uses
more than N 3 variables (native TSP formulation). However, there is indeed a formulation
that uses N 2 log2 ( N ) variables; this formulation is known as MTZ [15]. But generalising
the MTZ formulation for the VRPs that minimises the maximum distances travelled by all
the vehicles give us quadratic restrictions and, therefore, a penalty function of the order
greater than two.
Our purpose in this work is to present a new QUBO model of the TSP in which
the travelled distance calculation is linear, and uses only 3N 2 variables, considerably
improving the existing TSP models (both of N 3 and N 2 log2 ( N ) variables). Furthermore,
this new formulation of the TSP we refer to as GPS will be generalized to define an
efficient formulation which consider the number of variables of a new VRP formulation.
Unfortunately, after reviewing state of the art, we have not found a QUBO formulation of
the VRP that minimises the maximum of the distances travelled by all the vehicles, thus we
have not been able to make comparisons. When we talk about the number of variables in a
model, we will describe it according to its dominant term, so for a model that, for example,
requires N 3 + 3N 2 + 2N variables, we will say that it is modelling with N 3 variables since
it gives us enough information on its scalability.
The document is organised as follows. Section 2 presents our main motivation be-
hind this work. Section 3 shows previous work on the TSP algorithm and its derivatives.
Section 4 presents the QUBO framework and its connection to quantum annealing. In
Section 5, we recall the native formulation of TSP and the MTZ QUBO model. Section 6
presents our TSP proposal with the improvements in the numbers of variables. A generali-
sation of our contribution is seen in Section 7 where we propose our VRP into the QUBO
model. Section 8 presents the obtained results, and finally, Section 9 concludes the work
carried out, and we open ourselves to some lines of the future of the proposed model.
2. Motivation
Our primary motivation is to find a suitable formulation that uses the minimum
number of variables; and thus, the minimum number of qubits when implementing said
models in quantum computers. This motivation is increased by solving the problem
presented in our article [14] in which we desire that the mobile robots minimise the time,
which is equivalent to reducing the maximum of the distances travelled by all the vehicles.
What implies reducing the number of qubits necessary to implement this model in this era
of very few qubits.
54
Mathematics 2022, 10, 416
3. Related Work
In the mid-1920s, the following referenced articles [16,17], were the first articles to
provide a solution to the minimal spanning tree (MST) problem. Based on these works, the
mathematical researcher, Joseph B. Kruskal Jr, applied these solutions to the TSP [18], giving
life to some of the first solutions to this problem that will arise during the next decades.
Towards the end of the sixties, the following article [19] offered a compilation and
synthesis of the research on the travelling salesman problem. The authors began by defining
the problem and presenting several relevant theorems. They also classified and detailed
the solution techniques and computational results. Before that, in the mid-1960s, the TSP
started to emerge in many different contexts. The following article [20] highlights some
applications that began to occur in everyday life, such as vehicle routing or job shop
scheduling problems. Other applications such as planning, logistics and the manufacture
of electronic circuits became of particular interest.
By making a few small modifications to the original TSP, we could apply it in many
fields such as SWP [21] and DNA sequencing [22,23] among others. In this last application,
the concept of ‘city’ would come to be fragments of DNA and the idea of ‘distance’, a mea-
sure of similarity between the pieces of DNA. In many applications, additional restrictions
such as resource limits or time windows make the problem considerably difficult.
Computationally, the TSP [24] is an NP-Hard problem within combinatorial optimiza-
tion. As an NP-Hard problem, it is computationally complex, and heuristics are continually
being developed to get as close as possible to the optimal solution. However, considering
the computational complexity nature of these problems, the new approach that quantum
computing takes is very promising.
Many works are related to the standard/native TSP or some related variant in a
quantum environment within this new approach. For example, the referenced work [25],
the authors introduced a different quantum annealing scheme based on a path-integral
Monte Carlo process to address the symmetric version of the Travelling Salesman Problem
(sTSP). In these other articles [26,27], the authors did a comparative study using the D-
Wave platform to evaluate and compare the efficiency of quantum annealing with classical
methods for solving standard TSP.
In this reference [28], several comparisons of heuristic techniques were made for
some TSP Libraries (TSPLIB) [29] problems, both symmetric and asymmetric, and their
results have been compared to other methods such as Self Organizing Maps and Simulated
Annealing [30]. In both cases, the local search technique was applied to the results found
with Wang’s Recurrent Neural Network with “Winner Takes All” that improved the Self
Organizing Maps [31]. Other techniques such as the co-adaptive neural network approach
to the Euclidean Travelling Salesman Problem [32] equally important.
One of the generalizations of the TSP, known as the VRP, was studied on the D-Wave
platform [33,34]. In tasks where routing and planning capacity (time) was required, the TSP
with time windows (TSPTW) was generalized [35,36], and has high inherent complexity
which presents enormous resolution difficulties. In the following references [21,37–39],
the authors modelled combinatorial optimisation problems in which social workers visit
their patients at their respective homes and attend to them at a specific time, called Social
Workers’ Problem (SWP). SWP is a significant problem because additional time constraints
allow more realistic scenarios to be modelled than native TSP. The optimal or near-optimal
solution for such issues is important in minimising distance and time and environmental
problems such as reducing fuel consumption.
The generalization of the TSP that we will use in our work will be the VRP. However,
there are other TSP derivatives, such as the Job Shop Scheduling Problem (JSSP) [40] that
are not included in the study of this work.
During state of the art of these formulations carried out, we have found several arti-
cles [33,34,41] that solve the TSP and VRP (focusing on minimising distance and not time)
for annealing computers [7,30,42]. However, the number of variables is still intractable for
the current size of quantum computers. For this reason, we propose a new TSP formulation
55
Mathematics 2022, 10, 416
with a representation of the linear distance that uses only 3N 2 variables, which we will use
to outperform the current best VRP modelling in terms of the number of required variables.
For example, a possible formulation of the VRP uses N 3 variables where N is the number of
cities, thus with only 10 towns, we would go to 1000 necessary variables. In quantum com-
puting, each of these variables can be represented with a qubit, and that is why computers
possessing 1000 qubits would be needed to carry out these tasks. However, the gate-based
computers that mark this era of quantum computing [43] have around 100 qubits making
this task intractable today. The number of qubits is higher for computers based on quantum
annealing, reaching 2000 qubits like the D-Wave computer. However, the correspondence
between variables and qubits will not be one-to-one due to the architecture of these com-
puters, so that we will have a smaller number of useful qubits. The following reference [44]
deals with the topology and graph problem mapping on the D-Wave 2000Q QPU computer
in detail.
x t Qx, (2)
with x ∈ {0, 1}n and Q ∈ Mn×n which is compactly representing the QUBO formulation.
QUBO can be mapped into the Ising model with the change variable: z = 1 − 2x. Thus, we
pass a binary variable (0, 1) to a spin variable (−1, 1). Therefore, given a formulation of a
problem to the QUBO, we can implement it and solve it in computers based on quantum
gates, only applying the change of variable mentioned.
56
Mathematics 2022, 10, 416
5. TSP Formulation
As discussed in the introduction, before presenting our GPS model in section four, we
will analyze the native TSP model and the MTZ that we aim to improve in terms of the
number of variables.
where du,v represents the distance between nodes u and v. This objective function is subject
to a series of restrictions:
• Constraint 1. The salesman must leave each city once.
N +1 N
For each u ∈ {0, . . . , N }: ∑ ∑ xu,v,t = 1. (4)
v =1 t =0
N N
For each v ∈ {1, .., N + 1}: ∑ ∑ xu,v,t = 1. (5)
u =0 t =0
• Constraint 3. If the salesman leaves a city, he cannot return to it later. This constraint
ensures that no unconnected cycles are formed as a solution. There are two ways of
posing this constraint.
– Imposing that once he leaves a city he cannot return to it.
For each u ∈ {1, . . . , N + 1}:
N +1 N N +1 N
∑ ∑ ∑ ∑ xu,v,t xw,u,j = 0. (6)
v =0 t =0 w =0 j = t +1
N +1
xu,v,t (1 − ∑ xv,w,t+1 ) = 0. (7)
w =1
This formulation requires N 3 variables. Next, we will analyse another model used to
define the TSP which is less commonly used in quantum annealing articles.
57
Mathematics 2022, 10, 416
expressed in binary format, will take the integer value t if the city i is reached in the tth
position.). This model requires N 2 log2 ( N ), greatly improving the number of variables in the
general formulation. However, when implemented using annealing it presents surprisingly
inaccurate results. This is because the annealing algorithm gets stuck trying to minimise
the part of the objective function generated by the sub-tour’s constraint [15], since the
representation of integers in their binary format has the disadvantage that close numbers
such as 2n − 1 and 2n differ by a large number of qubits, so from the annealing they are
perceived as very different solutions.
Once the two most common QUBO models of the TSP have been presented, let us ana-
lyze the formulation with which we improve the number of variables of the previous two.
6. GPS Formulation
Now we are starting to present our work. To develop this model, we take the variables
xi,j,r with i, j ∈ {0, . . . , N + 1} and r ∈ {0, 1, 2}. In all the modelling, the variables xi,j,r such
that i = j are not considered. We work with directional edges, that is, if in the model the
edge (i, j) appears, we understand that first we must go through node i and immediately
after that we go to j. Let us analyse what each variable represents:
• xi,j,0 = 1 means that the edge (i, j) does not appear in the path and the node i is
reached earlier than the j.
• xi,j,1 = 1 means that the edge (i, j) appears in the path, so the node i is reached earlier
than the j.
• xi,j,2 = 1 means that the edge (i, j) does not appear in the path, and the node j is
reached earlier than the i.
Let us, therefore, see some examples (Figure 1) in which these variables do not take
the value zero:
Figure 1. Example of a TSP solution with six different cities. It begins at node 0, and the arrows
indicate the order in which the towns will be visited.
In this particular case, x4,5,0 = 0 and x4,5,2 = 0 since the edge (4, 5) does appear in the
solution. On the other hand x4,5,1 will also be 0 because although edge (4, 5) does appear
in the graph, node 5 will be visited before node 4.
Let us, therefore, see examples in which these variables do not take the value zero:
• x5,1,1 = 1: in this case it will take the value 1 since edge (5, 1) appears in the solution
and node 5 is visited first.
• x4,1,2 = 1: because in the solution we don’t have the connection (4, 1), we have the
connection (1, 4) and the node 4 is visited later node 1.
• x5,3,2 = 1: since the edge (3, 5) does not appear and node 3 is visited first.
From the definition of our variables, we can define the distance travelled through the
following objective function as:
N +1 N +1
∑ ∑ di,j xi,j,1 . (8)
i =0 j =0
58
Mathematics 2022, 10, 416
2
For all i, j: ∑ xi,j,r = 1. (9)
r =0
N +1
For each i ∈ {0, . . . , N }: ∑ xi,j,1 = 1. (10)
j =0
N
For each j ∈ {1, . . . , N + 1}: ∑ xi,j,1 = 1. (11)
i =0
• Constraint 4: If node i is reached before j, then node j is reached after i, so, for all i, j ∈
{0, . . . , N + 1} such that i = j:
With only the cases in which i = j, i = k and j = k will be taken in the summation and
in the annex (Appendix B) we will provide the approach followed to arrive at it.
The following is deduced from the Equation (13). We have xi,j,2 = 0 if i is reached
before j and xi,j,2 = 1 in the case where j is reached before i. Thus, with the previous
equation we penalise these following cases in which xi,j,2 = 0, x j,k,2 = 0 and xi,k,2 = 1 and
xi,j,2 = 1, x j,k,2 = 1 and xi,k,2 = 0 which lead to cases in which it would be forming cycles
(for these two situations the value of the parentheses is 1 and for the rest 0). In (27) we have
a similar situation for our VRP formulation, where we offer more details. For this condition,
we must have directly constructed a penalty function that avoids erroneous cases without
first posing linear conditions through which to generate its corresponding penalty function.
Formulated in this way we have managed to reduce the number of variables required
from N 2 log2 N to 3N 2 , achieving very noticeable reductions when working with large
problems. Once we have this formulation, let us see how we can generalise it to the new
VRP formulation.
59
Mathematics 2022, 10, 416
Original Formulation 5N 2 Q
For this new VRP, we will consider that N is the number of cities and Q is the number
of available vehicles. We first present the variables that will form the problem. We then
take the following set of variables.
In all the modelling, the variables xi,j,r such that i = j are not considered. The variables
i, j refer to the cities must travel to, and the variable q refers to the vehicle. The nodes 0
and N + 1 correspond to the starting and ending points. Note that they may be the same
node but we will separate them for convenience in the formulation. The values di,j with
i, j ∈ {0, . . . , N + 1} correspond to the distance between node i and j. Let us dive into the
interpretation of each variable:
• xi,j,0,q = 1 means that the vehicle q travels to the cities i and j, does not travel across
the edge (i, j) and arrives at the city i before the j.
• xi,j,1,q = 1 means that the vehicle q travels to the cities i and j travels across the edge
(i, j) (that is, once it passes through the city i the next city it reaches is the j) and
therefore the city i is reached earlier than the city j.
• xi,j,2,q = 1 means that the vehicle q travels through the cities i and j and arrives at the
city j earlier than at the city i.
• xi,j,3,q = 1 means that the vehicle q does not go through the cities i and j, and the city
i is reached earlier than the city j. Note that xi,j,3,q can take the value 1 whether the
vehicle q passes through one of both cities or neither of them.
• xi,j,4,q = 1 means that the vehicle q does not travel to the cities i and j, and the city j is
reached earlier than the city i.
Even if no vehicle passes through the objects i and j, the formulation must establish an
order between them. However, this restriction does not make the modelling meaningless,
since we can assume that if the vehicles are ordered in the order of {1, . . . , Q}, then i will
be reached before j if the vehicle that passes through node i has a lower number than the
one that passes through node j. Once the interpretation of each variable is explained, let us
analyse the constraints that must be met.
• Constraint 1: For each i, j, q, one and only one of the possibilities must be met for r, so:
4
For all i, j, q: ∑ xi,j,r,q = 1, (15)
r =0
• Constraint 2: Each vehicle has to fulfill that it leaves the starting position. For this
situation, we are going to impose that:
N +1
For all q: ∑ x0,j,1,q = 1, (16)
j =1
N +1
For all q: ∑ xi,0,1,q = 0, (17)
i =0
• Constraint 3: Every vehicle must finish in the final position. For this, it must be
fulfilled that:
N
For all q: ∑ xi,N +1,1,q = 1, (18)
i =0
60
Mathematics 2022, 10, 416
N +1
For all q: ∑ x N +1,j,1,q = 0. (19)
j =0
Vehicles that do not travel on any road will meet all constraints when taking the fol-
lowing condition:
x0,N +1,1,q = 1.
• Constraint 4: The vehicle must leave once and only once from each city, then:
Q N +1
For each i ∈ {1, . . . , N }: ∑ ∑ xi,j,1,q = 1. (20)
q =1 j =1
• Constraint 5: The vehicle must arrive once and only once to each city, then:
Q N
For each j ∈ {1, . . . , N }: ∑ ∑ xi,j,1,q = 1. (21)
q =1 i =0
• Constraint 6: The city i is reached before the city j does not depend on each vehicle.
Therefore, for all the vehicles that either arrive at city i earlier than j, or arrive at city j
earlier than i. Introducing the auxiliary variables ai,j , we have the following constraint.
For all i, j ∈ {1, . . . , N }:
Q
∑ xi,j,0,q + xi,j,1,q + xi,j,3,q = ai,j Q. (22)
q =1
It will then be true that for each i, j or ai,j = 1, which means that the city i is reached
earlier than the city j and therefore for each q we will have xi,j,r,q = 1 for any value of
the r in which i is reached before j, or ai,j = 0, and we will have xi,j,r,q = 0 for all the
vehicles and for values r where i is reached before j.
• Constraint 7: If the vehicle q arrives in the city j, then the vehicle q must leave the
city j. For this we impose the constraint that for i ∈ {0, . . . , N }, j ∈ {1, . . . , N } and
q ∈ {1, . . . , Q}:
N +1
xi,j,1,q (1 − ∑ x j,k,1,q ) = 0. (23)
k =1
Let us now impose the conditions that make vehicles run on a tour.
• Constraint 8: It must be fulfilled that either the vehicle pass through the city i before
the j or arrive before to the city j rather than the city i. Therefore, it must be verified
that, for i ∈ {0, . . . , N }, j ∈ {1, . . . , N } and q ∈ {1, . . . , Q}:
• Constraint 9: If city i is reached before j and city j is reached before city k, then city i
must be reached before city k. This condition will prevent the vehicle from returning
to a city it has already passed through and therefore prevents a cycle from forming.
To introduce this constraint, we will directly calculate a penalty function worth 0 in
the correct cases and 1 in those that are not. To facilitate the understanding of the
penalty function, we are going to take, for i, j, k, q, the following variables:
61
Mathematics 2022, 10, 416
Remember that it is not necessary to introduce these conditions because the constraint
(22) establishes the correct values of the variables ai,j . Therefore, ai,j = 1 means that the
city i is reached before the city j and the same with j and k. Also, it is very important
to remember that due to the same constraint (22), we can take any of the vehicles as a
reference. In this case, we have taken the first vehicle as a reference.
In this way, fixed i, j, k, we have the 3 variables ai,j , a j,k , ai,k . Remember that ai,j , a j,k , ai,k
only take the values 0 or 1. Also, let us note that the cases that lead to values of the variables
for which cycles can be formed and that we must discard are ( ai,j , a j,k , ai,k ) = (0, 0, 1)
and ( ai,j , a j,k , ai,k ) = (1, 1, 0).
In the case (0, 0, 1) we would have that the city j is reached after the i, the k after the j,
and yet the city k is reached rather than i, which is absurd. The case (1, 1, 0) cannot be
given either, since it reaches i before j and j before k, so it cannot be that we also reach
k before i. We therefore must construct a penalty function so that for f ( ai,j , a j,k , ai,k )
it holds that f (0, 0, 1) > 0, f (1, 1, 0) > 0 y f ( ai,j , a j,k , ai,k ) = 0 for all other cases. A
function that satisfies these conditions is from the Equation (26).
f ( ai,j , a j,k , ai,k ) := ai,j a j,k − ai,j ai,k − a j,k ai,k + a2i,k . (26)
then, adding to the cost function the Equation (27)
N N N
λ∑ ∑ ∑ (ai,j a j,k − ai,j ai,k − a j,k ai,k + a2i,k ), (27)
i =1 j =1 k =1
we will have that the best solutions will be those that comply with this constraint.
• Constraint 10: The objective we seek is to minimise vehicle travel time. What we could
do is see how long each vehicle takes to complete the route and try to minimise as
much of the time as possible. However, this function soon becomes complex so we
have decided to develop a different idea that simplifies the process and smoothes the
objective function. If we impose the condition that all vehicles travel less distance
than the distance travelled by vehicle number 1, we will have that minimising the
maximum of the distances will be equivalent to minimising the distance travelled by
the first vehicle. We then have the following condition. For each q ∈ {2, . . . , Q}:
N +1 N +1 N +1 N +1
∑ ∑ di,j xi,j,1,q ≤ ∑ ∑ di,j xi,j,1,1 . (28)
i =0 j =0 i =0 j =0
We transform this inequality into equality by taking once again Dmax := ∑in=0 max j {di,j }
and the variables bh,q (the variables bh,q are like the sub tour’s one in the MTZ slack
variables and they are in their binary expression) in:
N +1 N +1 hmax N +1 N +1
∑ ∑ di,j xi,j,1,q + ∑ 2h bh,q − ∑ ∑ di,j xi,j,1,1 = 0. (29)
i =0 j =0 h =0 i =0 j =0
N +1 N +1
∑ ∑ di,j xi,j,1,1 . (30)
i =0 j =0
62
Mathematics 2022, 10, 416
This condition has the disadvantage that we are eliminating solutions where it is
another vehicle that travels the longest distance. Let us explore how to avoid this
problem and get more flexibility in the model to make it easier for the Quantum
Annealing to find the optimum one. We can establish an auxiliary variable D and we
set that the distance travelled by each vehicle must be less than this variable, that is
to say:
N +1 N +1
∑ ∑ di,j xi,j,1,q ≤ D , for all q ∈ {1, . . . , Q}. (31)
i =0 j =0
8. Results
To test the correct VRP model developed in QUBO, which minimises the maximum dis-
tance that all the vehicles travel, we will present some comparisons of the results obtained
through the simulator of the different models that have been discussed in this paper.
The code has been implemented on the Ocean library [49] from D-Wave in python.
The reader can find the code at [50].
Figure 2 offers a sample of our GPS formulation’s results when using the D-Wave
solver in different scenarios. We highlight some important cases that help us see the good
functioning of the algorithm.
Figure 3 offers a sample of our VRP formulation’s results based on the GPS when
using the D-Wave solver in different scenarios. We highlight some important cases that
help us see the good functioning of the algorithm. It is important to note that our algorithm
minimizes the maximum distance travelled by all the vehicles (this is equivalent to reducing
the time spanned by all cars). It is worth mentioning that the number of the qubits needed
in the case N = 8 and Q = 3 is 1778. Where N is the number of cities and Q, the vehicles.
In the discussion section, we will analyze this point and its impact on the topology of the
QPU architecture and in this case of the D-Wave.
Let us observe in Tables 1–5 the comparison of the number of qubits, time during
which the D-Wave Quantum Annealing simulator has been executed, and the length of the
path found. The sign “-” represents that the algorithm did not find a possible way during
the elapsed time (in minutes). In this examples, the cities which form the TSP to solve are
the vertex of the regular polygon with these number of vertex.
63
Mathematics 2022, 10, 416
Figure 2. In these graphs, we can observe the algorithm’s results in different scenarios of the GPS
formulation. We can follow the correct scalability of the algorithm. We provide the code [50] to check
its proper functioning and to allow others to simulate lower values or values higher than N = 16.
Figure 3. In these graphs, we can observe the algorithm’s results in different scenarios of the VRP
formulation. We can follow the correct scalability of the algorithm. We provide the code [50] to verify
the proper functioning of the formulation. Vehicle number 1 is red, and the next is light-steel-blue.
While the depot is the 0 node in pale-green colour, and the rest are represented in light-steel-blue. In
this case, we have variables cities from 4 to 12 and using up to 2 vehicles. It is important to highlight
that this VRP minimises the time travelled by the cars. The number of qubits used is 2418 to test the
last case.
Table 1. A regular polygon layout has been taken where the cities occupy the positions of the
nodes [50] for the elaboration of all tables. In this scenario of 4 cities, we set comparison with the
3 models, MTZ, native TSP and GPS. The comparison is based on the number of times to find the
solution, the distance travelled, and the number of qubits. We can appreciate the good performance
of our GPS model, and above all the savings it offers us in the number of qubits.
64
Mathematics 2022, 10, 416
Table 2. A regular polygon layout has been taken where the cities occupy the positions of the
nodes [50] for the elaboration of all tables. In this scenario of 6 cities, we set comparison with the
3 models, MTZ, native TSP and GPS. The comparison is based on the number of times to find the
solution, the distance travelled, and the number of qubits. We can appreciate the good performance
of our GPS model, and above all the savings it offers us in the number of qubits.
Table 3. A regular polygon layout has been taken where the cities occupy the positions of the
nodes [50] for the elaboration of all tables. In this scenario of 8 cities, we set comparison with the
3 models, MTZ, native TSP and GPS. The comparison is based on the number of times to find the
solution, the distance travelled, and the number of qubits. We can appreciate the good performance
of our GPS model, and above all the savings it offers us in the number of qubits.
Table 4. A regular polygon layout has been taken where the cities occupy the positions of the
nodes [50] for the elaboration of all tables. In this scenario of 10 cities, we set comparison with the
3 models, MTZ, native TSP and GPS. The comparison is based on the number of times to find the
solution, the distance travelled, and the number of qubits. We can appreciate the good performance
of our GPS model, and above all the savings it offers us in the number of qubits.
Table 5. A regular polygon layout has been taken where the cities occupy the positions of the
nodes [50] for the elaboration of all tables. In this scenario of 12 cities, we set comparison with the
3 models, MTZ, native TSP and GPS. The comparison is based on the number of times to find the
solution, the distance travelled, and the number of qubits.
These results have been obtained using a simulator because we would require access to
a quantum computer for a time similar to that needed to perform the simulations (in some
cases more than an hour). However, it is the benefits of modelling with few qubits (such as
GPS modelling) that will be much more notable when these problems are implemented on
real quantum computers. Other studies that did not require many hours of the quantum
computer were carried out on the D-Wave_2000Q_6. In the discussion section, we detail
some interesting cases.
Discussion
Once the different models had been implemented, we achieved the following results.
Through the results of the Figures 4–7 and Tables 1–5, the good performance of our formu-
65
Mathematics 2022, 10, 416
lation compared to the general TSP [41] can be observed. An almost identical operation is
seen with the generic TSP, except that we are improving at least the number of qubits for
the same cases in our proposal. Although the time difference is not significant again, the
difference between path lengths is. Let us remember that the advantage of the formulation
in which we have worked is based on improving the number of qubits used. We then
have that the larger the problems we are working on, the better this difference will be
appreciated in the number of variables.
The MTZ model does not offer positive results. This is since Annealing presents many
difficulties to find minimum expressions in which the representation of integers appears
in their binary format. This is because although the numbers 2k − 1 and 2k are close, they
are not close in their binary form since they differ in k variables, so the annealing tends
to present bad results. Apart from that adjusting, the Lagrange coefficient of this type of
constraint is also a complicated task.
Native TSP and GPS modelling show better results. While it is true that general
modelling gives slightly better results, it requires the use of a higher number of qubits. This
may be since the function to be optimised for this model has a smaller number of local
minima where the Annealing can get stuck or there can be a bad of the Lagrange coefficients.
The problem on which the simulations are carried out consists in finding the optimal
path when the points are placed on the vertices of the regular polygons that have the same
number of vertices as nodes in our problem.
Figure 4. Path length comparison for N = 9. In this graph, we see how the length of the solution
paths for the case of 9 Cities is very similar so that both models give good results.
Figure 5. Time comparison for N = 9. This graph shows the time taken to carry out the executions in
the case of 9 cities. Although it seems that there is a lot of difference, it only represents 10% of the
total time, which, as we have seen in other experiences, is not significant.
66
Mathematics 2022, 10, 416
Figure 6. Path length comparison for N = 11. For the example of 11 cities, we can observe that
the outcomes are quite similar. Although the time difference is not significant again, the difference
between path lengths is. Let us remember that the advantage of the modelling we have worked is
based on improving the number of qubits used. We then have that the larger the problems we are
working on, the better that difference will be appreciated in the number of variables.
Figure 7. Time comparison for N = 11. For the example of 11 cities, we can observe that the outcomes
are quite similar because although there is a mean difference of about 20 s between the results of both
simulations, the experience with this problem and other similar ones is that this very small difference
does not affect the results on the length of the solution path.
One of the behaviours and results that we believe is important to mention is the
following. We realized that it is even more important to consider the number of edges
that our model generates. The vertex/connections in a quantum computer are limited and
define our quantum computer’s typology and quality for error mitigation. Thus, a model
that produces many edges (direct links) may request more from a computer than another
which generates fewer. The Figure 8 offers us a comparative study between our GPS
model and the native TSP. This figure shows the exponential behaviour and the number of
interconnections that each model offers. Our model improves the number of qubits and
gives us a great result reducing the number of connections a lot. The native TSP behaves as
0.8( N + 2)5 while the GPS as 2( N + 2)3 .
One aspect of GPS worth commenting on here is to generalize it also to be used for the
Cutting-plane method. We must change the current constraint (13) since this methodology
only works with linear constraints. The way to do this is as follows. For each i, j, k:
• x j,i,2 + xk,j,2 ≤ 2xk,i,2 + wi,j,k
1
p
In these equations, the variables wi,j,k are auxiliaries. The purpose of these vari-
ables is to satisfy the said constrains. These two restrictions are satisfied by all cases of
( x j,i,2 , xk,j,2 , xk,i,2 ) except for (0, 0, 1) (because it doesn’t satisfy the second constraint) and
(1, 1, 0) (because it doesn’t satisfy the first constraint).
67
Mathematics 2022, 10, 416
Figure 8. In this figure we can appreciate the exponential behaviour and the number of interconnec-
tions that each model offers. Our model (GPS) improves the number of qubits and gives us a great
result reducing the number of connections a lot. The Native_TSP behaves as 0.8( N + 2)5 while the
GPS as 2( N + 2)3 .
Figure 9. Comparison of the different models based on the number of qubits. This graph shows the
behaviour and evolution of the numbers of qubits for each model. We see the best performance of
our GPS model compared to the other models.
68
Mathematics 2022, 10, 416
Figure 10. Benchmark between MTZ and GPS model based on the number of qubits. We can
appreciate that for 30 cities, GPS model needs 2700 qubits while the MTZ 4458.
The results obtained from our VRP formulation and all the experiments carried out
maintain the number of variables QN 2 and allow us to offer the community new formula-
tions that minimise the time it takes for vehicles to travel.
Future work will apply the ideas developed in the QUBO model of these problems to
similar ones. In particular, we will look for other variants of the TSP to use the modelling
of this that we have carried out.
Author Contributions: Conceptualization, P.A.-A.; Methodology, P.A.-A. and S.G.-B. and G.A.-
L.; Software, S.G.-B. and P.A.-A. and G.A.-L.; Validation, P.A.-A. and S.G.-B. and G.A.-L.; Formal
Analysis, S.G.-B. and P.A.-A. and G.A.-L.; Investigation, S.G.-B. and P.A.-A.; Resources, P.A.-A.; Data
Curation, P.A.-A.; Writing—Original Draft Preparation, S.G.-B. and P.A.-A.; Writing—Review and
Editing, P.A.-A. and G.A.-L. and S.G.-B.; Visualization, P.A.-A. and G.A.-L. and S.G.-B.; Supervision,
P.A.-A.; Project Administration, P.A.-A. All authors have read and agreed to the published version of
the manuscript.
Funding: This research received no external funding.
Institutional Review Board Statement: This article does not contain any studies with human or
animal subjects.
Informed Consent Statement: Informed consent was obtained from all individual participants
included in the study.
Data Availability Statement: Data sharing not applicable. No new dataset were created or analyzed
in this study. Data sharing is not applicable to this article.
Conflicts of Interest: The authors declare no conflict of interest.
Appendix A
Appendix A.1. TSP Formulation N 2
There is a TSP model that requires N 2 variables, where these are the following:
Under this formulation xi,t = 1 denotes that the city i is reached at position t. The
distance calculation function with this formulation is as follows
N +1 N +1 N
∑ ∑ ∑ di,j xi,t x j,t+1 , (A2)
i =0 j =0 t =0
where di,j represents the distance between the node i and the node j. This expression has
the problem that the distance formulation has terms of degree two and when trying to
generalize this idea to other types of problems such as the VRP it will become a 4 degree
constraint making use of a large number of auxiliary variables to convert it to QUBO
type format.
69
Mathematics 2022, 10, 416
2
For all i, j, q: ∑ xi,j,r,q = 1, (A3)
r =0
• Constraint 6: That the city i is reached before the city j does not depend on each vehicle.
Therefore, for all the vehicles that either arrive at city i earlier than j, or arrive at city j
earlier than i. Introducing the auxiliary variables ai,j , we have the following constraint.
For all i, j ∈ {1, . . . , N }:
Q
∑ xi,j,0,q + xi,j,1,q = ai,j Q. (A4)
q =1
• Constraint 8: It must be fulfilled that either the vehicle pass through the city i before
the j or arrive before to the city j than the i. Therefore, it must be verified that,
for i ∈ {0, . . . , N }, j ∈ {1, . . . , N } and q ∈ {1, . . . , Q}:
• Constraint 9: If the city i is reached before j and the city j is reached before the city
k, then the city i must be reached before the city k. This condition will prevent the
vehicle from returning to a city it has already passed through and therefore prevents a
cycle from forming.
N N N
λ∑ ∑ ∑ (ai,j a j,k − ai,j ai,k − a j,k ai,k + a2i,k ), (A6)
i =1 j =1 k =1
70
Mathematics 2022, 10, 416
ai,j = x, a j,k = y, ai,k = z to simplify the notation. Then, we arrive at the quadratic function
P, as is demonstrated in the following:
P( x, y, z) = c1 x2 + c2 xy + c3 xz + c4 y2 + c5 yz + c6 z2 . (A7)
P( ai,j , a j,k , ai,k ) = ai,j a j,k − ai,j ai,k − a j,k ai,k + a2i,k (A8)
References
1. Gavish, B.; Graves, S.C. The Travelling Salesman Problem and Related Problems; Operations Research Center, Massachusetts Institute
of Technology: Boston, MA, USA, 1978.
2. Hochba, D.S. Approximation algorithms for NP-hard problems. ACM Sigact News 1997, 28, 40–52. [CrossRef]
3. Lewis, M.; Glover, F. Quadratic unconstrained binary optimization problem preprocessing: Theory and empirical analysis.
Networks 2017, 70, 79–97. [CrossRef]
4. Cipra, B. An introduction to the Ising model. Am. Math. Mon. 1987, 94, 937–959. [CrossRef]
5. McGeoch, C.; Cong, W. Experimental evaluation of an adiabiatic quantum system for combinatorial optimization. In Proceedings
of the ACM International Conference on Computing Frontiers, Ischia, Italy, 14–16 May 2013; Volume 13.
6. McGeoch, C. Adiabatic quantum computation and quantum annealing: Theory and practice. Synth. Lect. Quantum Comput. 2014,
5, 1–93. [CrossRef]
7. Brooke, J.; Rosenbaum, D.; Aeppli, G. Quantum annealing of a disordered magnet. Science 1999, 284, 779–781. [CrossRef]
[PubMed]
8. Born, M.; Fock, V. Beweis des Adiabatensatzes. Z. Phys. 1928, 51, 165–180. [CrossRef]
9. Farhi, E.; Gutmann, S.; Sipser, M. Quantum computation by adiabatic evolution. arXiv 2000, arXiv:quant-ph/0001106.
10. Bian, Z.; Macready, F.; William, G.; Geordie, R. The Ising Model: Teaching an old Problem New Tricks; D-Wave Systems Inc.: Burnaby,
BC, Canada, 2010; Volume 2.
11. Toth, P.; Vigo, D. The Vehicle Routing Problem; SIAM: Philadelphia, PA, USA, 2002.
12. Toth, P.; Vigo, D. Models, relaxations and exact approaches for the capacitated vehicle routing problem. Discret. Appl. Math. 2002,
123, 487–512. [CrossRef]
13. Ralphs, T.; Kopman, L.;Pulleyblank, W.; Trotter, L. On the capacitated vehicle routing problem. Math. Program. 2003, 94, 343–359.
[CrossRef]
14. Atchade-Adelomou, P.; Alonso-Linaje, G.; Albo-Canals, J.; Casado-Fauli, D. qRobot: A Quantum Computing Approach in Mobile
Robot Order Picking and Batching Problem Solver Optimization. Algorithms 2021, 14, 194 [CrossRef]
15. Miller, C.; Tucker, A.; Zemlin, R. Integer programming formulation of traveling salesman problems. Oper. Res. Lett. 1960, 10,
27–36. [CrossRef]
16. Boruvka, O. On a minimal problem. Práce Moravské Pridovedecké Spolecnosti 1926, 3, 37–58.
17. Boruvka, O. Prıspevek k rešenı otázky ekonomické stavby elektrovodnıch sıtı (contribution to the solution of a problem of
economical construction of electrical networks). Elektronickỳ Obzor 1926, 15, 153–154.
18. Kruskal, J. On the shortest spanning subtree of a graph and the traveling salesman problem. Proc. Am. Math. Soc. 1956, 7, 48–50.
[CrossRef]
19. Bellmore, M.; Nemhauser, G. The Traveling Salesman Problem: A Survey. Oper. Res. 1968, 16, 538–558. [CrossRef]
20. Lenstra, J.; Rinnooy Kan, H. Some Simple Applications of the Travelling Salesman Problem. J. Oper. Res. Soc. 1975, 26, 717–733.
[CrossRef]
21. Adelomou, P.; Ribé, E.; Cardona, X. Formulation of the social workers’ problem in quadratic unconstrained binary optimization
form and solve it on a quantum computer. J. Comput. Commun. 2020, 11, 44–68. [CrossRef]
22. Lee, J.Y.; Shi, S.-Y.; Park, T.H.; Zhang, B.-T. Solving traveling salesman problems with DNA molecules encoding numerical values.
Biosystems 2004, 78, 39–47. [CrossRef]
71
Mathematics 2022, 10, 416
23. Ball, P. DNA Computer Helps Travelling Salesman; Springer Science and Business Media LLC: New York, NY, USA, 2000.
24. Pataki, G. Teaching integer programming formulations using the traveling salesman problem. SIAM Rev. 2003, 45, 116–123.
[CrossRef]
25. Martoňák, R.; Santoro, G.; Tosatti, E. Quantum annealing of the traveling-salesman problem. Phys. Rev. E 2004, 70, 057701.
[CrossRef]
26. Warren, R. Adapting the traveling salesman problem to an adiabatic quantum computer. Quantum Inf. Process. 2013, 4, 1781–1785.
[CrossRef]
27. Warren, R. Small traveling salesman problems. J. Adv. Appl. Math. 2017, 2. [CrossRef]
28. Greco, F. Traveling Salesman Problem; BoD–Books on Demand: Norderstedt, Germany, 2008; ISBN 978-953-51-5750-2.
29. Reinelt, G. TSPLIB—A traveling salesman problem library. ORSA J. Comput. 1991, 4, 376–384. [CrossRef]
30. Crosson, E.; Harrow, A. Simulated quantum annealing can be exponentially faster than classical simulated annealing. In
Proceedings of the 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), New Brunswick, NJ, USA,
9–11 October 2016; pp. 714–723.
31. Leung, K.; Jin, H.-D.; Xu, Z.-B. An expanding self-organizing neural network for the traveling salesman problem. Neurocomputing
2004, 62, 267–292. [CrossRef]
32. Cochrane, E.; Beasley, J. The co-adaptive neural network approach to the Euclidean travelling salesman problem. Neural Netw.
2003, 10, 1499–1525. [CrossRef]
33. Feld, S.; Gabor, T.; Seidel, C.; Neukart, F.; Galter, I.; Mauerer, W.; Linnhoff-Popien, C. A hybrid solution method for the capacitated
vehicle routing problem using a quantum annealer. Front. ICT 2019, 6, 13. [CrossRef]
34. Irie, H.; Wongpaisarnsin, G.; Terabe, M.; Miki, A.; Taguchi, S. Quantum annealing of vehicle routing problem with time, state
and capacity. In International Workshop on Quantum Technology and Optimization Problems; Springer: Cham, Switzerland, 2019;
pp. 145–156.
35. Focacci, F.; Lodi, A.; Milano, M. A hybrid exact algorithm for the TSPTW. INFORMS J. Comput. 2002, 4, 403–417. [CrossRef]
36. Edelkamp, S.; Gath, M.; Cazenave, T.; Teytaud, F. Algorithm and knowledge engineering for the TSPTW problem. In Proceedings
of the 2013 IEEE Symposium on Computational Intelligence in Scheduling (CISched), Singapore, 16–19 April 2013; pp. 44–51.
37. Atchade-Adelomou, P.; Golobardes-Ribé, E.; Vilasís-Cardona, X. Using the Variational-Quantum-Eigensolver (VQE) to Create
an Intelligent Social Workers Schedule Problem Solver. In Hybrid Artificial Intelligent Systems, Proceedings of the 5th International
Conference, HAIS 2020, Gijón, Spain, 11–13 November 2020; Lecture Notes in Computer Science; Springer: Cham, Switzerland,
2020; pp. 245–260.
38. Atchade-Adelomou, P.; Golobardes-Ribe, E.; Vilasis-Cardona, X. Using the Parameterized Quantum Circuit combined
with Variational-Quantum-Eigensolver (VQE) to create an Intelligent social workers’ schedule problem solver. arXiv 2020,
arXiv:2010.05863.
39. Atchade-Adelomou, P.; Casado-Fauli, D.; Golobardes-Ribe, E.; Vilasis-Cardona, X. quantum Case-Based Reasoning (qCBR). arXiv
2021, arXiv:2104.00409.
40. Applegate, D.; Cook, W. A computational study of the job-shop scheduling problem. ORSA J. Comput. 1991, 3, 149–156.
[CrossRef]
41. Papalitsas, C.; Andronikos, T.; Giannakis, K.; Theocharopoulou, G.; Fanarioti, S. A QUBO model for the traveling salesman
problem with time windows. Algorithms 2019, 12, 224. [CrossRef]
42. Boixo, S.; Rønnow, F.; Isakov, S.; Wang, Z.; Wecker, D.; Lidar, D.; Martinis, J.; Troyer, M. Evidence for quantum annealing with
more than one hundred qubits. Nat. Phys. 2014, 3, 218–224. [CrossRef]
43. Preskill, J. Quantum Computing in the NISQ era and beyond. Quantum 2018, 2, 79. [CrossRef]
44. D-Wave Systems Inc. Technical Description of the D-Wave Quantum Processing Unit; D-Wave Systems Inc.: Burnaby, BC,
Canada, 2020.
45. De Vogelaere, R. Methods of Integration Which Preserve the Contact Transformation Property of the Hamilton Equations; Technical
Report; Department of Mathematics, University of Notre Dame: Notre Dame, IN, USA, 1956.
46. Marston, C.; Balint-Kurti, G. The Fourier grid Hamiltonian method for bound state eigenvalues and eigenfunctions. J. Chem.
Phys. 1989, 6, 3571–3576. [CrossRef]
47. Shin, S.; Graeme, S.; Smolin, J.; Vazirani, U. How “quantum” is the D-Wave machine? arXiv 2014, arXiv:1401.7087.
48. Lucas, A. Ising formulations of many NP problems. Front. Phys. 2014, 2, 5. [CrossRef]
49. Teplukhin, A.; Kendrick, B.; Tretiak, S.; Dub, P. Electronic structure with direct diagonalization on a D-wave quantum annealer.
Sci. Rep. 2020, 10, 20753. [CrossRef]
50. Alonso-Linaje, G.; Atchade-Adelomou, P.; Gonzalez-Bermejo, S. Improvement in the Formulation of the TSP for Its Generalizations
Type QUBO. 2021. Available online: https://github.com/pifparfait/GPS (accessed on 1 December 2021).
51. Jäntschi, L.; Katona, G.; Diudea, M. Modeling Molecular Properties by Cluj Indices. Match 2000, 41, 151–188.
52. Zhang, R.; Prokhorchuk, A.; Dauwels, J. Deep Reinforcement Learning for Traveling Salesman Problem with Time Windows and
Rejections. In Proceedings of the 2020 International Joint Conference on Neural Networks (IJCNN), Glasgow, UK, 19–24 July 2020.
[CrossRef]
53. Atchade-Adelomou, P.; Alonso-Linaje, G. Quantum Enhanced Filter: QFilter. arXiv 2021, arXiv:2104.03418.
72
mathematics
Article
Quantum Weighted Fractional Fourier Transform
Tieyu Zhao 1, *, Tianyu Yang 2 and Yingying Chi 1
Abstract: Quantum Fourier transform (QFT) is an important part of many quantum algorithms.
However, there are few reports on quantum fractional Fourier transform (QFRFT). The main reason is
that the definitions of fractional Fourier transform (FRFT) are diverse, while some definitions do not
include unitarity, which leads to some studies pointing out that there is no QFRFT. In this paper, we
first present a reformulation of the weighted fractional Fourier transform (WFRFT) and prove its uni-
tarity, thereby proposing a quantum weighted fractional Fourier transform (QWFRFT). The proposal
of QWFRFT provides the possibility for many quantum implementations of signal processing.
Keywords: quantum weighted fractional Fourier transform; quantum Fourier transform; quantum
algorithm; quantum computing
MSC: 81-08
1. Introduction
Feynman was the first to present the idea of quantum computing, that is, to directly use
Citation: Zhao, T.; Yang, T.; Chi, Y.
the state of microscopic particles to represent quantum information, which is considered to
Quantum Weighted Fractional
be the early prototype of the concept of quantum computing [1]. Subsequently, Deutsch
Fourier Transform. Mathematics 2022,
10, 1896. https://doi.org/10.3390/
formalized the concept of quantum computing, proposed the idea of a quantum Turing
math10111896
machine, and designed the first quantum parallel algorithm, which exhibited excellent
performance beyond classical computing [2]. The proposal of Shor’s algorithm caused
Academic Editors: Fernando researchers to realize that quantum computing had a natural parallel processing capability,
L. Pelayo and Mauro Mezzini
which could introduce many disruptive technological innovations. Shor’s algorithm states
Received: 3 May 2022 that a large number can be decomposed into the product of two prime factors in polynomial
Accepted: 31 May 2022 time. This greatly challenged the RSA (Rivest–Shamir–Adleman) encryption system, thus
Published: 1 June 2022 indicating that the RSA encryption system had been cracked in theory [3,4]. Grover’s search
algorithm convinced researchers of the power of quantum computing. Compared with
Publisher’s Note: MDPI stays neutral
the traditional search method, this algorithm can achieve the acceleration effect of square
with regard to jurisdictional claims in
level [5]. Therefore, many improved Grover search algorithms have been proposed [6–10].
published maps and institutional affil-
iations.
Meanwhile, quantum-inspired algorithms have also been proposed that can be simulated
by classical computing [11–16]. Moreover, the quantum algorithm has been applied to
solve linear systems of equations, which introduced new ideas for solving linear equations.
This algorithm is also called the HHL algorithm [17]. The HHL algorithm has been widely
Copyright: © 2022 by the authors. used, and its improved algorithms have been continuously proposed [18–20]. Recently,
Licensee MDPI, Basel, Switzerland. quantum algorithms have been applied to solve differential equations [21–24]. A series
This article is an open access article of quantum computing technologies, such as quantum Fourier transform [25], quantum
distributed under the terms and phase estimation [26], and the HHL algorithm, are called quantum basic linear algebra
conditions of the Creative Commons assembly [27]. At present, quantum computing has been widely used in cryptography,
Attribution (CC BY) license (https:// quantum simulation, machine learning, and other fields and shows a strong ability and
creativecommons.org/licenses/by/ great potential.
4.0/).
The Fourier transform plays an important role in the design of quantum algorithms,
but little is known about the quantum algorithms of the fractional Fourier transform (FRFT).
The initial definition of the FRFT was proposed in [28]. Its application provides a convenient
technique for solving certain classes of ordinary and partial differential equations, which
arise in quantum mechanics from classical quadratic Hamiltonians. The theoretical research
of the FRFT has developed rapidly, and various definitions have been proposed, such as
eigenvalue FRFT [29], weighted FRFT [30], and sampling FRFT [31]. These definitions are
widely used in various fields of signal processing. So far, little is known about the reports
and studies on the quantum fractional Fourier transform (QFRFT). The main reason is
that the design of quantum algorithms should satisfy unitarity, and some FRFTs do not
include unitarity. Thus, a quantum pseudo-fractional Fourier transform (QPFRFT) was
proposed [32], and the authors showed that there was no QFRFT. However, we present a
reformulation of the weighted fractional Fourier transform (WFRFT) and prove its unitarity,
whereupon a quantum weighted fractional Fourier transform (QWFRFT) is proposed.
The remainder of this paper is organized as follows. The preliminary knowledge is
described in Section 2. The unitarity of the WFRFT is proved in Section 3. Section 4 presents
the QWFRFT. Finally, the conclusions are presented in Section 5.
2. Preparation
For a unitary matrix U, assuming that it has an eigenvector |u and the corresponding
eigenvalue e2πiϕ , U |u = e2πiϕ |u is satisfied. Therefore, we can calculate ϕ through the
phase estimation algorithm. The circuit of phase estimation is shown in Figure 1. It is not
difficult to find that the quantum Fourier transform (QFT) is the key to phase estimation,
and phase estimation is the key of many quantum algorithms.
j
H QFT
u Uj u
The importance of the QFT goes without saying. However, little is known about the
report of the QFRFT. In 2012, Parasa et al. proposed a QPFRFT using multiple-valued
logic [32]. The reason why researchers call it “pseudo” is that the FRFT used did not include
unitarity. The FRFT was proposed by Bailey et al. [33], and its definition is as follows:
N −1
kj
Fα [k] = ∑ f [ j]· exp 2πi · ·α . (1)
j =0
N
Parasa et al. pointed out: “It must be noted that unlike the discrete Fourier transform,
the FRFT is not a unitary operation. More formally, this means that there exists no unitary
operator which can implement the following quantum computational operation”.
N −1 N −1
NOTPOSSLBLE
∑ f ( j)| j → ∑ F α (k)|k . (2)
j =0 k =0
Therefore, Parasa et al. explicitly state that it is not possible to define the QFRFT.
However, the definitions of the FRFT are diverse, and the definition of one class of WFRFT
includes unitarity. Hence, Parasa et al.’s statement that there is no QFRFT is not rigorous.
74
Mathematics 2022, 10, 1896
In 1995, Shih proposed the definition of a WFRFT [30]. The alpha-order FRFT of the
function f (t) can be expressed as
3
F α [ f (t)] = ∑ A l ( α ) f l ( t ). (3)
l =0
Here, f 0 (t) = f (t), f 1 (t) = F [ f 0 (t)], f 2 (t) = F [ f 1 (t)], and f 3 (t) = F [ f 2 (t)] (F denotes
Fourier transform). The weighting coefficient Al (α) is expressed as
(α − l )π 2( α − l ) π 3(α − l )iπ
Al (α) = cos cos exp , (4)
4 4 4
where l = 0, 1, 2, 3.
UU H = U H U = I, (5)
where H denotes the conjugate transpose, and I is the identity matrix. Then, matrix U is
called a unitary matrix.
The discrete form of the WFRFT (Equation (3)) can be expressed as
where Al (α) is Equation (4), and DFT is the discrete Fourier transform. It is not easy to
prove the unitarity of Equation (6). Therefore, we present the reformulation of the WFRFT
and prove its unitarity. First, Equation (4) can be written as
75
Mathematics 2022, 10, 1896
We let ⎧
⎪
⎪ Y0 = I + DFT + DFT 2 + DFT 3
⎨
Y1 = I − i · DFT − DFT 2 + i · DFT 3
(11)
⎪
⎪ Y2 = I − DFT + DFT 2 − DFT 3
⎩
Y3 = I + i · DFT − DFT 2 − i · DFT 3
Proof of Proposition 1. In Equation (11), I is the identity matrix, and DFT can be expressed
as ⎛ 0×0 ⎞
u u 0×1 ... u0×(n−1)
⎜
1 ⎜ u
1 × 0 u 1 × 1 ... u 1 ×( n − 1 ) ⎟
⎟
DFT = √ ·⎜ .. .. . . ⎟, (13)
N ⎝ . . .. .. ⎠
u(n−1)×0 u(n−1)×1 ... u(n−1)×(n−1)
where u = exp(−2πi/N ). Here, DFT is a symmetric matrix, so that DFT 2 , DFT 3 , and
DFT 4 are also symmetric matrices. We know that the result of adding symmetric matrices
is still a symmetric matrix. Therefore, Yk are symmetric matrices (Equation (11)).
Next, we prove that Yk are real matrices. The integer powers of the Fourier transform
are shown in Figure 2. Here, DFT 2 and DFT 4 are real matrices; the matrix of DFT 2 is
shown in Equation (14), and DFT 4 is the identity matrix DFT 4 = DFT 0 = I.
⎛ ⎞
1 0 ... 0
⎜0 0 ... 1⎟
⎜ ⎟
DFT = ⎜ .
2
.. . .. ⎟. (14)
⎝ .. . .. .⎠
0 1 ... 0
76
Mathematics 2022, 10, 1896
F t
F
F
Obviously, I and DFT 2 are real matrices. In Equation (13), each element of the DFT
can be expressed as
ulk = exp(−2πilk/N ), (15)
where l = 0, 1, . . . , n − 1;k = 0, 1, . . . , n − 1. Therefore, DFT 3 is an inverse Fourier transform,
and each element of its matrix can be expressed as
Proof of Proposition 2. By the proof of Proposition 1, we know that Yk are real symmetric
matrices; that is, (Yk ) H = Yk . Therefore, the conjugate transpose of the DWFRFT is
α α α
α H
( DWFRFT ) H = 4 Y0 B0 + Y1 B1 + Y2 B2 + Y3 B3
1
−α −α −α −α
(21)
= 4 Y0 B0 + Y1 B1 + Y2 B2 + Y3 B3
1
.
77
Mathematics 2022, 10, 1896
Thus, we obtain
DWFRFT ·( DWFRFT ) H = 1
16 Y0 B0α + Y1 B1α + Y2 B2α + Y3 B3α Y0 B0−α + Y1 B1−α + Y2 B2−α + Y3 B3−α
3 3 (22)
= 1
16 ∑ ∑ Yk Yl Bkα Bl−α .
k =0 l =0
Here, 1
0, k = l
Yk Yl = (23)
Yk2 , k = l
Then, Equation (22) is written as
1 3 2
16 k∑
DWFRFT ·( DWFRFT ) H = Yk . (24)
=0
1 3 1
4 k∑
DWFRFT ·( DWFRFT ) H = Yk = (Y0 + Y1 + Y2 + Y3 ) = I. (25)
=0
4
We can also implement the new reformulation with the help of fast Fourier transform
(FFT), and its implementation module is shown in Figure 3. The weighting coefficients are
readjusted Aαl in Figure 3; so, the computational complexity is O( N log N ).
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i α
H[S ¨ ( × ) ·¸ ě
B
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ (× ) ·¸
© ¹
§ −π i
H[S ¨ (× ) ·¸
© ¹ α
))7 ě
B
§ −π i
H[S ¨ (× ) ·¸
© ¹
§ −π i
H[S ¨ (× ) ·¸
© ¹
ě <
; § −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹ α
5HYHUVH ě B
PRGXOH
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ·¸
© ¹ α
5HYHUVH ě
B
§ −π i
PRGXOH
H[S ¨ ( × ) ·¸
© ¹
§ −π i
H[S ¨ ( × ) ¸·
© ¹
78
Mathematics 2022, 10, 1896
1 N −1
yk = √ ∑ x j u jk ; k = 0, 1, 2, . . . , N − 1 (26)
N j =0
1 N −1
QFT : | j → √ ∑ w jk |k . (28)
N k =0
Equivalently, the QFT can be viewed as a unitary matrix acting on quantum state
vectors, where the unitary matrix FN is given by
⎛ ⎞
w 0×0 w 0×1 ... w0×(n−1)
1 ⎜
⎜ w 1×0 w 1×1 ... w1×(n−1) ⎟
⎟
FN = √ ⎜ .. .. .. .. ⎟. (29)
N⎝ . . . . ⎠
w(n−1)×0 w(n−1)×1 ... w(n−1)×(n−1)
n
Sine N = 2n and w = e2πi/2 . The electronic circuit of the QFT is shown in Figure 4.
j H R Rn− Rn
(
+ eπ i> j" jn @ )
j H Rn− Rn−
(
+ eπ i> j" jn @ )
# #
jn − H R
(
+ e π i> jn − jn @ )
jn H
(
+ eπ i> jn @ )
1
QFT (| j1 j2 . . . jn ) = |0 + e2πi[0.jn ] |1 ⊗ |0 + e2πi[0.jn−1 jn ] |1 ⊗ . . . ⊗ |0 + e2πi[0.j1 j2 ...jn ] |1 , (30)
2n/2
79
Mathematics 2022, 10, 1896
For instance, [0.j1 ] = j1 /2 and [0.j1 j2 ] = j1 /2 + j2 /22 . Then, the QFT can be further
expressed as
1 [j ] [j j ] [ j j ...jn ]
QFT (| j1 j2 . . . jn ) = | 0 + w1 n | 1 ⊗ | 0 + w2 n −1 n | 1 ⊗ . . . ⊗ |0 + w n 1 2 |1 . (32)
2n/2
To implement the QWFRFT, we first present the integer powers (QFT 0 , QFT 1 , QFT 2 , QFT 3 )
of the QFT.
1. We know that QFT 0 = I, and I is the identity matrix; obviously, this is a unitary
operator. Then, its operation can be expressed as
|α ¯I¯| β 0
2. The QFT is a unitary operator. The Fourier transform of a quantum state |α can be
expressed as
|α ¯QFT¯| β 1
3. The quadratic power of the QFT can be expressed as
⎛ ⎞
1 0 ... 0
⎜0 0 ... 1⎟
⎜ ⎟
QFT 2 = ⎜ . .. . .. ⎟
⎝ .. . .. .⎠
0 1 ... 0
In order to realize the quantum circuit of the above matrix, multiple swap gates are
required. The swap gate of two quanta is shown in Figure 5.
⊕
a b a b
≡
b a b ⊕ ⊕ a
Figure 5. Swap gate.
Thus, for QFT 2 , we provide quantum circuits of eight quantum states, as shown in
Figure 6.
80
Mathematics 2022, 10, 1896
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
For a 2n × 2n dimensional identity matrix, we can obtain the QFT 2 by row transforma-
tion, as shown in Figure 7.
§ " · § "
·
¨ ¸ ¨ ¸
" ¨ "
¸
¨ ¸
¨ " ¸ ¨ "
¸
¨ ¸ ¨ ¸
¨# # # % # #¸ ¨# # #
% # #¸
¨ " ¸ ¨ " ¸
¨¨ ¸ ¨¨ ¸
© " ¸¹ n ×n © " ¸¹ n ×n
Figure 7. Matrix of the QFT 2 .
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
φ φ
81
Mathematics 2022, 10, 1896
|α ¯QFT 2 ¯| β 2
1. The third power of the QFT, which is equivalent to the inverse operation of the QFT,
is also a unitary operator.
|α ¯QFT 3 ¯| β 3
Therefore, the QWFRFT of the quantum state by Equation (10) can be expressed as
⎛ ⎞⎛ ⎞
1 1 1 1 B0α
⎜1 − i −1 i ⎟ ⎜ B1 ⎟
α
QWFRFT (|α ) = 1
I (|α ), QFT (|α ), QFT (|α ), QFT (|α ) ⎜
2 3
⎝1
⎟⎜ ⎟
4 −1 1 −1⎠ ⎝ B2α ⎠
1 i −1 −i B3α
⎛ ⎞⎛ α ⎞ (33)
1 1 1 1 B0
⎜1 −i −1 i ⎟ ⎜ α ⎟
= ⎜ ⎟⎜ B1 ⎟.
4 (| β 0 , | β 1 , | β 2 , | β 3 ) ⎝1
1
−1 1 −1⎠ ⎝ B α ⎠ 2
1 i −1 −i B3α
Equation (33) can be further written as
⎛ ⎞⎛ ⎞
1 1 1 1 B0α
⎜1 −i −1 i ⎟ ⎜ B1 ⎟
α
QWFRFT (|α ) = 1
(| β , | β , | β , | β ) ⎜ ⎟⎜ ⎟
4 0 1 2 3 ⎝1 −1 1 −1⎠ ⎝ B2α ⎠
1 i −1 −i B3α
⎛ ⎞
exp −2πi0 ×0 exp −2πi0 ×1 exp −2πi0 ×2 exp −2πi0 ×3
(34)
⎜ 4 4 4 4
⎟⎛ Bα ⎞
⎜ ×3 ⎟
⎜exp −2πi1 ×0 exp −2πi1 ×1 exp −2πi1 ×2 exp −2πi1 ⎟⎜ 0α ⎟
⎜ 4 4 4 4 ⎟⎜ B1 ⎟
= 4 (| β 0 , | β 1 , | β 2 , | β 3 ) ⎜
1
⎟
⎜exp −2πi2×0 exp −2πi2 ×1 exp −2πi2 ×2 exp −2πi2 ×3 ⎟ ⎝ B2α ⎠
⎜ ⎟
B3α
4 4 4 4
⎝ ⎠
exp − 2πi3×0
exp −2πi3 ×1 exp −2πi3 ×2 exp − 2πi3×3
4 4 4 4
3 3
QWFRFT (|α ) = −2πilk Bkα
1
4 ∑ ∑ | β l exp 4
l =0 k =0
3 3
= −2πilk
1
4 ∑ ∑ | β l exp 4 exp 2πikα
4 (35)
l =0 k =0
3 3
2πik(α−l )
= 1
4 ∑ ∑ | β l exp 4 .
l =0 k =0
With the help of the quantum artificial neural network (QANN), we are inspired to de-
sign a QWFRFT. Here, we first introduce the QANN [34,35]. If we use {|e1 , |e2 , . . . , |e M }
to denote the canonical basis for C M , then the quantum artificial neural network above can
be rewritten as
M N 2 3 2 3
(1) (1) 3 (1) (2) (2) 3 (2)
Q(| x ) = ∑∑ α j,k σk w j,k 3T | x + θ j,k + iα j,k σk w j,k 3T | x + θ j,k | ek . (36)
k =1 j =1
2 3 3 4
(i ) n (i ) 3 (i ) 3 (i ) N (i ) (i )
Put y j,k = σk ∑ w j,k (t)3T | xt + θ j,k and 3αk = ∑ α j,k y j,k |ek . Then, a QANN
t =1 j =1
can be illustrated by Figures 9 and 10 below.
82
Mathematics 2022, 10, 1896
w(ik) () σk
x ¦ k y( k)
i
w(i )k ()
α i k
w(ik) ( )
σk α i k
x w(i )k ( )
¦ k y( )k
i
¦k
α k(i )
wN(i )k ( n ) σk
xn ¦ N k
y N( i )k
3 4
3 (i )
Figure 9. The output 3αk of a QANN, where i = 1, 2; k = 1, 2, . . . , M.
α k()
¦ Q( x )
i
α k( )
Thus, we can present the circuit of the QWFRFT, as shown in Figure 11.
ě
β α
B
α
−i B
β ě
−
i QWFRFT ( α
−
α
B
ě )
β
ě
− α
B
i
−
β −i ě
So far, we have completed the QWFRFT and circuit implementation. The work of
this paper is a supplement to the work of Parasa et al. At one point, researchers pointed
out that there is no quantum-weighted fractional Fourier transform [32]. However, our
study illustrates the diversity of FRFT and proposes QWFRFT. Due to the characteristics of
quantum parallelism, we believe that the QWFRFT has a wider application space.
At present, our method is only applicable to closed systems. The standard quantum
theory has shown its limit to describe successfully experimental results. Counterintuitive
results are obtained in different experiments [36,37]. The open system effects need to be
further analyzed.
5. Conclusions
Unitarity is a prerequisite for the realization of quantum algorithms. In this paper,
we proposed the reformulation of the WFRFT. The unitarity of the WFRFT was proved
by means of the proposed reformulation. The QFT is an important part of the QWFRFT.
Furthermore, we presented the integer power operation and quantum circuit of the QFT,
83
Mathematics 2022, 10, 1896
which lays the foundation for the QWFRFT. Finally, we designed the circuit of the QWFRFT
with the help of a quantum artificial neural network and proposed the electronic circuit of
the QWFRFT. The results of this paper show that there is a QFRFT algorithm, which lays
the foundation for further research.
Author Contributions: Conceptualization, T.Z.; methodology, T.Z.; validation, T.Z., T.Y. and Y.C.;
formal analysis, T.Z.; investigation, T.Z.; resources, T.Y.; writing—original draft preparation, T.Z.;
writing—review and editing, T.Z.; project administration, T.Z. All authors have read and agreed to
the published version of the manuscript.
Funding: This study was supported by the Fundamental Research Funds for the Central Universities
(N2123016); and the Scientific Research Projects of Hebei colleges and universities (QN2020511).
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: Not applicable.
Conflicts of Interest: The authors declare no conflict of interest.
References
1. Feynman, R.P. Simulating physics with computers. Int. J. Theor. Phys 1982, 21, 467–488. [CrossRef]
2. Deutsch, D. Quantum theory, the Church–Turing principle and the universal quantum computer. Proc. R. Soc. Lond. A Math. Phys.
Sci. 1985, 400, 97–117.
3. Shor, P.W. Algorithms for quantum computation: Discrete logarithms and factoring. In Proceedings of the 35th Annual IEEE
Symposium on Foundations of Computer Science, Santa Fe, NM, USA, 20–22 November 1994; pp. 124–134.
4. Shor, P.W. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Rev. 1999,
41, 303–332. [CrossRef]
5. Grover, L.K. A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on
the Theory of Computing, New York, NY, USA, 22–24 May 1996; pp. 212–219.
6. Biham, E.; Biham, O.; Biron, D.; Grassl, M.; Lidar, D.A. Grover’s quantum search algorithm for an arbitrary initial amplitude
distribution. Phys. Rev. A 1999, 60, 2742–2745. [CrossRef]
7. Boyer, M.; Brassard, G.; Høyer, P.; Tapp, A. Tight bounds on quantum searching. Fortschr. Der Phys. Prog. Phys. 1998, 46, 493–505.
[CrossRef]
8. Grover, L.K. Quantum computers can search rapidly by using almost any transformation. Phys. Rev. Lett. 1998, 80, 4329–4332.
[CrossRef]
9. GuiLu, L.; WeiLin, Z.; YanSong, L.; Li, N. Arbitrary phase rotation of the marked state cannot be used for Grover’s quantum
search algorithm. Commun. Theor. Phys. 1999, 32, 335–338. [CrossRef]
10. Long, G.L.; Li, Y.S.; Zhang, W.L.; Niu, L. Phase matching in quantum searching. Phys. Lett. A 1999, 262, 27–34. [CrossRef]
11. Narayanan, A.; Moore, M. Quantum-inspired genetic algorithms. In Proceedings of the IEEE International Conference on
Evolutionary Computation, Nagoya, Japan, 20–22 May 1996; pp. 61–66.
12. Shenvi, N.; Kempe, J.; Whaley, K.B. Quantum random-walk search algorithm. Phys. Rev. A 2003, 67, 052307. [CrossRef]
13. Han, K.-H.; Kim, J.-H. Genetic quantum algorithm and its application to combinatorial optimization problem. In Proceedings of
the IEEE Congress on Evolutionary Computation, La Jolla, CA, USA, 16–19 July 2000; pp. 1354–1360.
14. Chen, L.B. Mitochondrial membrane potential in living cells. Annu. Rev. Cell Biol. 1988, 4, 155–181. [CrossRef]
15. Høyer, P.; Špalek, R. Quantum fan-out is powerful. Theory Comput. 2005, 1, 81–103. [CrossRef]
16. Sun, J.; Wu, X.; Palade, V.; Fang, W.; Lai, C.-H.; Xu, W. Convergence analysis and improvements of quantum-behaved particle
swarm optimization. Inf. Sci. 2012, 193, 81–103. [CrossRef]
17. Harrow, A.W.; Hassidim, A.; Lloyd, S. Quantum algorithm for linear systems of equations. Phys. Rev. Lett. 2009, 103, 150502.
[CrossRef] [PubMed]
18. Childs, A.M.; Kothari, R.; Somma, R.D. Quantum algorithm for systems of linear equations with exponentially improved
dependence on precision. SIAM J. Comput. 2017, 46, 1920–1950. [CrossRef]
19. Clader, B.D.; Jacobs, B.C.; Sprouse, C.R. Preconditioned quantum linear system algorithm. Phys. Rev. Lett. 2013, 110, 250504.
[CrossRef]
20. Wossnig, L.; Zhao, Z.; Prakash, A. Quantum linear system algorithm for dense matrices. Phys. Rev. Lett. 2018, 120, 050502.
[CrossRef]
21. Arrazola, J.M.; Kalajdzievski, T.; Weedbrook, C.; Lloyd, S. Quantum algorithm for nonhomogeneous linear partial differential
equations. Phys. Rev. A 2019, 100, 032306. [CrossRef]
22. Lloyd, S.; De Palma, G.; Gokler, C.; Kiani, B.; Liu, Z.-W.; Marvian, M.; Tennie, F.; Palmer, T. Quantum algorithm for nonlinear
differential equations. arXiv 2020, arXiv:2011.06571.
84
Mathematics 2022, 10, 1896
23. Childs, A.M.; Liu, J.-P. Quantum spectral methods for differential equations. Commun. Math. Phys. 2020, 375, 1427–1457.
[CrossRef]
24. Childs, A.M.; Liu, J.-P.; Ostrander, A. High-precision quantum algorithms for partial differential equations. Quantum 2021, 5, 574.
[CrossRef]
25. Coppersmith, D. An approximate Fourier transform useful in quantum factoring. arXiv 2002, arXiv:quant-ph/0201067.
26. Nielsen, M.A.; Chuang, I.L. Quantum computation and quantum information. Phys. Today 2001, 54, 60.
27. Biamonte, J.; Wittek, P.; Pancotti, N.; Rebentrost, P.; Wiebe, N.; Lloyd, S. Quantum machine learning. Nature 2017, 549, 195–202.
[CrossRef] [PubMed]
28. Namias, V. The fractional order Fourier transform and its application to quantum mechanics. IMA J. Appl. Math. 1980, 25, 241–265.
[CrossRef]
29. Candan, C.; Kutay, M.A.; Ozaktas, H.M. The discrete fractional Fourier transform. IEEE Trans. Signal Process. 2000, 48, 1329–1337.
[CrossRef]
30. Shih, C.C. Fractionalization of Fourier transform. Opt. Commun. 1995, 118, 495–498. [CrossRef]
31. Ozaktas, H.M.; Arikan, O.; Kutay, M.A.; Bozdagt, G. Digital computation of the fractional Fourier transform. IEEE Trans. Signal
Process. 1996, 44, 2141–2150. [CrossRef]
32. Parasa, V.; Perkowski, M. Quantum pseudo-fractional fourier transform using multiple-valued logic. In Proceedings of the IEEE
42nd International Symposium on Multiple-Valued Logic, Victoria, BC, Canada, 14–16 May 2012; pp. 311–314.
33. Bailey, D.H.; Swarztrauber, P.N. The fractional Fourier transform and applications. SIAM Rev. 1991, 33, 389–404. [CrossRef]
34. Cao, H.; Cao, F.; Wang, D. Quantum artificial neural networks with applications. Inf. Sci. 2015, 290, 1–6. [CrossRef]
35. da Silva, A.J.; de Oliveira, W.R. Comments on “quantum artificial neural networks with applications”. Inf. Sci. 2016, 370, 120–122.
[CrossRef]
36. Eleuch, H.; Rotter, I. Nearby states in non-Hermitian quantum systems I: Two states. Eur. Phys. J. D 2015, 69, 229. [CrossRef]
37. Eleuch, H.; Rotter, I. Clustering of exceptional points and dynamical phase transitions. Phys. Rev. A 2016, 93, 042116. [CrossRef]
85
mathematics
Article
Progress towards Analytically Optimal Angles in Quantum
Approximate Optimisation
Daniil Rabinovich *, Richik Sengupta, Ernesto Campos, Vishwanathan Akshay and Jacob Biamonte
Laboratory of Quantum Algorithms for Machine Learning and Optimisation, Skolkovo Institute of Science and
Technology, 3 Nobel Street, 121205 Moscow, Russia; [email protected] (R.S.);
[email protected] (E.C.); [email protected] (V.A.); [email protected] (J.B.)
* Correspondence: [email protected]
Abstract: The quantum approximate optimisation algorithm is a p layer, time variable split oper-
ator method executed on a quantum processor and driven to convergence by classical outer-loop
optimisation. The classical co-processor varies individual application times of a problem/driver
propagator sequence to prepare a state which approximately minimises the problem’s generator.
Analytical solutions to choose optimal application times (called parameters or angles) have proven
difficult to find, whereas outer-loop optimisation is resource intensive. Here we prove that the
optimal quantum approximate optimisation algorithm parameters for p = 1 layer reduce to one free
variable and in the thermodynamic limit, we recover optimal angles. We moreover demonstrate that
conditions for vanishing gradients of the overlap function share a similar form which leads to a linear
relation between circuit parameters, independent of the number of qubits. Finally, we present a list of
numerical effects, observed for particular system size and circuit depth, which are yet to be explained
analytically.
The time of application of each propagator is varied to maximise preparation of the state
|t . Finding γ, β to maximise | g p (γ, β)| has shown to be cumbersome. Even lacking such
solutions, much progress has been made.
Recent milestones include experimental demonstration of p = 3 depth QAOA (cor-
responding to six tunable parameters) using a twenty three qubits [1] superconducting
processor, universality results [20,21], as well as several results that aid and improve on
the original implementation of the algorithm [11,12,17]. Towards practical realisation
of the QAOA, trapped ion-based quantum computers have recently shown promising
results, including demonstrations on up to forty qubits [2] and the potential to realise arbi-
trary combinatorial optimisation problems with all to all connectivity based on hardware-
inspired modifications [22]. Although QAOA exhibits provable advantages such as re-
covering a near-optimal query complexity in Grover’s search [23] and offers a pathway
towards quantum advantage [13], several limitations have been discovered for low depth
QAOA [9,24,25].
In the setting of maximum-constraint satisfiability (e.g., minimizing a Hamiltonian
representing a function of type f : {0, 1}n → R+ ), it has been shown that underparameteri-
sation of QAOA sequences can be induced by increasing a problem instances constraint to
variable ratio [9]. This effect persists in graph minimisation problems [26]. While this effect
is perhaps an expected limitation of the quantum algorithm, parameter concentrations and
noise-assisted training add a degree of optimism. QAOA exhibits parameter concentra-
tions, in which training for some fraction of ω < n qubits provides a training sequence
for n qubits [27]. Moreover, whereas layerwise training saturates for QAOA in which the
algorithm plateaus and fails to reach the target, local coherent noise recovers layerwise
training robustness [28]. Both concentrations and noise-assisted training imply a reduction
in computational resources required in outer-loop optimisation.
Exact solutions to find the optimal parameters for QAOA have only been possible
in special cases including, e.g., fully connected graphs [14–16] and projectors [27]. A
general analytical approach which would allow for (i) calculation of optimal parameters,
(ii) estimation of the critical circuit depth and (iii) performance guarantees for fixed depth
remains open.
Here we prove that optimal QAOA parameters for p = 1 are related as γ1 = π − 2β 1
and in the thermodynamic limit, we recover optimality as β 1 n → π and γ1 → π. We
moreover demonstrate that conditions for vanishing gradients of the overlap function share
a similar form which leads to a linear relation between circuit parameters, independent
of the number of qubits. We hence devise an additional means to recover parameter
concentrations [27] analytically. Finally, we present a list of numerical effects, observed for
particular system size and circuit depth, which are yet to be explained analytically.
⊗
computational basis Bn = {|0 , |1 } . For an arbitrary target state |t ∈ Bn (equivalently
n
where P = |t t| and Hx = ∑nj=1 X j is the one-body mixer Hamiltonian with X j the Pauli
matrix acting non-trivially on the j-th qubit. Here we focus on the state preparation, thus
choosing the problem Hamiltonian to be a projector (P2 = P) on an arbitrary bit string
|t . We note that while the projector has only two energy levels, the effective Hamiltonian
of the whole QAOA sequence has up to n + 1 distinct energy levels. In such settings, the
propagator V (γ) acting on a superposition adds a phase −γ to the component |t , while
the propagator U ( β) mixes the components’ amplitudes.
A p-depth (p layer) QAOA circuit prepares a quantum state |ψ as:
88
Mathematics 2022, 10, 2601
3 5 p
⊗n
3ψ p (γ, β) = ∏ [U ( βk )V (γk )]|+ , (3)
k =1
Note that the problem is equivalent to the minimisation of the ground state energy of
Hamiltonian P⊥ = − |t t|,
6 3 3 5 3 32
min ψ p (γ, β)3 P⊥ 3ψ p (γ, β) = 1 − max 3 g p (γ, β)3 . (5)
γ,β γ,β
the absolute value of the overlap remains invariant as g p → (−1)n g∗p . Therefore, this narrows the
search space to γk ∈ [0, π ), β k ∈ [0, π ), whereas maximums inside the restricted region determine
maximums in the composite space using Equation (6).
Proposition 1 (Overlap invariance). The overlap function g p (γ, β) is invariant with respect to
|t ∈ Bn .
n tj
Proof. Each |t = |t1 t2 . . . tn ∈ Bn determines a unitary operator U = U † = j =1 Xj .
Hence, we have
p
⊗n
g p (γ, β) = 0|U † ∏ e−iβ k Hx e−iγk U (|0 0|)U †
|+
k =1
p
⊗n
= 0|U † ∏ e−iβ k Hx [Ue−iγk (|0 0|)
U † ]|+ (7)
k =1
p
⊗n
= 0| ∏ e−iβ k Hx e−iγk |0 0|
|+ .
k =1
The first equality follows from U |0 = |t where |0 = |0 ⊗n . The second equality follows
from the definition of the matrix exponential. The third equality follows as U commutes
with Hx as does any analytic function of Hx , and U |+ ⊗n = |+ ⊗n . Thus, the overlap is
seen to be independent of the target bit string |t .
Remark 3 (Global optimisation). A strategy when all 2p parameters are optimised simultane-
ously which might provide the best approximation to prepare |t .
89
Mathematics 2022, 10, 2601
3. p = 1 QAOA
For a single layer, the global and layerwise strategies are equivalent. Such a circuit
was considered to establish parameter concentrations [27] analytically. The overlap was
shown to be:
1
| g1 (γ, β)|2 = 1 + 2 cosn β(cos (γ − nβ) − cos nβ) + 2 cos2n β(1 − cos γ) . (8)
2n
To find extreme points of (8) the authors in [27] set the derivatives with respect to γ and β
to zero. This approach leads to solutions which contain maxima but also the minimum of
the overlap (8). These must be carefully separated. Moreover, this approach ignores the
operator structure of the overlap as presented here. For aesthetics, subscript opt in γopt and
β opt is further omitted.
∂( gg∗ ) ∂( gg∗ )
with P = |0 0| we use the standard conditions = = 0. Setting the first
∂γ ∂β
derivative to zero we arrive at
⊗n ∗
0|e−iβHx e−iγP P|+ g = +|⊗n PeiγP eiβHx |0 g. (10)
Using the explicit form of the projector and the fact that 0|e−iβHx |0 = cosn β, equation (10)
simplifies into
which is equivalent to
Then the derivative of expression (9) with respect to β is set to zero and we arrive at
⊗n ∗
0|e−iβHx Hx e−iγP |+ g = +|⊗n eiγP Hx eiβHx |0 g. (13)
⊗n
Moving Hx next to its eigenstate |+ is compensated as follows:
−iβHx −iγP −iγ ⊗n ∗
0| e {e Hx + ( e − 1)[ Hx , P]}|+ g
⊗n
= +| { Hx e iγP
+ [ P, Hx ](e − 1)}e
iγ iβHx
|0 g. (14)
90
Mathematics 2022, 10, 2601
− gA = g∗ A∗ e−iγ , (15)
−e−iγ A = A∗ . (16)
γ+π
arg A = . (17)
2
A is calculated as
√
A 2n = 0|( Hx − n)eiβHx |0 = −n cosn−1 βe−iβ , (18)
γ+π
π−β= , (19)
2
which finally establishes γ = π − 2β.
Remark 5 (Trivial solutions). Equation (14) has three pathological solutions which must be ruled
γ
out: (i) sin = 0 (which sets eiγ − 1 = 0), (ii) cos β = 0 (which sets A = 0), (iii) g(γ, β) = 0.
2
All three cases imply | g(γ, β)| ≤ g(0, 0).
Remark 6. The zero derivative conditions result in (11) and (15) which have a similar form,
viz. x = x ∗ eiϕ . The first condition (11) can be obtained without differentiation [28] using the
explicit form of the overlap Equation (9)
√
g 2n = e−iγ cosn β + (e−iβn − cosn β), (20)
3 3
and the fact that maxγ 3 Ae−iγ + B3 = | A| + | B| for any A, B ∈ C. Although the derivative
with respect to β leads to the condition (15), we find no way to recover this using elementary
alignment arguments.
Remark 7. While optimal angle relation γ = π − 2β has also been established in [27], here we
demonstrate that it can result from certain ansatz symmetry, manifested in similar form of zero
derivatives conditions (11) and (15). This can provide useful insights to understand similar optimal
angle dependency for deeper circuits (Section 4.2).
To find optimal parameters one needs to solve the zero derivative conditions and then
take solutions that deliver a global maximum to the overlap. For convenience, we substitute
γ = π − 2β to the overlap function (20), square it and after simplification arrive at
Proof. Using the explicit form of the overlap (20), from Equation (11) one can establish
91
Mathematics 2022, 10, 2601
which is equivalent to
We solve this equation in the limit n → ∞. In this limit sin 2β cosn β → 0 independent
of the value of β. Thus, the left-hand side of Equation (24) tends to zero. This implies that
the leading order solution scales as
kπ
β= + o ( n −1 ) (25)
n+2
where k < n is a positive integer (in principle, n-dependent). To recover the optimal
constant k we substitute Equation (25) to Equation (21) to obtain
kπ kπ
| g|2 2n = 1 + 4 cosn+2 cosn − (−1)k (26)
n+2 n+2
Remark 8. In Theorem 2 the leading order solutions were found for optimal parameters. Higher
order corrections in n are found from Equation (24). For example, it is straightforward to show that
π 4π
− 2 + O ( n −3 ),
β= (28)
n n
2π 8π
γ=π− + 2 + O ( n −3 ). (29)
n n
Remark 9. Expressions (28) and (29) are used to demonstrate parameter concentrations [27], i.e.,
the effect when optimal parameters for n and n + 1 qubits are polynomially close.
Theorems 1 and 2 provide state of the art analytical results for state preparation with
p = 1 depth QAOA circuit. For deeper circuits and more general settings, analysis becomes
complicated and known results are mostly numerical. Therefore, below we provide a list of
numerical effects for deeper circuits which lack analytical explanations.
g p+1 (γ, β, γ p+1 , β p+1 ) = g p (γ, β̃) + g p (γ, β) cosn β p+1 (e−iγ p+1 − 1), (30)
where β̃ = ( β 1 + β p+1 , . . . , β p + β p+1 ). This recursion was used in [27] for p = 2 where it
was shown that in the thermodynamic limit n → ∞ the zero derivative conditions let one
obtain solutions for which nβ → π and γ → π. This establishes parameter concentrations.
The effect was further confirmed numerically on up to n = 17 qubits and p = 5 layers.
For arbitrary depth, parameter concentrations are conjectured, yet analytical confirmation
remains open. The recursion (30) can be used in the suggested operator formalism to
92
Mathematics 2022, 10, 2601
derive a system of equations to calculate optimal parameters for circuits of arbitrary depth.
In the suggested formalism the zero derivative conditions will contain expectations of
propagators used in the circuit, and the system can be solved in the thermodynamic limit,
albeit with a growing number of equations to satisfy.
Figure 1. Optimal angles of p = 5 depth circuit for n ∈ [6; 17]. While the first layers can be
approximately described by a linear relation, the last layer fits γ p + 2β p = π. Moreover, the values of
the last layer’s parameters are evidently distinct from the previous layers.
5. Conclusions
We have proven a relationship between optimal QAOA parameters for p = 1, and
we recover optimal angles in the thermodynamic limit. We demonstrated the effect of
93
Mathematics 2022, 10, 2601
Author Contributions: Methodology, D.R., R.S., E.C., V.A. and J.B.; Writing—original draft, D.R.,
R.S., E.C., V.A. and J.B. All authors have read and agreed to the published version of the manuscript.
Funding: The authors acknowledge support from the research project Leading Research Center on
Quantum Computing (agreement No. 014/20).
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: Not applicable.
Conflicts of Interest: The authors declare no conflict of interest.
References
1. Harrigan, M.P.; Sung, K.J.; Neeley, M.; Satzinger, K.J.; Arute, F.; Arya, K.; Atalaya, J.; Bardin, J.C.; Barends, R.; Boixo, S.; et al.
Quantum approximate optimization of non-planar graph problems on a planar superconducting processor. Nat. Phys. 2021, 17,
332–336. [CrossRef]
2. Pagano, G.; Bapat, A.; Becker, P.; Collins, K.; De, A.; Hess, P.; Kaplan, H.; Kyprianidis, A.; Tan, W.; Baldwin, C.; et al. Quantum
approximate optimization of the long-range Ising model with a trapped-ion quantum simulator. arXiv 2019, arXiv:1906.02700.
3. Guerreschi, G.G.; Matsuura, A.Y. QAOA for Max-Cut requires hundreds of qubits for quantum speed-up. Sci. Rep. 2019, 9, 6903.
[CrossRef] [PubMed]
4. Butko, A.; Michelogiannakis, G.; Williams, S.; Iancu, C.; Donofrio, D.; Shalf, J.; Carter, J.; Siddiqi, I. Understanding quantum
control processor capabilities and limitations through circuit characterization. In Proceedings of the 2020 International Conference
on Rebooting Computing (ICRC), Atlanta, GA, USA, 1–3 December 2020; IEEE: Piscataway, NJ, USA, 2020; pp. 66–75.
5. Biamonte, J. Universal variational quantum computation. Phys. Rev. A 2021, 103, L030401. [CrossRef]
6. Campos, E.; Nasrallah, A.; Biamonte, J. Abrupt transitions in variational quantum circuit training. Phys. Rev. A 2021, 103, 032607.
[CrossRef]
7. Farhi, E.; Goldstone, J.; Gutmann, S. A Quantum Approximate Optimization Algorithm. arXiv 2014, arXiv:1411.4028.
8. Niu, M.Y.; Lu, S.; Chuang, I.L. Optimizing qaoa: Success probability and runtime dependence on circuit depth. arXiv 2019,
arXiv:1905.12134.
9. Akshay, V.; Philathong, H.; Morales, M.E.; Biamonte, J.D. Reachability Deficits in Quantum Approximate Optimization. Phys.
Rev. Lett. 2020, 124, 090504. [CrossRef]
10. Akshay, V.; Philathong, H.; Campos, E.; Rabinovich, D.; Zacharov, I.; Zhang, X.M.; Biamonte, J. On Circuit Depth Scaling For
Quantum Approximate Optimization. arXiv 2022, arXiv:2205.01698.
11. Zhou, L.; Wang, S.T.; Choi, S.; Pichler, H.; Lukin, M.D. Quantum Approximate Optimization Algorithm: Performance, Mechanism,
and Implementation on Near-Term Devices. Phys. Rev. X 2020, 10, 021067. [CrossRef]
12. Brady, L.T.; Baldwin, C.L.; Bapat, A.; Kharkov, Y.; Gorshkov, A.V. Optimal Protocols in Quantum Annealing and Quantum
Approximate Optimization Algorithm Problems. Phys. Rev. Lett. 2021, 126, 070505. [CrossRef] [PubMed]
13. Farhi, E.; Harrow, A.W. Quantum Supremacy through the Quantum Approximate Optimization Algorithm. arXiv 2016,
arXiv:1602.07674.
14. Farhi, E.; Goldstone, J.; Gutmann, S.; Zhou, L. The quantum approximate optimization algorithm and the sherrington-kirkpatrick
model at infinite size. arXiv 2019, arXiv:1910.08187.
15. Wauters, M.M.; Mbeng, G.B.; Santoro, G.E. Polynomial scaling of QAOA for ground-state preparation of the fully-connected
p-spin ferromagnet. arXiv 2020, arXiv:2003.07419.
16. Claes, J.; van Dam, W. Instance Independence of Single Layer Quantum Approximate Optimization Algorithm on Mixed-Spin
Models at Infinite Size. arXiv 2021, arXiv:2102.12043.
17. Wang, Z.; Rubin, N.C.; Dominy, J.M.; Rieffel, E.G. X Y mixers: Analytical and numerical results for the quantum alternating
operator ansatz. Phys. Rev. A 2020, 101, 012320. [CrossRef]
18. Hodson, M.; Ruck, B.; Ong, H.; Garvin, D.; Dulman, S. Portfolio rebalancing experiments using the Quantum Alternating
Operator Ansatz. arXiv 2019, arXiv:1911.05296.
94
Mathematics 2022, 10, 2601
19. Tsoulos, I.G.; Stavrou, V.; Mastorakis, N.E.; Tsalikakis, D. GenConstraint: A programming tool for constraint optimization
problems. SoftwareX 2019, 10, 100355. [CrossRef]
20. Lloyd, S. Quantum approximate optimization is computationally universal. arXiv 2018, arXiv:1812.11075.
21. Morales, M.E.; Biamonte, J.; Zimborás, Z. On the universality of the quantum approximate optimization algorithm. Quantum Inf.
Process. 2020, 19, 1–26. [CrossRef]
22. Rabinovich, D.; Adhikary, S.; Campos, E.; Akshay, V.; Anikin, E.; Sengupta, R.; Lakhmanskaya, O.; Lakhmanskiy, K.; Biamonte, J.
Ion native variational ansatz for quantum approximate optimization. arXiv 2022, arXiv:2206.11908.
23. Jiang, Z.; Rieffel, E.G.; Wang, Z. Near-optimal quantum circuit for Grover’s unstructured search using a transverse field. Phys.
Rev. A 2017, 95, 062317. [CrossRef]
24. Hastings, M.B. Classical and quantum bounded depth approximation algorithms. arXiv 2019, arXiv:1905.07047.
25. Bravyi, S.; Kliesch, A.; Koenig, R.; Tang, E. Obstacles to State Preparation and Variational Optimization from Symmetry Protection.
Phys. Rev. Lett. 2019, 125, 260505. [CrossRef]
26. Akshay, V.; Philathong, H.; Zacharov, I.; Biamonte, J. Reachability Deficits in Quantum Approximate Optimization of Graph
Problems. Quantum 2021, 5, 532. [CrossRef]
27. Akshay, V.; Rabinovich, D.; Campos, E.; Biamonte, J. Parameter concentrations in quantum approximate optimization. Phys. Rev.
A 2021, 104, L010401. [CrossRef]
28. Campos, E.; Rabinovich, D.; Akshay, V.; Biamonte, J. Training saturation in layerwise quantum approximate optimization. Phys.
Rev. A 2021, 104, L030401. [CrossRef]
29. Shaydulin, R.; Wild, S.M. Exploiting symmetry reduces the cost of training QAOA. IEEE Trans. Quantum Eng. 2021, 2, 1–9.
[CrossRef]
30. Streif, M.; Leib, M. Comparison of QAOA with quantum and simulated annealing. arXiv 2019, arXiv:1901.01903.
31. Skolik, A.; McClean, J.R.; Mohseni, M.; van der Smagt, P.; Leib, M. Layerwise learning for quantum neural networks. Quantum
Mach. Intell. 2021, 3, 1–11. [CrossRef]
95
mathematics
Article
A Fast Quantum Image Component Labeling Algorithm
Yan Li 1, *, Dapeng Hao 2 , Yang Xu 3 and Kinkeung Lai 4
Keywords: quantum image processing; image component labeling; local operator; Levialdi shrink-
ing operator
MSC: 81P68
been extended to the quantum imaging processing domain. Image component labeling is
the most fundamental preprocessing required for image understanding, pattern recognition,
and computer vision. By use of the labeling operation, a unique label is assigned to each
connected region so that higher-level operations can process different regions separately. In
some applications, image component labeling is still an active area of research in classical
image processing, which has been proved to be one of the most time-consuming tasks in
pattern recognition [41]. The parallel processing characteristic is the great advantage of
quantum computation, which is one feasible way to accelerate image component labeling.
This paper proposes a fast quantum image component labeling algorithm based on
a modified NEQR representation model for binary images, a quantum counterpart of
classical local-operator techniques [42]. The quantum image component labeling algorithm
consists of three main steps. Firstly, a binary image is represented by the quantum version
using the modified NEQR model. Secondly, all pixels of the image are simultaneously
worked upon by the quantum parallel-shrink operator several times until each black pixel
changes to white, and the connectivity relations are reserved during the processing. Finally,
the quantum label-propagate operator is executed on each pixel to restore the pixels with
changed colors and each pixel assigns different numbers to different connected areas at
the same time. The process is in reverse order to the image generated by the quantum
parallel-shrink operations.
The rest of the paper is organized as follows. Section 2 briefly introduces classical
local-operator techniques, giving a detailed example specifying how to operate the binary
image to obtain the labels for the connected area. The purposed quantum version of
the local-operator technique, as well as circuit design, is described in Section 3. Section 4
analyzes the circuit complexity. Simulation results based on the classical computer’s Python
software are given in Section 5. Finally, the conclusions are drawn in Section 6.
2. Local-Operator Technique
A connected region or component in a binary image is a maximal connected set of
black pixels. The image component labeling algorithm assigns a unique label to each
connected region in the image. Thus, in the labeled image, any two black pixels have the
same label if and only if they lie in the same connected region. Local-operator techniques
involve two types of local operations used for image region labeling: Parallel-shrink and
Label-propagate. The two operators use local information from the neighborhood of a pixel
to determine its new value.
98
Mathematics 2022, 10, 2718
Figure 1. Neighborhoods.
where H is the Heaviside operator defined by H (t) = 0 for t ≤ 0 and H (t) = 1 if t > 0.
Since a is a binary image, it is easy to express ϕs using the logic operations ∧( and) and
∨(or ) as follows:
a (i, j) = (a(i, j) ∧ (a(i, j + 1) ∨ a(i + 1, j) ∨ a(i + 1, j + 1))) ∨ (a(i, j + 1) ∧ a(i + 1, j)) (2)
The parallel-shrink operator shrinks the components toward the top left corner of
the bounding rectangles of connected components. The two important properties of the
shrinking procedure are as follows:
1. No connected component becomes disconnected.
2. No two disconnected components become connected in any step.
A component with an internal diameter r will shrink to a single black pixel after
r − 1 shrinking steps, and then disappear in the next shrinking step. After each shrinking
operation, a different image is obtained and the result of applying the shrinking operation
y times to the original image is called partial result y. Thus, we have a sequence of images
ay , ay−1 , · · · , a0 , a0 representing the initial binary image.
where lmaxr+1 = lr+1 (i, j) ∨ lr+1 (i, j − 1) ∨ lr+1 (i − 1, j) ∨ lr+1 (i − 1, j) ∨ lr+1 (i − 1, j − 1),
∨ is a bit-wise logic or operation.
Note that, first, we must ensure that labels of the four neighbors for whom the value is
not zero on Np remain the same after Equation (3) is executed, then:
⎧
⎨ lr (i, j − 1) = lr (i, j)
⎪ i f ar (i, j − 1) = 1
lr (i − 1, j) = lr (i, j) i f ar (i − 1, j) = 1 (4)
⎪
⎩
lr (i − 1, j − 1) = lr (i, j) i f ar (i − 1, j − 1) = 1
99
Mathematics 2022, 10, 2718
Second, we should backfill the value 1 of pixels based on partial result y during
propagating.
(a) (b)
Phase 1 Preparation: When every pixel has its Ns and Np neighbors, the original
image is extended by a 1-pixel outer border that pads the border of the image with white.
The white pixels (0 value) are ignored in the board so that we can focus better on changes
in the black regions (1 value), as shown in Figure 2b.
Phase 2 Parallel shrinking: In Phase 2, the parallel-shrink operator, (1) or (2), is
performed on every pixel simultaneously. Since the maximum value of the internal diameter
of the two connected regions is 3, the operator would be applied three times, and then all
pixels of the image will change to 0 and that completes Phase 2. Figure 2c–e depict the
100
Mathematics 2022, 10, 2718
performance process. In Figure 2c–e, we only show the pixels that were changed using the
red dotted box.
Phase 3 Label propagating: As mentioned before, label propagating is a reverse-order
process, so Equations (3) and (4) are applied for the same number of times as Phase 2. The
process order is indicated in Figure 2f–h using the left arrow, and the purple dotted boxes
are used for marking the label change. In Figure 2h, p(1, 1), p(2, 5), and p(3, 4) are labeled
with different numbers based on (3) at the same time. We use the row–column criterion
to label the pixels. In Figure 2f, serial numbers of the pixels that have been labeled are
represented in the upper left corner box, p(1, 2), p(2, 1), p(3, 5), p(4, 4) need new labels
based on Equation (3), and p(2, 5) needs a change of the labeled number based on Equation
(4) to keep consistent with p(3, 5)’s Np neighbors. In Figure 2f, the last two pixels, p(2, 2)
and p(4, 5), are labeled, which means that label propagating is finished, and two different
label numbers are obtained.
The example shows that the local-operator technique is a parallel method that is
performed simultaneously on every pixel, so it only takes O(n) time and is a type of fast
image component labeling method.
√ 1 ∑2 −1 ∑2 −1 | f (Y, X )
m n
|I = X =0 ⊗ |YX
2m + n Y =0
(5)
2m − 1 2n − 1
= √ 1 ∑ ∑ X =0 | LPB ⊗ |YX
2m + n Y = 0
101
Mathematics 2022, 10, 2718
√ 1 ∑2 −1 ∑2 −1 | f (Y, X )
m n
Sx± (| I ) = X =1 ⊗Sx± (|YX )
2m + n Y =1
(7)
2m −1 2n − 1
= √ 1 ∑ ∑ X =1 | f (Y, X ) ⊗ |Y |( X ± 1)mod2n
2m + n Y =1
√ 1 ∑2 −1 ∑2 −1 | f (Y, X )
m n
Sy± (| I ) = X =1 ⊗Sy± (|YX )
2m + n Y =1
(8)
2m −1 2n − 1
= √ 1 ∑ ∑ X =1 | f (Y, X ) ⊗ |(Y ± 1)mod2n | X
2m + n Y =1
Based on the above analysis, Equations (7) and (8) are equivalent to Equations (9) and (10),
respectively.
1 2m − 1 2n −1 33 5
Sx± (| I ) = √ ∑ Y =1 ∑ X =1
f (Y, X ) ⊗Sx± (|YX ) (9)
2 m + n
1 2m − 1 2n −1 33 5
Sy± (| I ) = √ ∑ Y =1 ∑ X =1
f (Y , X ) ⊗Sy± (|YX ) (10)
2 m + n
102
Mathematics 2022, 10, 2718
(a)
(b)
Figure 4. Address shift operation circuit. (a) Shift + operator circuit. (b) Shift − operator circuit.
(a) (b)
Figure 5. Logic operation circuit. (a) Logic operation ∧ (AND). (b) Logic operation ∨ (OR).
103
Mathematics 2022, 10, 2718
104
Mathematics 2022, 10, 2718
n-bit full addition circuit is a cascade of 1-bit full addition circuit as shown in Figure 8 [44].
|Ci−1 is the (i − 1)th carry qubit, | ai is the ith augend number, |bi is the ith addend
number, |Ci is the ith carry qubit, and |Si is the sum of a + b. The relationships among
| ai , |bi , |Ci−1 , |Ci and |Si are given by
(a)
(b)
Figure 8. Full addition circuit. (a) 1-bit full addition circuit. (b) n-bit full addition circuit.
| Di = | ai ⊕ bi ⊕ Bi−1 (13)
105
Mathematics 2022, 10, 2718
(a)
(b)
Figure 9. Full subtractor circuit. (a) 1-bit full subtractor circuit. (b) n-bit full subtractor circuit.
106
Mathematics 2022, 10, 2718
The second step, the Levialdi operator, is implemented through Logic operation
circuits, and the designed circuit is shown in Figure 11. The number of ancilla qubits used
is the same as the number of Logic operators.
The third step, the number of partial results, is stored in | P through the full addition
circuit, and the designed circuit is shown in Part 3 of Figure 12. If |result = |0 and
| B = |1 , then P = P + 1. Fourthly, the value of pixels | B is updated through CNOT gate
(Part 4 of Figure 12). Finally, the number of loops i = i + 1 through the full addition circuit
is shown in Part 5 of Figure 12. The circuit of Equation (2) is shown in Figure 12.
107
Mathematics 2022, 10, 2718
The second step, the computation of lmax, is implemented through Logic operation
circuits, and the designed circuit is shown in Figure 14.
In the third step, the global variable i − 1 and Equation (3) are implemented through
the designed circuit shown in Figure 15. The condition of Equation (3) is realized in part 1,
| Pi , and |i as input to comparer CM1, and Pi = 1 means that the color of the pixel
changes from 1 to 0, so Pi−1 = 1 is equivalent to a(i, j) = 1. Comparer CM2 is used to
determine if lmaxi = 0. If Pi−1 = i and lmaxi = 0, part 2 is executed, the global variable
l = l + 1, then assign l to li−1 (i, j) using control assignment operator AO. If Pi−1 = i and
lmaxi = 0, part 3 is executed, and the control assignment operator AO is used to implement
li−1 (i, j) = lmaxi .
In the fourth step, Equation (4) is implemented through the designed circuit shown
in Figure 16. li−1 (i, j) is stored in ancilla qubits using CNOT gate in part 1. In part 2,
li−1 (i, j − 1) is obtained using address shift operator SY −1 , the condition of ai−1 (i, j − 1) is
realized using comparer CM, and then equation lr (i, j − 1) = lr (i, j) is implemented using
control assignment operator AO. Part 3 and part 4 use the same circuits as part 2 to achieve
the same assignment function. In part 5, the initial state is restored.
108
Mathematics 2022, 10, 2718
109
Mathematics 2022, 10, 2718
O(4n2 + 24 + (18n − 18) + 2n2 + (14n − 14) + 24n) = O(6n2 + 56n − 8) ≈ O(6n2 )
According to the above analysis, time complexity of the proposed quantum image com-
ponent labeling algorithm is O(10n2 ) ≈ O(n2 ), which is only the second-order polynomial
function of image size.
110
Mathematics 2022, 10, 2718
Table 1. Number of ancilla qubits used by the basic quantum functional circuits.
111
Mathematics 2022, 10, 2718
Figure 18. The example of traffic signs. (a) original image. (b) binary image. (c) component labeling.
6. Conclusions
In recent years, with the sharp increase in image data processing, the problem of real-
time processing has become a limitation in classical image processing. An image component
labeling algorithm is an important pre-processing operation in many image processing
algorithms. However, in quantum image processing, component labeling algorithm has
not been reported in extant literature. In this paper, we develop a quantum version of the
image component labeling algorithm which makes full use of quantum parallelism. Firstly,
the modified NEQR model is used to represent the information of binary image. Secondly,
basic function circuits are prepared. Thirdly, the quantum circuits of parallel shrinking and
label propagating are designed by using the basic function circuits. The purposed circuits
can process information of all the pixels simultaneously, which can improve the efficiency
of image preprocessing.
Quantum image processing applications have developed only in recent years. The
results obtained in this paper could be used in more quantum image processing algorithms.
In the future, we will be working to develop new quantum image analysis algorithms based
on the quantum component labeling algorithm, especially in the fields of transportation,
logistics, and robot navigation.
112
Mathematics 2022, 10, 2718
Author Contributions: Conceptualization, Y.L. and D.H; methodology, K.L.; software, D.H.; valida-
tion, Y.X.; writing—original draft preparation, Y.L.; writing—review and editing, D.H.; supervision,
K.L. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.
Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.
Data Availability Statement: Not applicable.
Acknowledgments: The authors are thankful to the editor and the reviewers for their valuable
comments and suggestions that helped to improve the quality of the paper.
Conflicts of Interest: The authors declare no conflict of interest.
References
1. Venegas-Andraca, S.E.; Bose, S. Storing, Processing, and Retrieving an Image Using Quantum Mechanics. Quantum Inf. Comput.
2003, 5105, 137–147.
2. Venegas-Andraca, S.E.; Ball, J. Processing images in entangled quantum systems. Quantum Inf. Processing 2010, 9, 1–11. [CrossRef]
3. Le, P.Q.; Dong, F.; Hirota, K. A flexible representation of quantum images for polynomial preparation, image compression, and
processing operations. Quantum Inf. Processing 2011, 10, 63–84. [CrossRef]
4. Zhang, Y.; Lu, K.; Gao, Y.; Xu, K. A novel quantum representation for log-polar images. Quantum Inf. Processing 2013, 12, 3103–3126.
[CrossRef]
5. Zhang, Y.; Lu, K.; Gao, Y.; Wang, M. NEQR: A novel enhanced quantum representation of digital images. Quantum Inf. Processing
2013, 12, 2833–2860. [CrossRef]
6. Mastriani, M. Quantum Boolean image denoising. Quantum Inf. Processing 2015, 14, 1647–1673. [CrossRef]
7. Yuan, S.; Mao, X.; Xue, Y.; Chen, L.; Xiong, Q.; Compare, A. SQR: A simple quantum representation of infrared images. Quantum
Inf. Processing 2014, 13, 1353–1379. [CrossRef]
8. Sun, B.; Iliyasu, A.; Yan, F.; Dong, F.; Hirota, K.J. An RGB multi-channel representation for images on quantum computers. J. Adv.
Comput. Intell. Intell. Inform. 2013, 17, 404–415. [CrossRef]
9. Li, H.-S.; Zhu, Q.; Zhou, R.-G.; Song, L.; Yang, X.-J. Multi-dimensional color image storage and retrieval for a normal arbitrary
quantum superposition state. Quantum Inf. Processing 2014, 13, 991–1011. [CrossRef]
10. Sang, J.; Wang, S.; Li, Q. A novel quantum representation of color digital images. Quantum Inf. Processing 2017, 16, 42. [CrossRef]
11. Abdolmaleky, M.; Naseri, M.; Batle, J.; Farouk, A.; Gong, L.-H. Red-Green-Blue multi-channel quantum representation of digital
images. Optik 2017, 128, 121–132. [CrossRef]
12. Xu, G.; Xu, X.; Wang, X.; Wang, X. Order-encoded quantum image model and parallel histogram specification. Quantum Inf.
Processing 2019, 18, 346. [CrossRef]
13. Khan, R.A. An improved flexible representation of quantum images. Quantum Inf. Processing 2019, 18, 201. [CrossRef]
14. Wang, L.; Ran, Q.; Ma, J.; Yu, S.; Tan, L. QRCI: A new quantum representation model of color digital images. Opt. Commun. 2019,
438, 147–158. [CrossRef]
15. Chen, G.-L.; Song, X.-H.; Venegas-Andraca, S.E.; El-Latif, A.; Ahmed, A. QIRHSI: Novel quantum image representation based on
HSI color space model. Quantum Inf. Processing 2022, 21, 5. [CrossRef]
16. Zhu, H.-H.; Chen, X.-B.; Yang, Y.-X. Image preparations of multi-mode quantum image representation and their application on
quantum image reproduction. Optik 2022, 251, 168321. [CrossRef]
17. Le, P.Q.; Iliyasu, A.M.; Dong, F.; Hirota, K. Strategies for designing geometric transformations on quantum images. Theor. Comput.
Sci. 2011, 412, 1406–1418. [CrossRef]
18. Wang, J.; Jiang, N.; Wang, L. Quantum image translation. Quantum Inf. Processing 2015, 14, 1589–1604. [CrossRef]
19. Le, P.Q.; Iliyasu, A.M.; Dong, F.; Hirota, K. Fast Geometric Transformations on Quantum Images. Int. J. Appl. Math. 2010, 40, 3.
20. Jiang, N.; Wang, J.; Mu, Y. Quantum image scaling up based on nearest-neighbor interpolation with integer scaling ratio. Quantum
Inf. Processing 2015, 14, 4001–4026. [CrossRef]
21. Sang, J.; Wang, S.; Niu, X. Quantum realization of the nearest-neighbor interpolation method for FRQI and NEQR. Quantum Inf.
Processing 2016, 15, 37–64. [CrossRef]
22. Li, P.; Liu, X. Bilinear interpolation method for quantum images based on quantum Fourier transform. Int. J. Quantum Inf. 2018,
16, 1850031. [CrossRef]
23. Zhou, R.-G.; Cheng, Y.; Liu, D. Quantum image scaling based on bilinear interpolation with arbitrary scaling ratio. Quantum Inf.
Processing 2019, 18, 267. [CrossRef]
24. Jiang, N.; Wang, L. Analysis and improvement of the quantum Arnold image scrambling. Quantum Inf. Processing 2014, 13, 1545–1551.
[CrossRef]
25. Zhou, R.-G.; Sun, Y.-J.; Fan, P. Quantum image Gray-code and bit-plane scrambling. Quantum Inf. Processing 2015, 14, 1717–1734.
[CrossRef]
113
Mathematics 2022, 10, 2718
26. Caraiman, S.; Manta, V.I. Histogram-based segmentation of quantum images. Theor. Comput. Sci. 2014, 529, 46–60. [CrossRef]
27. Caraiman, S.; Manta, V.I. Image segmentation on a quantum computer. Quantum Inf. Processing 2015, 14, 1693–1715. [CrossRef]
28. Wang, X.; Yang, C.; Xie, G.-S.; Liu, Z. Image thresholding segmentation on quantum state space. Entropy 2018, 20, 728. [CrossRef]
29. Li, P.; Shi, T.; Zhao, Y.; Lu, A. Design of threshold segmentation method for quantum image. Int. J. Theor. Phys. 2020, 59, 514–538.
[CrossRef]
30. Zhang, Y.; Lu, K.; Gao, Y. QSobel: A novel quantum image edge extraction algorithm. Sci. China Inf. Sci. 2015, 58, 1–13. [CrossRef]
31. Fan, P.; Zhou, R.-G.; Hu, W.W.; Jing, N. Quantum image edge extraction based on Laplacian operator and zero-cross method.
Quantum Inf. Processing 2019, 18, 27. [CrossRef]
32. Fan, P.; Zhou, R.-G.; Hu, W.; Jing, N. Quantum image edge extraction based on classical Sobel operator for NEQR. Quantum Inf.
Processing 2019, 18, 24. [CrossRef]
33. Zhou, R.-G.; Yu, H.; Cheng, Y.; Li, F.-X. Quantum image edge extraction based on improved Prewitt operator. Quantum Inf.
Processing 2019, 18, 261. [CrossRef]
34. Li, P.; Shi, T.; Lu, A.; Wang, B. Quantum implementation of classical Marr–Hildreth edge detection. Quantum Inf. Processing 2020,
19, 64. [CrossRef]
35. Chetia, R.; Boruah, S.; Sahu, P. Quantum image edge detection using improved Sobel mask based on NEQR. Quantum Inf.
Processing 2021, 20, 21. [CrossRef]
36. Jiang, N.; Dang, Y.; Wang, J. Quantum image matching. Quantum Inf. Processing 2016, 15, 3543–3572. [CrossRef]
37. Dang, Y.; Jiang, N.; Hu, H.; Zhang, W. Analysis and improvement of the quantum image matching. Quantum Inf. Processing 2017,
16, 269. [CrossRef]
38. Luo, G.; Zhou, R.-G.; Liu, X.; Hu, W.; Luo, J. Fuzzy matching based on gray-scale difference for quantum images. Int. J. Theor.
Phys. 2018, 57, 2447–2460. [CrossRef]
39. Heidari, S.; Naseri, M. A novel LSB based quantum watermarking. Int. J. Theor. Phys. 2016, 55, 4205–4218. [CrossRef]
40. Hu, W.; Zhou, R.-G.; Luo, J.; Liu, B. LSBs-based quantum color images watermarking algorithm in edge region. Quantum Inf.
Processing 2019, 18, 16. [CrossRef]
41. He, L.; Ren, X.; Gao, Q.; Zhao, X.; Yao, B.; Chao, Y. The connected-component labeling problem: A review of state-of-the-art
algorithms. Pattern Recognit. 2017, 70, 25–43. [CrossRef]
42. Alnuweiri, H.M.; Prasanna, V.K. Parallel architectures and algorithms for image component labeling. IEEE Trans. Pattern Anal.
Mach. Intell. 1992, 14, 1014–1034. [CrossRef]
43. Levialdi, S. On shrinking binary picture patterns. Commun. ACM 1972, 15, 7–10. [CrossRef]
44. Cheng, K.-W.; Tseng, C.-C. Quantum full adder and subtractor. Electron. Lett. 2002, 38, 1343–1344. [CrossRef]
45. Barenco, A.; Bennett, C.H.; Cleve, R.; DiVincenzo, D.P.; Margolus, N.; Shor, P.; Sleator, T.; Smolin, J.A.; Weinfurter, H. Elementary
gates for quantum computation. Phys. Rev. A 1995, 52, 3457. [CrossRef] [PubMed]
46. Nielsen, M.A.; Chuang, I. Quantum Computation and Quantum Information, 10th ed.; Cambridge University Press: Cambridge,
UK, 2010.
47. LaRose, R. Overview and comparison of gate level quantum software platforms. Quantum 2019, 3, 130. [CrossRef]
48. Bolelli, F.; Cancilla, M.; Baraldi, L.; Grana, C.J. Toward reliable experiments on the performance of connected components labeling
algorithms. J. Real Time Image Processing 2020, 17, 229–244. [CrossRef]
49. Chang, F.; Chen, C.-J.; Lu, C.-J. A linear-time component-labeling algorithm using contour tracing technique. Comput. Vis. Image
Underst. 2004, 93, 206–220. [CrossRef]
50. Wu, K.; Otoo, E.; Suzuki, K. Optimizing two-pass connected-component labeling algorithms. Pattern Anal. Appl. 2009, 12, 117–135.
[CrossRef]
114
MDPI
St. Alban-Anlage 66
4052 Basel
Switzerland
Tel. +41 61 683 77 34
Fax +41 61 302 89 18
www.mdpi.com