qat.plugins.QuameleonPlugin

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

A Plugin 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()

qpu.submit(job)
Parameters
  • 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

compile(batch, specs)

Compiles a job. This function ensure all the job composing the batch are compliant with the specs

Parameters
Returns

same batch as the one passed as input

Return type

Batch