qml.labs.resource_estimation.GateCount

class GateCount(gate, count=1)[source]

Bases: object

A class to represent a gate and its number of occurrences in a circuit or decomposition.

Parameters:
  • gate (CompressedResourceOp) – a compressed resource representation of the gate being counted

  • counts (int, optional) – The number of occurances of the quantum gate in the circuit or decomposition. Defaults to 1.

Returns:

the container object holding both pieces of information

Return type:

GateCount

Example

In this example we create an object to count 5 instances of plre.ResourceQFT acting on three wires:

>>> qft = plre.resource_rep(plre.ResourceQFT, {"num_wires": 3})
>>> counts = plre.GateCount(qft, 5)
>>> counts
(5 x QFT(3))