An efficient and compact switch for quantum circuits