#### Quantum compiling for diffusive sets of single qubit gates

In a recent work, we have proposed a new algorithm for approximating a given unitary operation U, at accuracy ε, by a sequence of gates {A, B} which are not self-inversed and therefore where the Solovay-Kitaev theorem/algorithm does not apply. As in the latter we do use the idea of “nets” around unity but the construction is not based on the “normal commutator” but on a diffusion process followed up by post-selection. The algorithm is applicable when the given gates form an “ergodic” or else “diffusive” set, in the sense that all possible sequences of moderate length cover the space of unitary operations in a dense way.

Below we have uploaded three programs applicable to single qubit gates, here are listed some important details for their correct application.

A) diffusiveOrnot.nb With this program one can test visually whether the set is diffusive or not. This program is just producing a graph plotting all possible sequences of the given gates of length 17. The function usually takes 3-4 minutes to run.

• If the obtained graph looks

then you may go on! If the obtained graph looks like the above but you do not see “much density” then this might fall in the next category meaning that each point you see represents many points, so it is not diffussive.

• If the output looks different, for instance as,

then stop here!, since you cannot apply the algorithm.

To save time please enter A, B computationally universal gates that in practice means that the phase of the (unimodular) eigenvalues should be related to π up to an irrational number. In addition these should be non-commuting gates. The percentage of computationally universal gates which are diffusive is according to our statistics 30% and the rest are non-diffusive.

B) Nets.nb This program creates a sequence of nets around the unity. At first step, the sampling net is produced just by taking all sequences of length 17. From the sampling net, the sequences inside a calculated radius are post-selected for creating a mute net. With the help of the algorithm, the sequences of the latter are then used to create the 0-order net and from this the 1-order net.

• To arrive to a final accuracy ε < 0.008 you just need to create the 0 - net. It takes around 20 minutes.
• For an accuracy ε < 0.00005 you also need to create the 1-net. It takes around 10 days but we explain how one can adjust the settings for shorter running time and less accuracy.

The program outputs/prints-out information on the progress of the algorithm and also provides graphs with the nets. The data (3-D real vectors describing the unitary matrices) are exported. on your computer as netS.dat, net0.dat, net1.dat files so they can be used by the next program. The files seqS.dat, seq0.dat, seq1.dat are also created and exported, keeping track of the corresponding sequences.

C) PickTheSequence.nb In this program one inputs the unitary operation to be approximated by sequences of A and B using a recursive procedure. One also needs to input A and B and please make sure that these are identical to the ones you entered in Nets.nb when constructing the nets. This program imports the dat files produced and stored by the previous program Nets.nb. If you want to approximate another unitary gate by the same gates {A,B} you do not need to re-build the nets by re-running Nets.nb.

If you have encountered any problems in the application of the algorithm or you simply have suggestions for improvement, please contact us. Since, we do not include any routine that would improve the quality of the nets for a small percentage of target unitaries, the program might not work. This problem mainly concerns gates at the “borders” of the ball.

In the publication we also suggest a fast version of Solovay-Kitaev algorithm requiring the gates and its inverses as well as the property of diffusivity on the set. This algorithm achieves better scaling of length with accuracy than the initial Solovay-Kitaev algorithm. We have not uploaded the related programs to avoid confusion, but you may write us a request.