Topological Quantum Gate Construction by Iterative Pseudogroup Hashing

We describe the hashing technique to obtain a fast approximation of a target quantum gate in the unitary group SU(2) represented by a product of the elements of a universal basis. The hashing exploits the structure of the icosahedral group [or other finite subgroups of SU(2)] and its pseudogroup approximations to reduce the search within a small number of elements. One of the main advantages of the pseudogroup hashing is the possibility to iterate to obtain more accurate representations of the targets in the spirit of the renormalization group approach. We describe the iterative pseudogroup hashing algorithm using the universal basis given by the braidings of Fibonacci anyons. The analysis of the efficiency of the iterations based on the random matrix theory indicates that the runtime and the braid length scale poly-logarithmically with the final error, comparing favorably to the Solovay-Kitaev algorithm.


Introduction
The possibility of physically implementing quantum computation opens new scenarios for future technological development. This justifies the intensive efforts made by the scientific community to develop theoretical approaches suitable for effectively building a quantum computer and, at the same time, to reduce all the sources of errors that would spoil the achievement of quantum computation.
To implement quantum computation one needs to realize, through physical operations over the qubits, arbitrary unitary operators in the Hilbert space that describe the system. This task can be achieved by using a finite number of elementary gates that constitute a basis. A small set of gates is said to be universal for quantum computation if it allows us to approximate, at any given accuracy, every unitary operator in terms of a quantum circuit made of only those gates [1]. It can be shown that a basis able to reproduce every SU(2) operator and one entangling gate (as CNOT) for every pair of qubits is indeed universal [2]; therefore the problem of finding an approximation of unitary operators in SU(N ) can be reduced to searching for an efficient representation, in terms of the elements of the basis, of single-qubit gates in SU (2) and of the two-qubit gate CNOT.
For SU (2), it is possible to find a universal set of single-qubit operators involving just two elementary gates, which we will label as σ 1 and σ 2 (not to be confused with Pauli matrices!), and their inverses, σ −1 1 and σ −2 2 . This means that every single-qubit gate can be efficiently approximated by a string of these four elementary elements. In the scheme of topological quantum computation, these fundamental gates are realized by elementary braid operation on the excitations of the system, the anyons. In order to be universal, the group obtained by multiplying the four σ gates must be dense in SU (2): it is therefore sufficient that σ 1 and σ 2 do 3 not belong to the same finite subgroup of SU (2). For what concerns controlled gates in SU (4) as CNOT, their approximation can be usually reduced to the case of operators in SU (2), as described in [5] and [24] in the context of topological quantum computation, the main subject of our following considerations.
The simplest way of obtaining an approximation of a given target gate T ∈ SU(2) using only four elementary gates σ ±1 1,2 is to search for, among all the ordered products of N such operators, the one that best represents T , minimizing the distance to it (a rigorous definition of distance is given in section 3). This operation is called the brute-force procedure [5]. The number of all possible products of this kind grows exponentially in N as α N (where α ≈ 3) and, because of the three-dimensional (3D) nature of SU (2), one can show that, for a suitable choice of the universal basis, the average error obtained with different targets decreases approximately as e −N /3ln α (in section 3.2, we will describe in more detail the brute-force search for Fibonacci anyons).
This approach, consisting of a search algorithm over all possible ordered products up to a certain length, has an extremely clear representation if one encodes qubits using non-Abelian anyons. In this case, the computational basis for the quantum gate is the set of elementary braidings between every pair of anyons and their products are represented by the braids describing the world lines of these anyonic quasiparticles. Starting from this kind of universal basis, the search among all the possible products of N elements gives, of course, the optimal result, but the search time is exponential in N and therefore it is impractical to reach a sufficiently small error for arbitrary gates.
There are, however, other possible approaches that allow us to reach an arbitrary small error in a faster way, even if they do not obtain the best possible result in terms of the number N of elementary gates involved. The textbook example is the Solovay-Kitaev algorithm [1,3,4]. This algorithm provides a powerful tool for obtaining an approximation of arbitrary target gates in SU(2) at any given accuracy starting from an -net, i.e. a finite covering of SU(2) such that for every single-qubit operator T there is at least one gate inside the -net that has a distance from T smaller than . The Solovay-Kitaev algorithm is based on the decomposition of small rotations with elements of the -net and both the runtime and the length of the final product of elementary gates scale poly-logarithmically with the final error ε. The exponents depend on the detailed construction of the algorithm: the simplest realization of the algorithm, as provided in [5] in the context of topological quantum computation, is characterized by the following scaling: As discussed in appendix 3 of [1] and in [4], a more sophisticated implementation of the Solovay-Kitaev algorithm realizes T ∼ (ln (1/ε)) 2 ln (ln (1/ε)) .
The hashing algorithm, which was proposed in [6], has the aim of obtaining a more efficient approximation of a target operator than the Solovay-Kitaev algorithm in a practical regime, 4 with a better time scaling and without the necessity for building an -net covering the whole target space of unitary operators. Our main strategy will be to create a dense mesh S of fine rotations with a certain average distance from the identity and to reduce the search for the target approximation to the search among this finite set of operators that, in a certain way, play the role of the -net in the neighborhood of the identity. This set will be built by exploiting the composition property of a finite subgroup (the icosahedral group) of the target space SU (2) and exploiting also the almost random errors generated by a brute-force approach in order to approximate at a given precision the elements of this subgroup. Therefore, the algorithm allows us to associate a finite set of approximations with the target gate and each of them is constituted by an ordered product of the elementary gates chosen in a universal quantum computation basis. Since our braid lookup task is similar to finding items in a database given its search key, we borrow computer science terminology to name the procedure hashing.
With this algorithm we successfully limit our search to a small number of elements instead of an exponentially growing one as in the case of the brute-force search; this significantly reduces the runtime of the hashing algorithm. Furthermore, we can easily iterate the procedure in the same spirit as the renormalization group scheme, based on the possibility of restricting the set S to a smaller neighborhood of the identity at each iteration, obtaining in this way a correction to the previous result through a denser mesh.
In section 2, we briefly review the main ideas of topological quantum computation, which is the natural playground for the implementation of the hashing procedure. We use Fibonacci anyons to encode qubits and define their braiding operators that are the main example of universal elementary gates that we use to analyze our algorithm. In section 3, we introduce the basic ideas of the icosahedral group and its braid representations, which are pseudogroups. We describe in detail the iterative hashing algorithm in section 4 and analyze the performance of its iteration scheme in section 5. We conclude in section 6. In appendix, we derive the distribution of the best approximation in a given set of braids, which can be used to estimate the performance of, e.g., the brute-force search.

