ProjectQ interoperability

Translating quantum circuits

myQLM provides binders to translate ProjectQ circuits into myQLM circuits through classes AqasmPrinter and AqasmEngine

from projectq.ops import X, H, CNOT
from projectq.cengines import MainEngine
from qat.interop.projectq import AqasmPrinter, AqasmEngine

# Define AQASM engine
aq = AqasmPrinter(MainEngine)
eng = AqasmEngine(aq, engine_list=[aq])

# Create a ProjectQ circuit
q = eng.allocate_qureg(2)
X | q[0]
H | q[0]
CNOT | (q[0], q[1])

# Then recover your generated qlm circuit with
circ = eng.projectq_to_qlm()
print("The circuit is composed of the gates:",
      list(circ.iterate_simple()))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'projectq'