Cirq interoperability

Translating quantum circuits

myQLM provides binders to translate quantum circuit from Google Cirq to myQLM and vice-versa throught functions cirq_to_qlm() and qlm_to_cirq()

from qat.interop.cirq import cirq_to_qlm

qlm_circ = cirq_to_qlm(your_google_circ)

Or

from qat.interop.cirq import qlm_to_cirq

google_circ = qlm_to_cirq(your_qlm_circ)

Note

when mixing LineQubit and GridQubit, all grid qubits will be allocated first, then all line qubits. The order will follow coordinates.

Source code documentation

Circuit translation

qat.interop.cirq.cirq_to_qlm(circ, sep_measures=False, **kwargs)

Converts a google cirq circuit to a qlm circuit

Parameters
  • cirq – the cirq circuit to convert

  • sep_measures

    Separates measures from the circuit:

    • if set to True measures won’t be included in the resulting circuits, qubits to be measured will be put in a list, the resulting measureless circuit and this list will be returned in a tuple : (resulting_circuit, list_qubits)

    • if set to False, measures will be converted normally (Default set to False)

  • kwargs – these are the options that you would use on a regular to_circ function, to generate a QLM circuit from a PyAQASM program these are added for more flexibility, for advanced users

Returns

If sep_measures is set to:

  • True: the result is a tuple composed of a Circuit and a list of qubits that should be measured

  • False: the result is a Circuit

Return type

tuple or Circuit

qat.interop.cirq.qlm_to_cirq(qlm_circuit)

Converts a QLM circuit to a cirq circuit.

Parameters

qlm_circuit – the input QLM circuit to convert

Returns

A cirq Circuit object resulting from the conversion