QuameleonPlugin : emulating hardware constraints via a plugin

It can sometimes come handy to add a front layer to some universal QPU (e.g some simulator) in order to emulate particular hardware constraints.

This is the purpose of the QuameleonPlugin.

class qat.core.quameleon.QuameleonPlugin(specs=None, topology=None, gate_set=None, qpu=None, plugins=None)

A QPU overriding the Hardware specs of a QPU, thus producing a QPU with custom Hardware specs.

The main usage of this Plugin is to emulate a QPU with a particular hardware specs, while still benefiting from the universal behavior on the simulation side.

All the executions are handled by the underlying QPU, provided that the submitted jobs are compliant with the specs provided at construction.

Here is an example of usage to emulate an LNN connectivity on the PyLinalg simulator:

from qat.core.quameleon import QuameleonPlugin
from qat.core import Topology, TopologyType

lnn_topology = Topology(type=TopologyType.LNN)

from qat.pylinalg import PyLinalg

qpu = QuameleonPlugin(topology=lnn_topology) | PyLinalg()

In that example, running the following code will fail:

from qat.lang.AQASM import *

prog = Program()
qbits = prog.qalloc(3)
prog.apply(CNOT, qbits[0], qbits[2])
job = prog.to_circ().to_job()

  • specs (optional, HardwareSpecs) – the Hardware specs to emulate

  • topology (optional, Topology) – the topology of the specs to emulate

  • gate_set (optional, GateSet) – the gate set of the specs to emulate

  • qpu (optional, QPUHandler) – the underlying qpu.