PyQuil interoperability

Warning

Module qat.interop.pyquil is deprecated. Bugs found in this module will not be fixed.

Translating quantum circuits

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)