Topological quantum computation and Fibonacci anyons
The discovery of condensed matter systems that show topological properties and cannot be described simply by local observables has opened a new perspective in the field of quantum computation. Topological quantum computation is based on the possibility of encoding the qubits necessary for quantum computation in the topological properties of physical systems, and obtaining in such a way a fault-tolerant computational scheme protected by local noise [7]- [11].
For topological quantum computation one needs anyons with non-Abelian statistics. Unlike fermions or bosons, anyons are quasiparticles whose exchange statistics is described not by the permutation group, but by the braid group, generated by the elementary exchanges of anyon pairs. In particular, in certain two-dimensional (2D) topological states of matter, a collection of non-Abelian anyonic excitations with fixed positions spans a multi-dimensional Hilbert space and, in such a space, the quantum evolution of the multi-component wavefunction of the anyons is realized by braiding them.
Therefore, it is natural to consider the unitary matrices representing the exchange of two anyons as the elementary gates for a quantum computation scheme. In this way, the universal basis for the quantum computation acquires an immediate physical meaning and its elements are implemented in a fault-tolerant way; therefore the problem of approximating a target unitary gate is translated to finding the best 'braid' of anyons that represents the given operator up to a certain length of ordered anyon exchanges [5].
There are several physical systems characterized by a topological order that are suitable to present non-Abelian anyonic excitations. The main experimental candidates are quantum Hall systems in semiconductor devices (see [12] for an introduction to the subject), as well as similar strongly correlated states in cold atomic systems [13], p x + i p y superconductors [14] and superconductor-topological insulator heterostructures [15].
One of the most studied anyonic models is the Fibonacci anyon model (see for example [5], [16]- [19]), so named because the dimension of their Hilbert space follows the famous Fibonacci sequence, which implies that their quantum dimension is the golden ratio ϕ = ( √ 5 + 1)/2. Fibonacci anyons (denoted by φ as opposed to the identity 1) are known to have a simple fusion algebra (φ × φ = φ + 1) and to support universal topological quantum computation [8]. Candidate systems supporting the Fibonacci fusion algebra and braiding matrices include fractional quantum Hall states known as the Read-Rezayi state at filling fraction ν = 3/5 [20] (whose particle-hole conjugate is a candidate for the observed ν = 12/5 quantum Hall plateau [21]) and the non-Abelian spin-singlet states at ν = 4/7 [22].
Every anyonic model, such as the one of Fibonacci anyons, is characterized by several main components: the superselection sectors of the theory are the different kinds of anyons that are present (1 and φ in our case), their behavior is described by the fusion and braiding rules that are linked through the associativity rules of the related fusion algebra, expressed by the so-called F matrices (see [11,23] for a general introduction to the anyonic theories and [5] for its application to the Fibonacci case).
If we create two pairs of φs out of the vacuum, both pairs must have the same fusion outcome, 1 or φ, forming a qubit; therefore the logical value of the qubit is associated with the result of the fusion of the two Fibonacci anyons inside the first or the second pair, while the total fusion outcome is the vacuum. The braiding of the four φs can be generated by two fundamental braiding matrices (related by the Yang-Baxter equation) and their inverses σ −1 We note that σ 1 is the elementary braiding involving two anyons in the same pair; thus it is diagonal in the qubit basis; instead, σ 2 describes the braiding of anyons in different pairs and can be obtained by the change of basis defined by the associativity matrix F. This matrix representation of the braidings generates a four-strand braid group B 4 (or an equivalent three-strand braid group B 3 ): this is an infinite-dimensional group consisting of all possible sequences of length L of the above generators and, with increasing L, the whole set of braidings generates a dense cover of the SU(2) single-qubit rotations.
In addition, Simon et al [17] demonstrated that, in order to achieve universal quantum computation, it is sufficient to move a single Fibonacci anyon around the others at fixed position. Thanks to this result, one can study an infinite subgroup of the braid group B which is the group of weaves, braids characterized by the movement of only one quasiparticle around the others. From a practical point of view, it seems simpler to realize and control a system of this kind; 6 therefore we will consider only weaves in the following. There is also another advantage in doing so: the elementary gates to cover SU(2) become σ 2 1 , σ 2 2 and their inverses; therefore, the weaves avoid the equivalence between two braids caused by the Yang-Baxter relations, so that it is more immediate to find the set of independent weaves up to a certain length. In fact, the only relations remaining for Fibonacci anyons that give rise to different but equivalent weaves are the relations σ 10 1 = σ 10 2 = 1, because they imply that σ 6 i = σ −4 i and one can always reduce weaves with terms of the kind σ ±6 i to shorter but equivalent ones. To calculate the efficiency in approximating a target gate through a brute-force search, which gives the optimal result up to a certain length, it will be useful to calculate here the number of independent weaves of Fibonacci anyons; in general a weave of length L can be written as where p i ∈ {1, 2}, p i = p i±1 and i |q i | = L. As mentioned above, to ensure that this braid is not equivalent to a shorter braid, one must have q i = ±2 or ±4.
Let us assume that the number of length L weaves is N (L), consisting of N 4 (L) weaves ending with σ ±4 p and N 2 (L) weaves ending with σ ±2 p . To form a weave of length L + 2, the sequence must be appended by σ 2 r or σ −2 r . For sequences ending with σ 2 However, for sequences ending with σ 4 p (or σ −4 p ), we can only append σ 2 3− p or σ −2 3− p . Therefore, we have the recurrence relations: With an ansatz N (L) ∼ α L/2 (and so are N 4 (L) and N 2 (L)), we find α = 1 ± √ 3. Therefore, the exact number of weaves of length L is which grows as (1 + √ 3) L/2 asymptotically.

Single-qubit gates and distances in SU(2)
The hashing algorithm allows us to approximate every target single-qubit gate in SU(2) exploiting the composition rules of one of its subgroups, as the icosahedral one; therefore, it is useful to consider the standard homomorphism from the group of rotations in R 3 , SO(3), and the group of single-qubit gates, which permits us to write every operator U ∈ SU(2) as U (m, φ) represents a rotation, in SO (3), of an angle φ around the axes identified by the unitary vectorm. Therefore, if we exclude an overall phase, which is unimportant for the purpose of single-qubit gates, SU (2) can be mapped on a sphere of radius π: a point in the sphere defined by a radius 0 φ π in the directionm corresponds to the rotation U (m, φ). In the following, we will often address the elements of SU(2) not only as single-qubit gates but also as rotations, implicitly referring to this homomorphism. The distance d (also referred to as error) between two gates (or their matrix representations) U and V is defined as the operator norm distance Thus, if we consider two operators U = U (m, φ) and V = U (n, θ), the distance between them is which is bound above by √ 2. We note that the distance of a rotation U (m, φ) from the identity operator is d = 2 sin(φ/4).

Brute-force search with Fibonacci anyons
First, we estimate the efficiency of the brute-force search algorithm through the probability distribution of the error of any weave of length L from a given target gate in SU (2). We assume that the collection of nontrivial weaves of length L, whose number is N (L) as given in equation (11), is uniformly distributed on the sphere of SU (2). Representing the elements of SU(2) on the surface of the 4D sphere, we find the distribution p BF (d) of their distance from the identity operator to be where d = 2 sin(φ/4). Given this distribution, we obtain the average error for the brute-force search to bē asymptotically (see appendix for more details).

The icosahedral group
The hashing procedure relies on the possibility of exploiting the group structure of a finite subgroup of the target space to build sets S(L) of fine rotations, distributed with smaller and smaller mean distances from the identity, which can be used to progressively correct a first approximation of a target gate T . Therefore, it is fundamental to search, for every target space of unitary operators, a suitable subgroup to build the sets S. Among the different finite subgroups of SU(2) we considered the SO(3) subgroups corresponding to the symmetry group of the icosahedron and of the cube, which have order 60 and 24, respectively. However, for practical purposes, we will refer in the following mainly to the icosahedral group because its implementation of the hashing algorithm, as we will describe below, is more efficient in terms of the final braid length. The icosahedral rotation group I is the largest polyhedral subgroup of SU(2), excluding reflection. For this reason, it has often been used to replace the full SU(2) group for practical purposes, as for example in earlier Monte Carlo studies of SU(2) lattice gauge theories [25], and its structure can be exploited to build meshes that cover the whole SU(2) [26].
I is composed of 60 rotations around the axes of symmetry of the icosahedron (platonic solid with 20 triangular faces) or of its dual polyhedron, the dodecahedron (regular solid with 12 pentagonal faces); there are six axes of the fifth order (corresponding to rotations with fixed vertices), ten of the third (corresponding to the triangular faces) and 15 of the second (corresponding to the edges). Let us for convenience write I = {g 0 , g 1 , . . . , g 59 }, where g 0 = e is the identity element. In figure 2(a), the elements of the icosahedral group are represented inside the SU(2) sphere.
Because of the group structure, given any product of n elements of a subgroup g i 1 g i 2 · · · g i n there always exists a group element g i n+1 = g −1 i n · · · g −1 i 2 g −1 i 1 that is its inverse. In this way, g i 1 g i 2 · · · g i n g i n+1 = e and one can find O n different ways of obtaining the identity element, where O is the order of the group (60 in the case of the icosahedral one). This is the key property we will use in order to create a dense mesh S of fine rotations distributed around the identity operator in the target space. To achieve this goal, however, we need to break the exact group structure and to exploit the errors given by a brute-force search approximation of the elements of the chosen subgroup.

