View source on GitHub |
Determines if two circuits have equivalent effects.
cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(
actual: cirq.AbstractCircuit
,
reference: cirq.AbstractCircuit
,
atol: float = 1e-08
) -> None
Used in the notebooks
Used in the tutorials |
---|
The circuits can contain measurements, but the measurements must be at the end of the circuit. Circuits are equivalent if, for all possible inputs, their outputs (classical bits for lines terminated with measurement and qubits for lines without measurement) are observationally indistinguishable up to a tolerance. Note that under this definition of equivalence circuits that differ solely in the overall phase of the post-measurement state of measured qubits are considered equivalent.
For example, applying an extra Z gate to an unmeasured qubit changes the effect of a circuit. But inserting a Z gate operation just before a measurement does not.
Args | |
---|---|
actual
|
The circuit that was actually computed by some process. |
reference
|
A circuit with the correct function. |
atol
|
Absolute error tolerance. |