Skip to content

Increase test tolerances on some analytical decomposition tests #5535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,4 @@ def test_decompose_to_diagonal_and_circuit(v):
assert cirq.is_diagonal(diagonal)
combined_circuit = cirq.Circuit(cirq.MatrixGate(diagonal)(b, c), ops)
circuit_unitary = combined_circuit.unitary(qubits_that_should_be_present=[b, c])
cirq.testing.assert_allclose_up_to_global_phase(circuit_unitary, v, atol=2e-6)
cirq.testing.assert_allclose_up_to_global_phase(circuit_unitary, v, atol=1e-5)
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_decompose_two_qubit_interaction_into_two_b_gates(obj: Any):
for operation in circuit.all_operations():
assert len(operation.qubits) < 2 or operation.gate == _B
# We lose a lot of precision in the random 4 qubit gates, so this atol is higher.
np.testing.assert_allclose(cirq.unitary(circuit), desired_unitary, atol=3e-5)
np.testing.assert_allclose(cirq.unitary(circuit), desired_unitary, atol=1e-4)


def test_decompose_xx_yy_into_two_fsims_ignoring_single_qubit_ops_fail():
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_decompose_two_qubit_interaction_into_four_fsim_gates_equivalence(
for operation in circuit.all_operations():
assert len(operation.qubits) < 2 or operation.gate == fsim_gate
assert len(circuit) <= 4 * 3 + 5
assert cirq.approx_eq(circuit.unitary(qubit_order=qubits), desired_unitary, atol=1e-4)
assert cirq.approx_eq(circuit.unitary(qubit_order=qubits), desired_unitary, atol=2e-4)


def test_decompose_two_qubit_interaction_into_four_fsim_gates_validate():
Expand Down