qat.plugins.QuameleonPlugin

class qat.plugins.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()

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

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

compile(batch: Batch) Batch

Loops a batch through all the plugins present inside the QPU.

Parameters

batch (Batch) – a batch of jobs. If a single job is provided, the job is embedded into a Batch, compiled, and the first result is returned.

Returns

a batch of jobs

Return type

(Batch)