Pseudogroup
The main idea in the realization of the mesh S is that, representing the 60 elements of the subgroup I with weaves of a given length L, we can control, due to the relation (16), the average distance (or error) between the exact rotations in I and their braid representations that constitute the setĨ(L), which we will refer to as a pseudogroup.
Thanks to the homomorphism between SU(2) and SO (3), we associate with every rotation g ∈ I a 2 × 2 matrix (12). Then we apply a brute-force search of length L to approximate the 60 elements in I; in this way we obtain 60 braids that give rise to the pseudogroupĨ(L) = {g 0 (L),g 1 (L), . . . ,g 59 (L)}. These braids are characterized by an average distance (L) with their corresponding elements g i ∈ I given by equation (16). We note from figure 2 that the large errors for L = 8 completely spoil the symmetry of the group (and we will exploit this characteristic in the preprocessor of the hashing algorithm); however, increasing the length L, one obtains pseudogroups with smaller and smaller errors. Choosing, for instance, a fixed braid length of L = 24, the error of each braid representation to its corresponding exact matrix representation varies from 0.003 to 0.094 with a mean distance of 0.018. Therefore, the braid representations of the icosahedral group with different lengths are obtained by a brute-force search once and for all. The so obtained braids are then stored for future utilization and this is the only step in which we apply, preliminarily, a brute-force search. Due to limiting computing resources, we construct the pseudogroup representations for the 60 rotations up to the length L = 68, which, as we will describe below, is sufficient to implement three iterations of the hashing algorithm. In principle, one could calculate the bruteforce approximation of the group elements to larger lengths once and for all, in order to use them for a greater number of iterations. The average errors characterizing the main pseudogroups we use in the iterations are shown in figure 1; they agree well with equation (16).
Let us stress that the 60 elements ofĨ(L) (for any finite L) do not close the composition laws of the icosahedral group; in fact a pseudogroupG(L) becomes isomorphic to its corresponding group G only in the limit L → ∞. If the composition law g i g j = g k holds in I, the product of the corresponding elementsg i (L) andg j (L) is notg k (L), although it can be very close to it for large enough L. Interestingly, the distance between the productg i (L)g j (L) and the corresponding element g k of I can be linked to the Wigner-Dyson distribution (see section 4.2).
Using the pseudogroup structure ofĨ(L), it is easy to generate a mesh S(L) made of a large number of braids only in the vicinity of the identity matrix: this is a simple consequence of the original group algebra, in which the composition laws allow us to obtain the identity group element in various ways. The set S is instrumental in achieving an important goal, i.e. to search for, among the elements of S, the best correction to apply to a previous approximation of the target single-qubit gate T we want to hash.
It is important to note that, changing the length L of the pseudogroup representation, we can control the average distance of the fine rotations in S from the identity. To correct an approximation of T with an error ε, we need a mesh S characterized by roughly the same average error in order to reach an optimal density of possible corrections and thus increase the efficiency of the algorithm. Therefore, knowing the average error of the distribution of the approximations we want to improve, we can choose a suitable L to generate a mesh. As represented in figure 3, this allows us to define a series of denser and denser meshes to iterate the hashing algorithm in order to correct at each step the expected mean error, which we have determined by analyzing the distributions of errors of 10 000 random targets after the corresponding iteration.

10
To create the mesh of fine rotations, labeled by S(L , n), we consider all the possible ordered productsg i 1 (L)g i 2 (L) . . .g i n (L) of fixed n 2 elements ofĨ(L) of length L and multiply them by the matrixg i n+1 (L) ∈Ĩ(L) such that g i n+1 = g −1 i n . . . g −1 i 2 g −1 i 1 . In this way we generate all the possible combinations of n + 1 elements of I that produce the identity but, thanks to the errors that characterize the braid representationĨ, we obtain 60 n small rotations in SU(2), corresponding to braids of length (n + 1)L. In section 4.2, we will describe their distribution around the identity with the help of random matrices.

