  Topological color codes are widely acknowledged as promising candidates for
fault-tolerant quantum computing. Neither a two-dimensional nor a
three-dimensional topology, however, can provide a universal gate set $\{$H, T,
CNOT$\}$, with the T-gate missing in the two-dimensional and the H-gate in the
three-dimensional case. These complementary shortcomings of the isolated
topologies may be overcome in a combined approach, by switching between a two-
and a three-dimensional code while maintaining the logical state. In this work,
we construct resource-optimized deterministic and non-deterministic code
switching protocols for two- and three-dimensional distance-three color codes
using fault-tolerant quantum circuits based on flag-qubits. Deterministic
protocols allow for the fault-tolerant implementation of logical gates on an
encoded quantum state, while non-deterministic protocols may be used for the
fault-tolerant preparation of magic states. Taking the error rates of
state-of-the-art trapped-ion quantum processors as a reference, we find a
logical failure probability of $3\%$ for deterministic logical gates, which
cannot be realized transversally in the respective code. By replacing the
three-dimensional distance-three color code in the protocol for magic state
preparation with the morphed code introduced in [1], we reduce the logical
failure rates by two orders of magnitude, thus rendering it a viable method for
magic state preparation on near-term quantum processors. Our results
demonstrate that code switching enables the fault-tolerant and deterministic
implementation of a universal gate set under realistic conditions, and thereby
provide a practical avenue to advance universal, fault-tolerant quantum
computing and enable quantum algorithms on first, error-corrected logical
qubits.
