Circuit.count
- Circuit.count(op)[source]
Count the number of times op occurs in the circuit.
- Parameters:
op (
Operation | Gate
) – The operation or gate to count.- Raises:
ValueError – If op could not have been placed on the circuit due to either an invalid location or gate radix mismatch.
Examples
>>> from bqskit.ir.gates import HGate >>> circ = Circuit(1) >>> op = Operation(HGate(), [0]) >>> circ.append(op) >>> circ.count(op) 1 >>> circ.append(op) >>> circ.count(op) 2