  We introduce an open source software package UniversalQCompiler written in
Mathematica that allows the decomposition of arbitrary quantum operations into
a sequence of single-qubit rotations (with arbitrary rotation angles) and
controlled-NOT (C-NOT) gates. Together with the existing package QI, this
allows quantum information protocols to be analysed and then compiled to
quantum circuits. Our decompositions are based on Phys. Rev. A 93, 032318
(2016), and hence, for generic operations, they are near optimal in terms of
the number of gates required. UniversalQCompiler allows the compilation of any
isometry (in particular, it can be used for unitaries and state preparation),
quantum channel, positive-operator valued measure (POVM) or quantum instrument,
although the run time becomes prohibitive for large numbers of qubits. The
resulting circuits can be displayed graphically within Mathematica or exported
to LaTeX. We also provide functionality to translate the circuits to OpenQASM,
the quantum assembly language used, for instance, by the IBM Q Experience.
