  Microwave cavities coupled to superconducting qubits have been demonstrated
to be a promising platform for quantum information processing. A major
challenge in this setup is to realize universal control over the cavity. A
promising approach are selective number-dependent arbitrary phase (SNAP) gates
combined with cavity displacements. It has been proven that this is a universal
gate set, but a central question remained open so far: how can a given target
operation be realized efficiently with a sequence of these operations. In this
work, we present a practical scheme to address this problem. It involves a
hierarchical strategy to insert new gates into a sequence, followed by a
co-optimization of the control parameters, which generates short high-fidelity
sequences. For a broad range of experimentally relevant applications, we find
that they can be implemented with 3 to 4 SNAP gates, compared to up to 50 with
previously known techniques.
