qml.estimator.resource_operator.GateCount¶
- class GateCount(gate, count=1)[source]¶
Bases:
objectA class to represent a gate and its number of occurrences in a circuit or decomposition.
- Parameters:
gate (CompressedResourceOp) – The compressed resource representation of the gate being counted.
counts (int | None) – The number of occurrences of the quantum gate in the circuit or decomposition. Defaults to
1.
- Returns:
The container object holding both pieces of information.
- Return type:
Example
This example creates an object to count
5instances ofqre.QFTacting on three wires:>>> from pennylane import estimator as qre >>> qft = qre.resource_rep(qre.QFT, {"num_wires": 3}) >>> counts = qre.GateCount(qft, 5) >>> counts (5 x QFT(3))
code/api/pennylane.estimator.resource_operator.GateCount
Download Python script
Download Notebook
View on GitHub