cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent¶
-
cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(actual: cirq.circuits.circuit.Circuit, reference: cirq.circuits.circuit.Circuit, atol: float) → None[source]¶ Determines if two circuits have equivalent effects.
The circuits can contain measurements, but the measurements must be at theend of the circuit. Circuits are equivalent if, for all possible inputs,their outputs (classical bits for lines terminated with measurement andqubits for lines without measurement) are observationally indistinguishableup to a tolerance. Note that under this definition of equivalence circuitsthat differ solely in the overall phase of the post-measurement state ofmeasured qubits are considered equivalent.For example, applying an extra Z gate to an unmeasured qubit changes theeffect of a circuit. But inserting a Z gate operation just before ameasurement does not.Parameters: - actual – The circuit that was actually computed by some process.
- reference – A circuit with the correct function.
- atol – Absolute error tolerance.