Skip to content

Flake in test_decompose_two_qubit_interaction_into_two_b_gates #5590

@dabacon

Description

@dabacon

The B in B gates stands for Birgitta.

_________ test_decompose_two_qubit_interaction_into_two_b_gates[obj12] _________
E         
E         obj = array([[-0.47694111+0.3915538j ,  0.21538306-0.31932923j,  0.27730114+0.04291081j,  0.59341889-0.19992136j],
E                [-...020922j],
E                [-0.40503864-0.31686381j, -0.72468644-0.40730777j, -0.133941  -0.14667923j,  0.02313404+0.06693884j]])
E         
E             @pytest.mark.parametrize('obj', UNITARY_OBJS)
E             def test_decompose_two_qubit_interaction_into_two_b_gates(obj: Any):
E                 circuit = cirq.Circuit(
E                     _decompose_two_qubit_interaction_into_two_b_gates(obj, qubits=cirq.LineQubit.range(2))
E                 )
E                 desired_unitary = obj if isinstance(obj, np.ndarray) else cirq.unitary(obj)
E                 for operation in circuit.all_operations():
E                     assert len(operation.qubits) < 2 or operation.gate == _B
E                 # We lose a lot of precision in the random 4 qubit gates, so this atol is higher.
E         >       np.testing.assert_allclose(cirq.unitary(circuit), desired_unitary, atol=1e-4)
E         E       AssertionError: 
E         E       Not equal to tolerance rtol=1e-07, atol=0.0001
E         E       
E         E       Mismatched elements: 10 / 16 (62.5%)
E         E       Max absolute difference: 0.00018732
E         E       Max relative difference: 0.00127372
E         E        x: array([[-0.477021+0.391513j,  0.215471-0.319221j,  0.277158+0.042791j,  0.59349 -0.199902j],
E         E              [-0.057516-0.529415j,  0.070736+0.385185j,  0.160235-0.451876j,  0.27052 -0.509895j],
E         E              [-0.24258 -0.110741j, -0.073792+0.042676j,  0.736175+0.331731j, -0.493886-0.160323j],
E         E              [-0.405093-0.316814j, -0.724758-0.407135j, -0.133913-0.146816j,  0.023186+0.066865j]], dtype=complex64)
E         E        y: array([[-0.476941+0.391554j,  0.21[538](https://github.com/quantumlib/Cirq/runs/7031790758?check_suite_focus=true#step:5:539)3-0.319329j,  0.277301+0.042911j,  0.593419-0.199921j],
E         E              [-0.057643-0.529477j,  0.070664+0.385111j,  0.160224-0.45184j ,  0.270658-0.509843j],
E         E              [-0.242481-0.110851j, -0.073766+0.042702j,  0.736204+0.331632j, -0.49397 -0.160209j],
E         E              [-0.405039-0.316864j, -0.724686-0.407308j, -0.133941-0.146679j,  0.023134+0.066939j]])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions