<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Constant-time quantum algorithm for homology detection in closed curves</title></titleStmt>
			<publicationStmt>
				<publisher></publisher>
				<date>01/01/2023</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10462016</idno>
					<idno type="doi">10.21468/SciPostPhys.15.2.049</idno>
					<title level='j'>SciPost Physics</title>
<idno>2542-4653</idno>
<biblScope unit="volume">15</biblScope>
<biblScope unit="issue">2</biblScope>					

					<author>Nhat Anh Nghiem Vu</author><author>Xianfeng David Gu</author><author>Tzu-Chieh Wei</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Given a loop or more generally 1-cycle                                                r                                      r                                                              of size L on a closed two-dimensional manifold or surface, represented by a triangulated mesh, a question in computational topology asks whether or not it is homologous to zero. We frame and tackle this problem in the quantum setting. Given an oracle that one can use to query the inclusion of edges on a closed curve, we design a quantum algorithm for such a homology detection with a constant running time, with respect to the size or the number of edges on the loop                                                r                                      r                                                              , requiring only a single usage of oracle. In contrast, classical algorithm requires                                                \Omega(L)                                                            Ω                                              (                        L                        )                                                                                                        oracle usage, followed by a linear time processing and can be improved to logarithmic by using a parallel algorithm. Our quantum algorithm can be extended to check whether two closed loops belong to the same homology class. Furthermore, it can be applied to a specific problem in the homotopy detection, namely, checking whether two curves are not homotopically equivalent on a closed two-dimensional manifold.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><p>1 Introduction</p><p>Topology and geometry are among the most classic and fundamental areas in pure mathematics. Despite being abstract and sometimes counter-intuitive, their role in both science and engineering has been impactful. In physics, ideas from topology have provided a framework that explains phases of matter beyond Landau's symmetry-breaking theory <ref type="bibr">[1]</ref>, such as the so-called topological phase of matter, and offered the prospect of fault tolerance with schemes of topological quantum computation <ref type="bibr">[2]</ref>. In engineering and applied sciences, for example, topological data analysis <ref type="bibr">[3,</ref><ref type="bibr">4]</ref> employs techniques from topology to analyze and identify patterns or shapes of high-dimensional data. The foundation of computational conformal geometry has also been laid out <ref type="bibr">[5]</ref><ref type="bibr">[6]</ref><ref type="bibr">[7]</ref>, providing valuable tools for applications, such as mechanical designs, medical imaging, computer vision, and so on. At the same time, the notion of quantum computers <ref type="bibr">[8]</ref><ref type="bibr">[9]</ref><ref type="bibr">[10]</ref><ref type="bibr">[11]</ref> has generated an entirely new frontier in computational science. By harnessing the enigmatic properties of quantum mechanics, such as entanglement and superposition, quantum computers possess the potential to handle specific challenging computational problems that are not thought to be efficient within reach of classical computers. Some famous classic problems including factorization <ref type="bibr">[9]</ref>, unstructured search <ref type="bibr">[10]</ref>, and linear system solvers <ref type="bibr">[12]</ref>, etc. The use of quantum computers has also been extended to the modern context, such as machine learning and data science <ref type="bibr">[13]</ref><ref type="bibr">[14]</ref><ref type="bibr">[15]</ref><ref type="bibr">[16]</ref><ref type="bibr">[17]</ref><ref type="bibr">[18]</ref><ref type="bibr">[19]</ref><ref type="bibr">[20]</ref><ref type="bibr">[21]</ref><ref type="bibr">[22]</ref><ref type="bibr">[23]</ref>. In Ref. <ref type="bibr">[24]</ref>, quantum computational techniques were applied to topological data analysis; specifically, a quantum algorithm was constructed to estimate Betti numbers of a given simplicial complex, which yields an exponential speedup compared to classical algorithms.</p><p>Inspired by the development in both quantum computation and computational topology and geometry, here, we attempt to apply quantum approaches to advancing tools and solving problems in topology and geometry. As a small step, we consider the problem of detecting the homology class of closed curves or 1-cycles. As explained below, the ability to detect homologically trivial curves provides a means to a related problem in the homotopy detection. The precise statement of our main problem is as follows: given a closed surface, represented as a triangular mesh, and a closed curve (or loop) on the surface, we want to know whether or not the curve is homologous to zero, i.e., trivial homologically. Remarkably, given a sufficient number of qubits and the oracle that queries the curve, our algorithm can detect a given closed curve's homology class of with certainty at a constant time complexity. We remark that reducing efficient classical solutions to even more efficient quantum algorithms is also of interest from the complexity perspective. One such example is the 2D hidden linear function problem <ref type="bibr">[25]</ref>.</p><p>The structure of this paper is as follows. First in Sec. 2, we introduce and clarify some terms/terminologies that are relevant to our subsequent construction. We mention some assumptions that our algorithm relies on in Sec. 3. In Sec. 4, we explicitly construct the quantum algorithm for detecting the homology class of closed curves. We conclude with some discussions and an outlook in Sec. 5. Along the way, we have also developed an efficient algorithm that creates a uniform superposition of computational basis states that are in a consecutive sequence; see the Appendix. Here, we give a quick overview of homology and cohomology concepts. In the language of algebraic topology, see, e.g., Ref. <ref type="bibr">[26]</ref>, we can treat a (discrete) surface as a simplicial complex, consisting of different dimensional simplices. The linear combinations of simplices, in which the coefficients belong to some ring R, form chains. Two common rings that are usually used are Z 2 and Z. A curve is then a 1-chain in the discrete setting. The set of k-chains forms a linear vector space called the chain space, denoted by C k . There is a map between two chain spaces C k and C k-1 called the boundary map</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Preliminaries 2.1 Overview of essential concepts in homology and cohomology</head><p>which maps a k-chain to its boundaries, as illustrated in Fig. <ref type="figure">1</ref>.</p><p>A k-chain &#963; k is called closed if &#8706; k &#963; k = 0, and it is also referred to as a k-cycle. A loop is such an example. A k-chain &#963; k is called exact if there exists a (k+1)-chain &#963; k+1 such that</p><p>We note that exact chains are closed by virtue of an important property of boundary map <ref type="bibr">[6]</ref>: &#948; &#8226; &#948; = 0. Two closed k-chains are equivalent if they differ by an exact k-chain. The equivalence relation divides k-chains into the so-called homology classes, denoted as H k (M, Z) (where we assume the ring is Z, for simplicity). Homology theory reflects the algebraic structure (note that connectivity between points is the key) of a given simplicial complex via the corresponding homology classes, or more precisely, homology groups.</p><p>On the other hand, cohomology is dual to homology. Given a k-chain &#963;, a k-cochain w maps it to a real number w(&#963;) &#8712; R. We can think of cohomology as the association of elements in homology with a real number. Due to the linearity of their vector spaces, it is convenient to use a basis in homology and the dual basis in cohomology groups. For a closed surface of genus g, the dimension of homology/cohomology basis is 2g. Given a homology basis &#10216;h 1 , h 2 , . . . , h 2g &#10217;, the corresponding cohomology basis, denoted by as &#10216;&#8486; 1 , &#8486; 2 , . . . , &#8486; 2g &#10217;, can be constructed, such that</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>An arbitrary closed curve &#947; is homologous to zero if and only if</head><p>&#947;</p><p>More concretely, if the closed curves &#947; has L oriented edges labeled by &#8407; e j , such that</p><p>where &#946; j &#8712; Z. Then the above condition of being homologically zero means that for every &#945;, we have:</p><p>This formulation is more suitable for constructing of our quantum algorithm, presented later.</p><p>The run time for a naive classical algorithms is O(2g &#8226; L) <ref type="bibr">[5]</ref>, where L is the number of edges (1-chains) on the closed curve r, and, therefore, the larger the loop is, the more computational time is required <ref type="bibr">[6,</ref><ref type="bibr">7,</ref><ref type="bibr">27]</ref>. This seems reasonable, as whether a loop is homologically zero is a global and topological property. We remark that the key step is to perform the summation along the curve r (see equation 2), so the running time can be improved to logarithmics by using parallel algorithm (for example, we can divide the edges into groups and sum them individually, then summing over). However, this parallel algorithm increases the memory usage by O(L) (naive approach takes constant memory). Regarding oracle usage, those above two classical approaches require &#8486;(L) usages, as classical algorithm is supposed to query all the edges to completely specify the loop. However, we will provide a quantum algorithm below and show that it can determine the homology property of a given closed curve (specified by some oracle O r that only checks local properties) with running time O(2g), where g is the genus of the surface, and a single usage of oracle. Thus, as we will show, if there are sufficient ancillary qubits in the phase estimation step in our algorithm, then the homology class of the given closed curve could be determined in constant time, with respect to the size L of the curve.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.2">Mesh Data Structure</head><p>Despite the fact that surfaces are continuous, in real applications, such as digital geometry processing, they are usually represented as a triangulated polyhedron surface, namely a triangular mesh; see, e.g. Fig. <ref type="figure">2</ref> for illustration. A mesh M = (V, E, F ) consists of sets of vertices V , edges E, and faces F . We can think of it as a graph with vertices and edges that connect vertices. In terms of the algebraic topology, it is precisely a two-dimensional simplicial complex.</p><p>We denote the set of vertices as V = {v 0 , v 1 , ..., v M }. For a given edge e i that connects two vertices v j , v k , for instance, a half-edge is an oriented edge &#8407; e i = [v j , v k ], which implies the orientation v j &#8594; v k . We simply denote -&#8407; e i = [v k , v j ] for the reverse order of the edge and vertices and use the vector notation &#8407; e i just to emphasize the orientation. The importance of half-edges is apparent for the purpose of computation with cohomology. Suppose w is a 1-cochain, then for a given 1-chain (edge) e i connecting v j and v k , we have w([v j , v k ]) = -w([v k , v j ]), i.e., w(-&#8407; e i ) = -w(&#8407; e i ). An exact 1-cochain can be constructed from some 0-cochains f by taking the coboundary map d:</p><p>Using this, we explain in Appendix A how the cohomology basis (which is exact) can be constructed simply by subtracting some carefully initialized 0-form.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">Setup for the quantum approach</head><p>Here we describe several assumptions for the input of our quantum algorithm to be described in the next section.</p><p>Preprocessing Mesh: We remark that we do not consider the problem of generating triangulated mesh here. We assume that such a step is done classically.</p><p>Homology and Cohomology Basis: Similar to classical algorithms, we assume that the homology basis has been pre-computed classically, and the cohomology basis has also been constructed accordingly. In other words, we have predefined values for each edge (with orientation) of the mesh. In fact, for most such half-edges, these values are 0, except for a few that connect those neighboring points on and off the homology basis, which can have values 1 or -1, dependent on the orientation of the half-edge; see also Appendix A. For each cohomology basis &#8486; &#945; , denote the number of those non-zero values as c &#945; . We further assume that two curves in the homology basis only intersects at no more than one vertex, which means that the two cohomology basis elements have nonzero value at no more than one common edge. Those conditions can always be satisfied, using a result of <ref type="bibr">[28]</ref>. Moreover, we assume the number edge E is known and that the value of c &#945; (number of edges on which &#8486; &#945; has a nonzero value) is known for all &#945; via classical pre-processing.</p><p>Encoding of Cohomology Basis in a Quantum State: As described above, we can think of cohomology as the association of each half-edge (1-simplex) with a real number. Therefore, in principle, we could map these values to some quantum state with corresponding entries using &#8764; O(log 2 (E)) qubits, where E is the total number of edges on the mesh. We remark that the values on most edges are zero, except for those edges that connect points on the homology basis to their neighboring points that are not on the basis <ref type="bibr">[7]</ref>; see also Appendix A. We first need to map such a cohomology basis to the quantum state. A vector corresponding to a basis &#8486; &#945; (with &#945; = 1, . . . , 2g) has the form</p><p>where the component in the vector represents the value &#8486; a ( &#8407; e j ) = &#969; (&#945;) j on each edge. By choosing the orientations of the edges appropriately and using &#8486; &#945; (-&#8407; e j ) = -&#8486; &#945; ( &#8407; e j ), we can make the nonzero entries be uniformly +1. We can also re-arrange the edge labeling so that &#8407; &#8486; 1 = [1, 1, . . . , 1, 0, . . . , 0] T and &#8407; &#8486; 2 = [0, . . . , 1, 1 . . . , 1, 0, . . . , 0] T , etc., where if &#8407; &#8486; 2 overlaps with &#8407; &#8486; 1 on an edge, we will arrange such that the particular overlapped edge corresponds to the last nonzero entry in &#8407; &#8486; 1 and the first nonzero entry in &#8407; &#8486; 2 ; otherwise, the first nonzero entry of &#8407; &#8486; 2 will be the next entry to the last nonzero one in &#8407; &#8486; 1 . Thus, for simplicity, we shall fix the orientation of edges such that all the nonzero entries are +1. That is those oriented edges &#8407; e i are regarded as the 'positive' half-edges, &#8486; &#945; (&#8407; e i ) = +1. For any edge e i , we can label it by some computational basis state, which we also denote as |e i &#10217; (e.g. |0101 . . . &#10217;) and its orientation will be flagged by another ancillary qubit,</p><p>One can easily see that the quantum state corresponds to each of the vector &#8407; &#8486; &#945; (normalized to 1) is just a uniform superposition of some basis states that encode the edges that are labelled in a consecutive way, and this superposition can be prepared with a very low cost, as we elaborate further in Appendix C. In the simplest scenario, for example, the number of non-zero values is a power of 2, and all those entries lie in "perfect" locations that could give us a simple, convenient way to prepare the corresponding quantum cohomology basi, using Hadamard gates H &#8855;n only. For example, we consider the following vector of represent their cohomology basis values on four edges:</p><p>whose corresponding quantum state |x&#10217; is simply |0&#10217; |+&#10217;, which can be prepared simply by applying I &#8855; H to |0&#10217; |1&#10217;.</p><p>However, we may not have those nice conditions in a general mesh. One certainly has the freedom to relabel edges. Still, one may need to locally modify the mesh so that the number of edges (with a nonzero value) in each cohomology basis is a power of two. Even if this is the case, the nonzero entries may not necessarily range from (in the binary representation) |0000....0ab..c&#10217; to |0011..1ab..c&#10217;, and their superposition cannot be obtained simply by applying Hadamard gates. But even if it were the case, how could one prepare a corresponding superposition? One could use a two-step procedure of (1) Hadamard gates to create a uniform superposition from |00...000..0&#10217; to |0011..100..0&#10217; and then (2) a quantum adder <ref type="bibr">[29]</ref> to add the appropriate shift |00...0ab..c&#10217;, which is efficient.</p><p>In Appendix C, we show that even without modifying the mesh structure, by choosing the appropriate labeling of edges (as described above), we can efficiently prepare all the cohomology basis states, as stated below.</p><p>&#8730; c &#945; with the cohomology basis with c &#945; non-zero amplitudes can be prepared using a circuit of depth O(log(c &#945; )).</p><p>As we will point out later, given a mesh with M points, then the number of edges used for each cohomological basis is small, i.e., c &#945; &#8810; M . The cost to prepare the cohomology basis state is negligible and is of O(log(c &#945; )), as detailed in Appendix C ,and thus it does not incur substantial computational time.</p><p>Quantum oracle for loop specification: We remark that in this problem, we are interested in the homology property of a given closed curve r. The orientation of the curve is also important. We have assumed that certain orientation for each edge is fixed, so that all the cohomology bases have a uniform sign in their nonzero components, as discussed earlier. Classically, we can specify the loop r by listing all its half-edges. Naively, on quantum computers, we would like to have a single quantum state in a superposition of basis states that encode the edges on r. But this requirement is too strong. Instead we would like to have a quantum oracle that we can use to probe the relation of an edge e to the loop r. More precisely, it should be a half-edge &#8407; e (where the arrow indicates a certain orientation, chosen for convenience as positive). Its representation by a quantum state is illustrated in Eq. ( <ref type="formula">3</ref>) and the corresponding half-edge with the negative orientation -&#8407; e is represented in Eq. ( <ref type="formula">4</ref>). The unitary O r , or oracle, associated with a given closed curve r, is designed so that, when queried with an input of an edge |&#8407; e i &#10217; and an ancillary qubit,</p><p>Essentially, the function of the oracle is to check whether a given half-edge &#8407; e i is on the curve r. However, the above functioning of the oracle did not take into account the possibly multiple appearances of some edges on the loop. If the above oracle is given, then we can only deal with the case where the coefficients of chain space belong to Z 2 . If we have access to the oracle that performs the following operation instead:</p><p>where the binary string a = a ns-1 ...a 1 a 0 denotes the number of times the given half-edge &#8407; e i appears on r. (In fact, in the above, the top line already includes the bottom line as a special case with a = 0.) Then we can deal with Z 2 ns coefficients. Note that if a = 0 or 1, then we recover the (Z 2 ) oracle given by Eqn. 5. We do not expect our algorithm can work in the case where an edge appears infinite times (for example, a loop winding around infinitely). Therefore, a reasonable assumption is that each half-edge only appears a bounded number of times less than 2 ns = K (with K being a constant) or, alternatively, the oracle only checks the number of times modulo K.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4">Quantum Algorithm</head><p>In this section, we present our main result: a quantum algorithm for the homology detection of a loop. We will employ a Hadamard test procedure and combine it with quantum phase estimation to evaluate whether the sum described in Eq. ( <ref type="formula">2</ref>) for each cohomology basis on the curve r is zero or not.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1">A Hadamard test procedure for estimating phases</head><p>Our primary method is built upon the techniques in Refs. <ref type="bibr">[10]</ref>, <ref type="bibr">[30]</ref> and <ref type="bibr">[31]</ref>, which were recently employed in the setting of quantum neural networks, e.g., see Ref. <ref type="bibr">[32]</ref>. We quickly review the routine as it will be generalized to form the main ideas of our quantum algorithm. Suppose we have some unitary U that generates the following (n+1)-qubits state by |0&#10217; &#8855;n+1 :</p><p>where |x&#10217; , |y&#10217; are some n-qubits states. We can then use it to construct the Grover-like unitary G = U S 0 U &#8224; (Z &#8855; I &#8855;n ) <ref type="bibr">[10,</ref><ref type="bibr">30,</ref><ref type="bibr">32]</ref>, where S 0 = I &#8855;n+1 -2(|0&#10217; &#10216;0|) &#8855;n+1 , such that |&#981;&#10217; can be written as a linear combination below,</p><p>in which</p><p>and the angle &#952; satisfies the relation</p><p>or equivalently cos(2&#952;) = -&#8476; &#10216;x|y&#10217;. This relation suggests that the real part of the overlap &#10216;x|y&#10217; is encoded in the phase &#952;, which is related to the two eigenvalues. We also note that e -i2&#952; = e i(2&#960;-2&#952;) , and therefore, in principle, the phase estimation algorithm <ref type="bibr">[31]</ref> allows us to estimate the value of 2&#952;. Furthermore, we do not need to prepare an eigenstate of G, as the phase estimation will give either 2&#952; or -2&#952; randomly. Estimation of either of the values suffices. We will show shortly that the trivial closeness of a given curve r on the triangulated mesh is encoded in the corresponding phase, and therefore could be revealed by looking at the outcome of the quantum phase estimation algorithm.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2">Algorithm for Detecting Homology Class of a Closed Curve r</head><p>We have described our quantum preliminaries in Sec. 3. In our algorithm, all qubits will be divided into five different quantum registers: (1) a single qubit anchor register (denoted by subscript a), which plays the same role as the first qubit of Eqn.  <ref type="formula">4</ref>) the status register (denoted by subscript s), which is used to store the status from querying the oracle about a half-edge; and (5) the extra qubit (labelled by subscript t) to implementation rotation corresponding to the status register. We remind that that for each cohomology basis there is an efficient unitary U &#945; to create the cohomlogy basis state</p><p>j |e j &#10217; e / &#8730; c &#945; in the edge (e) register without the orientation label (see Claim. 1 and Appendix C). Moreover, it is also easy to create a superposition of all edges, |E&#10217; &#8801; 1</p><p>and we have assumed that the total number of edges (without counting the orientation) is a power of two. (If this is not the case, one can always add 'fictitious' edges to pad the total number to be a power of 2.) The goal is to construct a unitary process U that takes |0 . . . 0&#10217; to (|+&#10217;|x&#10217; + |-&#10217;|y&#10217;)/ &#8730; 2. We are now ready to describe the procedure of our algorithm:</p><p>1.</p><p>[Initialization] First, we construct the following state:</p><p>which can be created from</p><p>We will keep the first qubit (a) in the |0/1&#10217; basis until the end, where we will turn it into | + /-&#10217;. Equivalently, |&#966;&#10217; can be rewritten as</p><p>(|&#8407; e i &#10217; + | -&#8407; e i &#10217;) .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">[Applying oracle</head><p>]. Next we append the status ancillas |00..0&#10217; s and apply the blackbox oracle O r to the e register (the log 2 (E)-qubit system) plus status register, we obtain:</p><p>where st(&#177;&#8407; e i ) is used to denote the status value after the query.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">[Conditional rotation]</head><p>. Append an ancilla |0&#10217; t (noting the subscript t) to |&#966; 1 &#10217; and apply a rotation on qubit t, conditioned on the anchor qubit a being |0&#10217; a and the degree of rotation on the status qubit |st(&#177;&#8407; e i )&#10217; s , so that:</p><p>This operation only affects the part entangled with |0&#10217; a , which becomes</p><p>The other part entangled with |1&#10217; a remains unaffected.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">[Oracle unquery]</head><p>After the conditional rotation, we uncompute or unquery the status register by applying O r one more time, assuming that its operation is addition bitwise. We then arrive at a state of the form</p><p>where we have factorized out the status register at the end. The second part becomes</p><p>Here we can evaluate the inner product of |x&#10217; and |y&#10217;, and we obtain</p><p>Note that st(&#177;&#8407; e i ) is counting the number of times a half-edge &#177;&#8407; e i appears on the curve r. K = 2 reduces to the case where the coefficients in half-edges are in Z 2 .</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">[Hadamard test state]</head><p>Apply the Hadamard gate to the anchor qubit a, and we have the final state, If the curve r is closed trivially, which means that the sum &#8486; &#945; (r) along the curve vanishes identically (see Eqn. 1), i.e., cos(2</p><p>If we write &#952; &#8242; = 2&#960;w &#8242; &#8658; w &#8242; = 1/8, which can be represented by finite bits (more precisely, 3 bits as 1/8 = 0.001 in binary fraction). Therefore, ideally, it means that the phase estimation algorithm can output such a value with certainty, which again, can be used to verify whether or not &#8486; &#945; (r) = 0. Moreover, in the case that the curve r is not homologically trivial, the value &#8486; &#945; (r) can still be obtained from quantum phase estimation, given sufficient ancillas to encode the phase.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.">[Phase estimation] We run the phase estimation algorithm for the operator G.</head><p>As remarked earlier, it does not require us to prepare an eigenstate of G and the phase estimation procedure will allow us to estimate &#177;2&#952;, which is sufficient for extracting &#8486; &#945; (r). We then repeat the whole procedure for different cohomology basis state |&#8486; &#945; &#8242; &#10217;. A curve that is homologically trivial will have all &#8486; &#945; (r)| 2g 1 = 0. Furthermore, complete information for all &#8486; &#945; (r)| 2g 1 determines the homology class of the curve r. However, whether we can determine nonzero values of &#8486; &#945; (r)| 2g 1 with sufficient accuracy remains to be checked.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Analysis of accuracy.</head><p>In the homologously trivial case, the phase can be represented exactly with finite bits and our algorithm can return an exact result with certainty. However, we need to distinguish this case from the nontrivial cases and there is indeed a finite gap in the phase between the two cases as we show below. Therefore, O(1)-time running of quantum phase estimation can already determine whether or not the curve is homologous to zero. More specifically, the analysis of <ref type="bibr">[30]</ref> shows that generally, the phase register returns two closest values to our true phase value with high probability (&gt; 4/&#960; 2 ). In particular, the success probability of measuring best approximated phase value could be amplified to arbitrarily closed to 1 using additional qubits in phase registers <ref type="bibr">[33]</ref>. Therefore, in principle, O(2g) (since we need to repeat the procedure for all cohomology basis {&#8486; i }) repetitions are enough to determine if the curve r, which is specified by U r , is closed.</p><p>Let us further analyze the precision, as in the case of homologously non-trivial curve, the value of angle &#952; &#8242; might be very closed to &#960;/4, which means that the outcome of phase estimation circuit with low number of precision bits might not suffice to determine the phase and hence the value &#8486; &#945; (r). If the curve r is homologous to zero, we definitely have &#10216;x|y&#10217; = 0. Since the value of w i is either -1, 0, or 1 (taking the orientation into account), if the curve is not homologously zero, then the minimum absolute value of such overlap is</p><p>More specifically, let:</p><p>where &#952; 0 refers to the case if the curve is homologically trivial, and &#952; m refers to the smallest angle in the non-trivial case. We apply the following inequality</p><p>and obtain that</p><p>This means that there is a gap &#8710; between the trivial phase value and non-trivial phase value. To distinguish between those phases, we require our phase estimation algorithm to have the error &#948; &#8804; &#8710; (the smaller the better). Therefore, the number of qubits p in the phase register required to have the desired accuracy is &#8486;(log</p><p>where k is some integer. We recall that c &#945; is the number of edges with non-zero values for a given cohomology basis element &#8486; &#945; . This number is usually much smaller than E, which is the total number of edges on the mesh. We also have the condition that K is bounded above. Assume that the mesh has M vertices, then</p><p>Therefore, in our algorithm, as long as we can have enough qubits &#8764; O(log(M )) in the phase estimation algorithm, then the accuracy &#8710; is always guaranteed.</p><p>We summarize our main result with the following theorem.</p><p>Theorem 1 (Homology detection) Given a closed triangular mesh M of genus g, cohomology basis &#10216;&#8486; 1 , &#8486; 2 , ..., &#8486; 2g &#10217;, and quantum oracle U r that specifies a given closed curve r. There exists a quantum algorithm that determines the homology class of r in O(2g) time.</p><p>In comparison, the naive classical running time is O(2g &#8226; L) (which can be improved to O(log(L)) by parallelization) where L is the 'size' of the curve r, i.e., the number of edges on it, as one needs to sum up all the values &#969; i on the all edges &#8407; e of r for all cohomology basis elements &#8486; &#945;=1...2g . Our quantum algorithm substantially improve the time complexity from linear (in L) to constant. We note that our algorithm works even if the given curve has a self-crossing, which can be regarded as a sum of 1-cochains that are loops.</p><p>If two closed curves corresponding to two chains &#963; 1 and &#963; 2 are homologous, i.e., in the same equivalence class, then they differ by an exact 2-chain. This means for any 1-cochain &#969;, we have &#969;(&#963; 1 ) = &#969;(&#963; 2 ). If we decompose the 1-cochain &#969; into the basis {&#8486; i } 2g i=1 then for each basis element we need to have &#8486; i (&#963; 1 ) = &#8486; i (&#963; 2 ). We can compute &#8486; i (&#963; 1 ) and &#8486; i (&#963; 2 ) directly and separately using our quantum algorithm (given the respective oracles) to compute &#8486; i (&#963; 1/2 ) and check if they equate each other for all i = 1, . . . , 2g.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3">Potential Applications</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.1">Homotopy Detection</head><p>Given the ability to efficiently determine the homology class of a closed curve, it is natural to seek applications of the quantum algorithm. Here we point out an instance that also arises in the computational conformal geometry and topology context <ref type="bibr">[5,</ref><ref type="bibr">7]</ref>, i.e. the so-called homotopy detection. The statement of the problem is the following.</p><p>Problem 1 (Homotopy Detection) Given a closed triangular mesh M, two loops &#947; 1 and &#947; 2 through a base point p. Verify whether or not &#947; 1 is homotopic to</p><p>Such a problem also has a linear time classical solution <ref type="bibr">[34]</ref>. While homology groups are commutative, homotopy groups are usually non-commutative; therefore, homotopy can generally be harder to deal with than homology, such as computing its groups. There are also hard problems related to homotopy. For example, the shortest word problem <ref type="bibr">[35]</ref> for a given homotopy class is NP-hard <ref type="bibr">[36]</ref>. While we do not know whether we could completely solve the homotopy detection problem with a constant time algorithm, we observe an essential property that, two loops are homotopic to each other implying that they are homologous (the reverse may not be true). In particular, in the homotopy detection problem, if</p><p>2 is homotopic to e, i.e, the loop is trivial (constant loop). Thus, if &#947; &#8764; e, then &#947; is necessarily homologous to 0 as well. As we can only check whether the curve is homologous to 0, we can apply our algorithm to check the converse, i.e., we can ascertain the case when two curves (on a closed surface) are not homotopic to each other by verifying that the loop &#947; is not homologous to zero.</p><p>In Ref. <ref type="bibr">[6]</ref>, an alternative classical solution to the homotopy detection problem was described. The key idea is that, we first compute a finite portion of the universal covering space M of M . We then lift &#947; 1 &#8226; &#947; -1 2 to M , and denote the lifted path as &#947;. If &#947; is a loop, then &#947; 1 &#8764; &#947; 2 . However, converting the above solution into an efficient quantum algorithm is an open problem.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.2">Winding Number Estimation</head><p>It is pretty interesting that aside from the homology detection problem, the algorithm that we use in this paper (integration of cohomology basis) can be employed to estimate the numbers of times that a loop winds around the torus.</p><p>In Fig. <ref type="figure">3</ref>, denote the homology and cohomology basis as (h 1 , h 2 ) and (&#8486; 1 , &#8486; 2 ) (see Fig. <ref type="figure">2a</ref>). W.O.L.G., let h 1 be the red curve, and h 2 be the blue curve. The integration of cohomology basis along the winding loop is:</p><p>where m is the number of times that the given loop r winds around the torus. Given an oracle, the algorithm developed in Sec. 4.2 can estimates the above integral (more precisely, a discrete summation). Therefore, our algorithm can estimate the winding numbers of the given loop r. In this case, as shown in Fig. <ref type="figure">3</ref>, no half-edge appears twice, therefore, the simpler Z 2 -version of the oracle (i.e., K = 2) is sufficient.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5">Discussion and Conclusion</head><p>Topology and geometry are very rich and deep area of mathematics and their applications to science and engineering have been increasingly broadened due to the connection from the profound mathematical foundation to classical computational geometry algorithms. This, in turn, yields powerful tools to solve many practical problems. Quantum computer is also undergoing a second wave of fast development, and concurrently, the potential power and applicability of quantum computers have always been an important question to address. Our work has added to the few existing works and extended the application of quantum computation to computational topology, in particular, the problem of homology detection. Our quantum method relies on important observation: cohomology assigns real values to half-edges of a mesh, which could be stored efficiently using a logarithmic number of qubits. The summation along a loop (which is specified by an oracle) is done using the orthogonal relation of basis states |e i &#10217;. Key tools include the Hadamard test, amplitude amplification, and quantum phase estimation.</p><p>Even though the particular problem we have considered is not a hard one from classical complexity's perspective (e.g., with a running time O(log(L)) in the number L of edges on the curve), our quantum algorithm achieves a constant time complexity, yielding a substantial speedup. We note that there are other problems where classical solutions are efficient, but the quantum algorithms are even more efficient, such as the 2D hidden linear function problem, where the classical solution requires at least a logarithmic depth whereas the quantum solution requires a shallow depth <ref type="bibr">[25]</ref>. This problem was further generalized to yield an exponential separation between the classical fan-out circuits and shallow-depth quantum circuits <ref type="bibr">[37]</ref>.</p><p>We have also pointed out the potential application of our quantum algorithm in the homotopy detection problem. As described above, the homotopic relation implies homology relation, therefore, we could check the homology condition as a mean to rule out the non-homotopic relation. We have also suggested an open problem regarding how to construct a quantum algorithm that elevates the (classical) universal-covering-space approach provided in <ref type="bibr">[6]</ref>.</p><p>We now discuss an important open point of our work, which appears in most oraclebased quantum algorithms, including Grover's search, namely, the construction of the oracle itself. We have assumed that the oracle O r could efficiently query the half-edge, but left aside the detail of such an oracle. How to implement the oracle explicitly (and efficiently) is an open question. We remark that a mesh is mathematically a graph, therefore, and we could in principle use the graph Laplacian to encode the necessary information of the mesh (i.e., connectivity), for example, in a QRAM <ref type="bibr">[38]</ref>, then the connectivity (plus proper orientation) could be accessed coherently. If an explicit construction for the oracle O r were known, then we could deal with an arbitrary curve on the graph, which in turn might provide more flexibility for applications.</p><p>Homology and homotopy detection are critical for a broad range of applications. In medical imaging, for example, virtual colon cancer detection, the colon surface is reconstructed from CT-images. Due to the segmentation error, there are many fake handles and tunnels on the reconstructed surfaces. It is crucial to detect these spurious topological noises and remove them by topological surgery using homological method <ref type="bibr">[39,</ref><ref type="bibr">40]</ref>. In wireless sensor network field, homology is applied for coverage and hole detection in sensor networks <ref type="bibr">[41]</ref> and location tracking <ref type="bibr">[42]</ref>. It is interesting to see potential applications of quantum algorithms on these practical problems. As a final remark, our work mainly deals with the first homology group H 1 and it is natural to ask how to extend our algorithm to deal with arbitrary homology group H k (k &gt; 1), which is left for future exploration.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A More on homology/cohomology basis</head><p>Here we elaborate further on the concept of cohomology basis and its computation. For more details, we refer the readers to <ref type="bibr">[6,</ref><ref type="bibr">7,</ref><ref type="bibr">27]</ref>. For illustration, we denote the red and blue curves in Fig. <ref type="figure">2</ref>(a) as &#947; 1 and &#947; 2 , respectively. We remark that the cohomology group contains the equivalence classes of closed cochain, which could be constructed from homology basis as follows. We slice the whole mesh along, for example, &#947; 1 and obtain an open mesh with two boundaries &#947; + 1 and &#947; - 1 . We then initialize 0-form f i that satisfies:</p><p>1 and 0 otherwise. With this initialization, df i is then closed but non-exact on the original mesh, hence forms the first cohomology basis. The same process yields the remaining cohomology basis. From such construction we easily notice that with a given cohomology basis df i , df i (e j ) is then 0 everywhere except those 'half-edges' e j that connect a point v i &#8712; &#947; i and a neighboring v k / &#8712; &#947; i . We note that the two half-edges of an edge correspond to its two 'sides' with opposite orientations; but we do not need to invoke half-edges in the main text of this paper.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A.1 Encoding of Cohomology Basis in a Quantum State</head><p>We remark that cohomology assigns each edge (with specified orientation) a real number, therefore, the set of those numbers on given mesh M can be stored in a quantum state (more precisely, a vector). Suppose we are given some 1-cochain w, and can define a corresponding quantum 1-cochain:</p><p>where w i = w(&#8407; e i ) (note the orientation) and E is the total number of edges. In general, it is nontrivial to create such a quantum state. However, for the cohomology basis states |&#8486; &#945; &#10217;s, many of the coefficients w i 's are zero and those nonzero ones can be chosen to be unity and there is an efficient circuit to construct these states, see Appendix C.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B Elaboration of The Main Method</head><p>We remind that the main tool used for detecting closed curves was based on the integral (or summation in our discrete case) of each cohomology basis {&#8486; &#945; } along such a curve r, and we require all of them to be 0, if r is homologically trivial. Here we explain further why we require such a condition.</p><p>A k-chain &#963; k is said to be exact if it is the image of some (k+1)-chain under the boundary map &#8706; k+1</p><p>As a dual relation between homology and cohomology, for each boundary operator &#8706; k , there is a co-boundary operator d k that maps a k-cochain to a (k + 1)-cochain. Let &#969; &#8242; be a (k -1)-cochain, &#963; k be a k-chain, we have the following property:</p><p>Now we apply (closed) k-cochain &#969; k on both sides of Eqn. 22:</p><p>Employing the property in B2, we have:</p><p>Since &#969; k is closed, d k &#969; k = 0, therefore, it means that &#969; k &#963; k = 0. Set &#969; k &#8801; &#969; for brevity. Now we use an important property of the cochain space: it is a linear vector space, and therefore, a given cochain &#969; can be decomposed into a set of bases. Denote the set of basis as {&#969; i } k i=1 . We then have: &#969; = i a i &#969; i , where each a i is generally a complex component. We now obtain the following:</p><p>We remark that as the basis {&#969; i } k i=1 is linearly independent, therefore, in order for the above sum to be 0, we need every term to be 0, and since {a i }'s generally are not zero, this implies that, for each i,</p><p>In our problem, we are interested in 1-chains, i.e. k = 1. The summation along the curve is simply the summation along all the (half-)edges on the boundary.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C Details on Cohomology Basis State Preparation</head><p>Here we elaborate further the claim 1, which is probably the most crucial part of the algorithm. Uniform superposition of data is useful in quantum computation, or more specifically, in quantum machine learning, where s amplitude encoding is one of the most popular approaches to load classical data into a quantum state <ref type="bibr">[18,</ref><ref type="bibr">43,</ref><ref type="bibr">44]</ref>. We remind that the geometrical object is represented as a triangular mesh in the discrete setting. Therefore, there is naturally a hardware structure equipped with the object. In our case specifically, it is the (ordered) set of vertices, edges and faces. In general, cohomology theory deals with a linear vector space. The key idea of our quantum algorithm is to map cochains to quantum states, so as to leverage the quantum resources. A subtle point in the construction of cohomology basis state as in Claim 1 is the order of those edges that we impose on via classical processing (we have remarked that the mesh generation process is done classically). For each cohomology basis &#8407; &#8486; &#945; (or we can write |&#8486; &#945; &#10217; in quantum setting), there are c &#945; non-zero entries, and these entries have consecutive order. As we mentioned, the cohomology basis vector has the following form:</p><p>&#8407; &#8486; &#945; = [0, ..., &#177;1, &#177;1, ...0] T with c &#945; non-zero entries. The corresponding quantum state is simply</p><p>The reason why we want to order those edges (the order of those non-zero entries) in consecutive order is to achieve a low-cost way to prepare such a state, which we describe now.</p><p>An efficient algorithm for uniform superposition. First, we argue that we can always label edges in the cohomology basis states such that they are consecutive in number. We argue that two different cohomology basis states can have only one overlapping edge and that it can be arranged so that for any one cohomology basis state, there is at most one other cohomology basis state that has an overlapping edge. Therefore, all the edges in involved in all cohomology basis states can be labeled consecutively. If there is an overlap, then the last edge of the cohomology basis state is the first edge of the next one that has an overlap.</p><p>Once the labelling is settled, then we need to show that we can create an equal superposition of basis states that are binary representation of consecutive numbers, i.e., |&#968;&#10217; = a 2 j=a 1 |j&#10217;/ &#8730; a 2 -a 1 + 1 can be created efficiently. We then argue that this reduces to creating |&#968; 0 &#10217; = a 2 -a 1 j=0 |j&#10217;/ &#8730; a 2 -a 1 + 1, as there is an efficient adder (of log(|a 2 -a 1 +1) depth); see e.g., Ref. <ref type="bibr">[29]</ref>. Namely by adding |&#968; 0 &#10217; to |a 1 &#10217;. An example. Next, we will focus on creating |&#968; 0 &#10217; and describe an efficient way to create some superposition of |0...0&#10217; to |a n , a n-1 , ..., a 0 &#10217;. Let us first illustrate this by an example. Suppose we want to make a superposition from 0000 to 1011 (and we will take the last configuration 1011 as a reference, so we can apply gates conditioned on some of the digits).</p><p>First, we start with |0000&#10217; and, recognizing the most significant digit of '1011' is one, we create a superposition c 0 |0000&#10217; + d 0 |1000&#10217; (denoting this operation by UIII), followed by a product of Hadamard gates conditioned on the first quantum bit being 0: |0&#10217;&#10216;0| &#8855; H 2 &#8855; H 1 &#8855; H 0 + |1&#10217;&#10216;1| &#8855; I &#8855; I &#8855; I, with the operation denoted by 0HHH. Thus, we obtain a state d 0 |1000&#10217; + c 0 |0 + ++&#10217;.</p><p>Then, we move down the bit string in '1011' and it is '0', so we do nothing in this step. (If it were '1' we would split 1000 to c|1000&#10217; + d|1100&#10217;.) We move down the bit string again to reach '1', and we split (conditioned on the significant qubit being in |1&#10217;) 1000 to c 2 |1000&#10217; + d 2 |1010&#10217; (i.e. an operation labeled as 10UI), followed by a controlled gate 100H (i.e., a Hadamard gate conditioned on the first three qubits being in |100&#10217; state), where the first two bits '10' are from the string '1011' and the '0' before H is fixed. And we arrive at c 0 |0+++&#10217;+d 0 (c 2 |100+&#10217;+d 2 |1010&#10217;). Finally, we reach the last digit of '1011', which is '1'. If it were zero, we would do nothing. But given this is '1', we perform an operation controlled on the first three qubits being 101 (denoting this operation as 101U) to take |1010&#10217; to c 3 |1010&#10217;+d 3 |1011&#10217;, so the final state is c 0 |0+++&#10217;+d 0 (c 2 |100+&#10217;+d 2 (c 3 |1010&#10217;+d 3 |1011&#10217;)). We can check the number of computational-basis terms is 2 3 + 2 1 + 2 0 + 1 = 12 and it contains the all the desired components. If we adjust the coefficients appropriately, we can obtain a uniform superposition from |0000&#10217; to |1011&#10217;. In summary, the operations are: {(UIII, 0HHH), (10UI, 100H), (101U)} acting on the initial |0000&#10217; state. General case. So the algorithm for creating a superposition of components from |0 . . . 0&#10217; to |a n , a n-1 , . . . , a 0 &#10217; is as follows. Start with the |0 . . . 0&#10217; state (if there are more qubits than n + 1, then pad the remaining qubits to |0&#10217; and the following procedure applies to the relevant part of the qubits). One reads the bit string a n a n-1 . . . a 0 . Begin with k = n. If a k = 0, then one moves on to the next bit. If a k = 1, split |a n , a n-1 , . . . , 0 k , . . . , 0&#10217; into a superposition of |a n , a n-1 , . . . , 1 k , . . . , 0&#10217; and |a n , a n-1 , . . . , 0 k , . . . , 0&#10217; (via operation a n , a n-1 , . . . U k I . . . I) followed by the operation a n , a n-1 , . . . 0 k H . . . H. Iterate this (decrease the index k by one) until we read a 0 . If a 0 = 0, nothing needs to be done. If a 0 = 1, then we split the state |a n , a n-1 , . . . , a 1 , 0&#10217; via operation (a n , a n-1 , . . . , a 1 , U ) into a superposition of |a n , a n-1 , . . . , a 1 , 0&#10217;&#10217; and |a n , a n-1 , . . . , a 1 , 1&#10217;. We note the coefficients (that determine the superposition by U 's) can be computed beforehand so the final output state is a uniform superposition.</p><p>The time complexity is proportional to the number of qubits nontrivially involved in the superposition, the procedure of applying gates follows checking the bits sequentially, i.e., the complexity is roughly log 2 (|a 2 -a 1 + 1|) = log 2 (n). Generalizing this to arbitrary bit strings, we have an efficient algorithm for creating uniform superposition.</p><p>An alternative approach. We claim that one can always modify the mesh and triangulation so that the number of nontrivial edges in every cohomology basis state is a power of 2. Then we only need to use Hadamard gates and additionally the quantum addition gate.</p></div></body>
		</text>
</TEI>
