Abstract
Modern computation relies crucially on modular architectures, breaking a complex algorithm into self-contained subroutines. A client can then call upon a remote server to implement parts of the computation independently via an application programming interface (API). Present APIs relay only classical information. Here we implement a quantum API that enables a client to estimate the absolute value of the trace of a server-provided unitary operation $$U$$
U
. We demonstrate that the algorithm functions correctly irrespective of what unitary $$U$$
U
the server implements or how the server specifically realizes $$U$$
U
. Our experiment involves pioneering techniques to coherently swap qubits encoded within the motional states of a trapped $${}^{171}{{\rm{Yb}}}^{+}\,$$
171
Yb
+
ion, controlled on its hyperfine state. This constitutes the first demonstration of modular computation in the quantum regime, providing a step towards scalable, parallelization of quantum computation.