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
- 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
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, qbits) job = prog.to_circ().to_job() qpu.submit(job)
HardwareSpecs) – the Hardware specs to emulate
Topology) – the topology of the specs to emulate
GateSet) – the gate set of the specs to emulate
QPUHandler) – the underlying qpu.