qrunch.quantum.circuits.circuit

Functions

compare_circuits(circuit_1, circuit_2)

Compare two instances of Circuit.

compare_circuits(circuit_1: Circuit, circuit_2: Circuit) bool

Compare two instances of Circuit.

These can be Circuit or UniversalCircuitGate instances but the type of both must match as well. The result should be True if the two circuits are equivalent, even if the list of gates is in a different order, provided they act on different qubits. If two gates act on the same qubits, the order must be respected.

Parameters:
  • circuit_1 (Circuit) – First circuit to be considered.

  • circuit_2 (Circuit) – Second circuit to be considered.

Returns:

True if circuits are equivalent.

Return type:

bool