3
$\begingroup$

I am trying to use Cirq to compile arbitrary quantum circuits to custom native gate sets, e.g., to use the Cirq compiler to generate quantum circuits for different quantum computers (IBM, Rigetti, IonQ).

If this was possible, most likely the cirq.optimizers has to be used.

Can someone help me with this?

Thanks in advance!

$\endgroup$

1 Answer 1

3
$\begingroup$

Cirq's target_gate_sets will help. For example, a circuit can be compiled to a CZ gateset by calling cirq.optimize_for_target_gateset(circuit, gateset=cirq.CZTargetGateset())

CompilationTargetGateset can be used to define how to compile a circuit to any custom gateset.

$\endgroup$
2
  • $\begingroup$ Thanks a lot for your answer. I guess if I wanted to use Cirq to transpile to only the respective native gate set, your last suggestions might be the way to go, since the QasmOutput/QuilOutput and the IonQ result contain still more than just the native gates (for IonQ, e.g., SWAP operation). $\endgroup$
    – nils
    Commented Mar 11, 2022 at 7:02
  • $\begingroup$ Good catch. The gateset for IonQ refers to the gateset of their API instead of the device. This will be problem for QasmOutput/QuilOutput as well because the gateset they are compiling to is not the one that will actually execute on the hardware; but the one that will be optimized to the respective native gateset by IBM and Rigetti's compiler. I've updated my answer appropriately. $\endgroup$ Commented Mar 11, 2022 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.