A quantum compiling algorithm is an algorithm for decomposing ("compiling") an arbitrary unitary matrix into a sequence of elementary operations (SEO). Suppose
Uin is an $\nb$-bit unstructured unitary matrix (a unitary matrix with no special symmetries) that we wish to compile. For $\nb>10$, expressing
Uin as a SEO requires more than a million CNOTs. This calls for a method for finding a unitary matrix that: (1)approximates
Uin well, and (2) is expressible with fewer CNOTs than
Uin. The purpose of this paper is to propose one such approximation method. Various quantum compiling algorithms have been proposed in the literature that decompose an arbitrary unitary matrix into a sequence of U(2)-multiplexors, each of which is then decomposed into a SEO. Our strategy for approximating
Uin is to approximate these intermediate U(2)-multiplexors. In this paper, we will show how one can approximate a U(2)-multiplexor by another U(2)-multiplexor that is expressible with fewer CNOTs.
We rigorously prove a no-go theorem that, in sharp contrast to the case of compiling unitary gates, it is impossible to compile an arbitrary channel to arbitrary precision with any given finite elementary channel set, regardless of the length of the decomposition sequence. However, for a fixed error bound $\ensuremath{\epsilon}$, we find a general and systematic strategy to compile arbitrary quantum channels. We construct a universal set with a constant number of $\ensuremath{\epsilon}$-dependent elementary channels, such that an arbitrary quantum channel can be decomposed into a sequence of these elementary channels followed by a unitary gate, with the sequence length bounded by $O(\frac{1}{\ensuremath{\epsilon}}log\frac{1}{\ensuremath{\epsilon}})$ in the worst case. We further optimize this approach by exploiting proximal policy optimization---a powerful deep reinforcement learning algorithm for the gate compilation. We numerically evaluate the performance of our algorithm concerning topological compiling of Majorana fermions, and we show that our algorithm can conveniently and effectively reduce the use of expensive elementary operations.