The iterative pseudogroup hashing algorithm
The hashing algorithm [27] is based on the possibility of finding progressive corrections to minimize the error between the target gate T ∈ SU(2) and the braids that represent it. These corrections are chosen among the meshes S(L i , 3) whose distribution around the identity operator is shown in figure 3.
The algorithm consists of a first building block, called preprocessor, whose aim is to give an initial approximationT 0 of T , and a main processor composed of a series of iterations of the hashing procedure that, at each step, extend the previous representation by a braid in S(L i , 3). The final braid has the form Eachg j (L i ) is an element of the pseudogroupĨ (L i ) and, as explained in the previous section, the braid segment in each main iteration is constrained by g k 4 = g −1 k 3 g −1 k 2 g −1 k 1 , k = p, q or r . Each iteration starts from an input approximationT i−1 with a distance ε i−1 from the target T . We exploit the elements of the mesh S(L i , n) to generate a new braidT i with a smaller distance ε i . The lengths L i in equation (17), which characterize the pseudogroups used in the main processor, control the density of the corresponding meshes and are chosen among the sets of stored pseudogroups in order to correct the residual error in an efficient way (see section 5).
Let us analyze now the details of each step in the hashing algorithm. The preprocessor is a fast procedure to generate a rough approximation of the target gate T ∈ SU(2) and, in general, it associates with every T a braid that is an element of [Ĩ (L 0 )] m (of length m L 0 ). Therefore, the preprocessor approximates T with the ordered product of elements in the icosahedral pseudogroupĨ (L 0 ) that best represents it, minimizing their distance. Thus we obtain a starting braidT with an initial error to reduce. The preprocessor procedure relies on the fact that, choosing a small L 0 , we obtain a substantial discrepancy between the elements g i of the icosahedral group and their representativesg i , as shown in figure 2. Because of these seemingly random errors, the set [Ĩ(L 0 )] m of all the productsg j 1g j 2 . . .g j m is well spread all over SU (2) and can be thought of as a random discretization of the group. In particular, we find that the pseudogroupĨ (8) has an average error of about 0.24 and it is sufficient to take m = 3 (as we did in equation (17)) to cover the whole SU (2) in an efficient way with 60 3 operators. The average error for an arbitrary single-qubit gate with its nearest elementT 8 Among these braids of length (n + 1)L 1 + m L 0 , we search for the one with the shortest distance to the target gate T . This braid,T 1 (L 0 , m, L 1 , n), is the result of the first iteration in the main processor.
The choice of L = 24 for the first step is dictated by the analysis of the mean error of the preprocessor (∼ 0.03) that requires, as we will see in the following section, a pseudogroup with compatible error for an efficient correction. An example of the first iteration is illustrated in [6].
WithT 1 we can then apply the second and third iterations of the main processor to obtain an output braid of the form in equation (17). These iterations further reduce the residual discrepancy in decreasing error scales. Each step in the main processor requires the same runtime, during which a search within 60 n braids selects the one with the shortest distance to T . One must choose appropriate pseudogroups with longer braid lengths L 2 and L 3 to generate finer meshes. As for L 1 , we choose L 2 and L 3 to match the error of the corresponding pseudogroup to the respective mean residual error. In practice, we choose L 2 = 44 and L 3 = 68. The final output assumes the form in equation (17) and the average distance to the target braid (in 10 000 random tests) is 2.29 × 10 −5 after the second iteration and 8.24 × 10 −7 after the third. Without reduction the final length is 568; however, due to shortenings at the junctions where different braid segments meet, the practical final length of the weave is usually smaller.

Connection with random matrix theory and reduction factor for the main processor
To analyze the efficiency of the main processor we must study the random nature of the meshes S(L , n). The distribution of the distance between the identity and their elements has 12 an intriguing connection to the Gaussian unitary ensemble of random matrices, which helps us to understand how close we can approach the identity in this way and therefore what the optimal choice of the lengths of the pseudogroups is for each iteration of the main processor.
Let us analyze the group property deviation for the pseudogroupĨ(L) for braids of length L. One can writeg i = g i e i i , where i is a Hermitian matrix, indicating the small deviation of the finite braid representation from the corresponding SU(2) representation for an individual element. For a product ofg i that approximate g i g j · · · g n+1 = e, one has g ig j · · ·g n+1 = g i e i i g j e j j · · · g n+1 e i n+1 = e iH n , where H n , related to the accumulated deviation, is The natural conjecture is that, for a long enough sequence of matrix products, the Hermitian matrix H n tends to a random matrix corresponding to the Gaussian unitary ensemble. This is plausible as H n is a Hermitian matrix that is the sum of random initial deviation matrices with random unitary transformations. A direct consequence is that the distribution of the eigenvalue spacing s obeys the Wigner-Dyson form [28] P(s) = 32 where s 0 is the mean level spacing. For small enough deviations, the distance of H n to the identity, d(1, e iH n ) = H n + O( H n 3 ), is proportional to the eigenvalue spacing of H and, therefore, should obey the same Wigner-Dyson distribution. The conjecture above is indeed well supported by our numerical analysis, even for n as small as 3 or 4: the distances characterizing the meshes with L = 24 and L = 48 obtained from the corresponding pseudogroups (figure 3) follow the unitary Wigner-Dyson distribution.
The elements of the meshes S(L , n) are of the form in equation (20) and this implies that, once we choose a pseudogroupĨ(L) whose average errord(L) is given by equation (16), the mean distance s 0 in (22) of the corresponding mesh from the identity is s 0 (L) ≈ √ n + 1d(L) as resulting from the sum of n + 1 Gaussian terms.
At each iteration of the main processor, we increase the braid by (n + 1) = 4 braid segments with length L i . By doing that, we create 60 n braids and the main processor searches, among them, the best approximation of the target. Therefore, the runtime is linear in the dimension of the meshes used and in the number of iterations. The unitary random matrix distribution implies that the mean deviation of the four-segment braids from the identity (or any other in its vicinity) is a factor of √ n + 1 times larger than that of an individual segment. Considering the 3D nature of the unitary matrix space, we find that at each iteration the error (of the final braid to the target gate) is reduced, on average, by a factor of f ∼ 60 n/3 / √ n + 1 = 30, where 60 is the number of elements in the icosahedral group. This has been confirmed in the numerical implementation.

Hashing with the cubic group
For comparison, we also implemented the hashing procedure with the smaller cubic group. In this case the rotations in the group of the cube are 24; thus we choose n = 4 to generate a comparable number of elements in each mesh S(L , n). Our implementation of the hashing with the cubic group uses a preprocessor with L 0 = 8 and m = 4 and a main processor with L 1 = 24 and n = 4. Approximating over 10 000 random targets, we obtained an average error 7.09 × 10 −4 after the main processor, comparable with 7.24 × 10 −4 after the first iteration in the previous icosahedral group implementation. This result is consistent with the new reduction factor f cube = 24 4/3 / √ 5 ≈ 30.96. However, we note that the cubic hashing is less efficient both in terms of the braid length (because it requires n = 4 instead of n = 3) and in terms of the runtime (because the time required for the searching algorithm is linear in the elements of S and 24 4 > 60 3 ).

Tail correction
The choice of the proper L i is important. We determine them by the average error before each iteration. If a certain L i is too large, it generates a mesh around the identity that may be too small to correct the error relatively far from the identity, where the mesh is very fine. On the other hand, if L i is too small, the mesh may be too sparse to correct efficiently. The former situation occurs exactly when we treat the braids with errors significantly larger than the average; they correspond to the rare events in the tail of the distributions as shown in figure 4. Such an already  Average error and standard deviation for the hashing algorithm after the preprocessor and the three iterations of the main processor. The output in the absence or presence of a tail correction for the second and third iterations is shown (the asterisks indicate that the preprocessor and the first iteration are not affected by the tail correction). This correction is based on the pseudogroups with length 40 and 64 instead of the standard ones, 44 and 68. Only about 0.6% of the targets used the tail correction in the second iteration, but note that the results, both in terms of average error and in terms of standard deviation σ , are extremely affected by these rare events. large error is then amplified with the fixed selection of L i = 24, 44 and 68. To avoid this, one can correct the 'rare' braidsT i−1 , whose error is higher than a certain threshold, with a broader mesh (e.g. S(L i − 4, n)). The tail correction is very efficient. If we correct for the 0.6% of the targets with the largest errors in the second iteration with S(40, 3) instead of S(44, 3), we reduce the average error by about 8% after the third iteration (see table 1). The drastic improvement is due to the fact that once a braid is not properly corrected in the second iteration, the third one becomes ineffective. We can illustrate this situation with the example of the operator iY (where Y is the Pauli matrix): without tail correction it is approximated in the first iteration with an error of 0.0039, which is more than 5 times the average error expected. After the second iteration, we obtain an error of 4.3 × 10 −4 (almost 20 times higher than the average value) and after the third the error becomes 2.0 × 10 −4 (more than 200 times the mean value). If we use S(40, 3) instead of S(44, 3) in the second iteration we obtain an error 4.46 × 10 −5 , with a shorter braid than before, and a final error of 1.31 × 10 −6 , which is less than twice the average error.

