PyQuil interoperability
Warning: Deprecated for python 3.6
Translating quantum circuits
myQLM provides binders to translate quantum circuit from PyQuil to myQLM
and vice-verse throught functions pyquil_to_qlm()
and qlm_to_pyquil()
from qat.interop.pyquil import pyquil_to_qlm
qlm_circuit = pyquil_to_qlm(your_pyquil_circuit)
Or
from qat.interop.pyquil import qlm_to_pyquil
pyquil_circuit = qlm_to_pyquil(your_qlm_circuit)
Connecting to a QPU
myQLM can be used to connect to a PyQuil QVM. This module is composed of a main
class PyquilQPU
used to wrap a QVM into a myQLM QPU.
In this section, we assume a QVM is running locally and that this QVM is listenning to the port 15011. The following code defines a myQLM QPU wrapping the PyQuil QVM:
from qat.interop.pyquil import PyquilQPU
from pyquil import get_qc
# Define port and ip
IP = "127.0.0.1"
PORT = "15011"
# Define a QPU
os.environ["QCS_SETTINGS_APPLICATIONS_PYQUIL_QVM_URL"] = "http://{ip}:{port}".format(ip=IP, port=PORT)
qvm = get_qc('9q-qvm')
qpu = PyquilQPU(qvm)
# Submit a job to the QVM
result = qpu.submit(qlm_job)