GateCountPredicate

class GateCountPredicate(gate)[source]

Bases: PassPredicate

The GateCountPredicate class.

The GateCountPredicate returns true if the number of one of more types of gate has changed in the circuit.

__init__(gate)[source]

Construct a GateCountPredicate.

Parameters:

gate (Gate | Sequence[Gate] | str) –

The gate(s) to count. Either a single gate, a sequence of gates, or a string

representing the gate type. The allowed strings are:
  • ’sq’ for single qudit gates

  • ’tq’ for two qudit gates

  • ’multi’ for multi-qudit gates

  • ’many’ for gates with more than 2 qudits

Attributes

key

Methods

get_truth_value(circuit, data)

Call this predicate, see PassPredicate for more info.