General efficiency of the algorithm
To evaluate the efficiency of the hashing algorithm it is useful to calculate the behavior of the maximum length of the braids and of the runtime with respect to the average error obtained. We compare the results with those of the brute-force search (which gives the optimal braid length) and of the Solovay-Kitaev algorithm.
As described in section 4.2, we reduce the average error at the ith iteration to The total number of iterations (or depth) to achieve a final error of ε is then so the expected error after each iteration is For efficient optimization, we choose the length L i of the braid segments at the ith iteration to approximate the corresponding icosahedral group elements with an average error of ε i−1 (see discussions in section 4.4). So we have, from equation (16), with L ≈ 6 (see equation (16)), and the length of the braid we construct increases by (n + 1)L i = 4L i at the ith iteration, i.e.
Thus the total length of the braid with an error of ε is The final results for the hashing algorithm are, therefore, We have explicitly confirmed that we can realize the perfect length-error scaling as shown in figure 5 up to three iterations in the main processor. We can conclude that while no method beats the brute-force search in length, we achieve a respectable gain in time. Comparing these results with the length of the braids obtained by the Solovay-Kitaev algorithm in equation (3) and with its runtime in equation (4), the hashing algorithm gives results that are better than the Solovay-Kitaev results in terms of length and significantly better in terms of time. The error is the average error in approximating 10 000 random targets after the preprocessor and the three iterations in the main processor. The results agree with the expected behavior (equations (29) and (30)).

Conclusions
We have demonstrated, for a generic universal topological quantum computer, that the iterative pseudogroup hashing algorithm allows an efficient search for a braid sequence that approximates an arbitrary given single-qubit gate. This can be generalized to the search for two-qubit gates as well. The algorithm applies to the quantum gate construction in a conventional quantum computer given a small universal gate set or any other problems that involve realizing an arbitrary unitary rotation approximately by a sequence of 'elementary' rotations. The algorithm uses a set of pseudogroups based on the icosahedral group or other finite subgroups of SU(2), whose multiplication tables help generate, in a controllable fashion, smaller and smaller unitary rotations, which gradually (exponentially) reduce the distance between the result and the target. The iteration is in the same spirit as a generic renormalization group approach, which guarantees that the runtime of the algorithm is proportional to the logarithm of the inverse average final error 1/ε; the total length of the braid is instead quadratic in ln(1/ε), and both the results are better than the Solovay-Kitaev algorithm introduced in textbooks.
We have explicitly demonstrated that the result from the performance analysis is in excellent agreement with that from our computer simulation. We also showed that the residual error distributes according to the Wigner-Dyson unitary ensemble of random matrices. The connection of the error distribution with random matrix theory ensures that we can efficiently carry out the algorithm and improve the rare cases in the distribution tail.
The overhead of the algorithm is that we need to prepare several sets of braid representations of the finite subgroup elements. Obtaining the longer representation can be time-consuming, but fortunately, we need to compute them only once and use the same sets of representations for all future searches. or Q(t) = exp[ − N P(t)]. N P(t) is the expected number of braids with a distance to the identity less than t. The differential probability of having the braid with the nearest distance between t and t + dt is, therefore, In the large L limit,d(L) ≈ 1.021e −L/5.970 . This is the result we quoted in equation (16).