Open balopat opened 3 years ago
Description of the issue
https://github.com/quantumlib/Cirq/pull/3914/checks?check_run_id=2107089159
_____ test_bidiagonalize_real_matrix_pair_with_symmetric_products[a40-b40] _____ a = array([[ 0.3339604 , -0.64209018, 0.08013909, -0.48298666], [ 0.5876492 , 0.06662798, -0.17019409, 0.5355366... [ 0.40079316, -0.21360456, 0.12212223, 0.19078334], [ 0.13534768, 0.11948305, -0.81295149, -0.30458568]]) b = array([[-0.00938582, -0.02506192, -0.00410744, -0.04594066], [ 0.00838088, 0.02237856, 0.00366766, 0.0410218... [ 0.00206892, 0.00552442, 0.00090541, 0.01012673], [-0.00352259, -0.00940599, -0.00154157, -0.01724199]]) @pytest.mark.parametrize( 'a,b', [ (np.zeros((0, 0)), np.zeros((0, 0))), (np.eye(2), np.eye(2)), (np.eye(4), np.eye(4)), (np.eye(4), np.zeros((4, 4))), (H, H), (cirq.kron(np.eye(2), H), cirq.kron(H, np.eye(2))), (cirq.kron(np.eye(2), Z), cirq.kron(X, np.eye(2))), ] + [random_bi_diagonalizable_pair(2) for _ in range(10)] + [random_bi_diagonalizable_pair(4) for _ in range(10)] + [ random_bi_diagonalizable_pair(4, d1, d2) for _ in range(10) for d1 in range(4) for d2 in range(4) ] + [random_bi_diagonalizable_pair(k) for k in range(1, 10)], ) def test_bidiagonalize_real_matrix_pair_with_symmetric_products(a, b): a = np.array(a) b = np.array(b) p, q = cirq.bidiagonalize_real_matrix_pair_with_symmetric_products(a, b) > assert_bidiagonalized_by(a, p, q) cirq/linalg/diagonalize_test.py:207: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ m = array([[ 0.3339604 , -0.64209018, 0.08013909, -0.48298666], [ 0.5876492 , 0.06662798, -0.17019409, 0.5355366... [ 0.40079316, -0.21360456, 0.12212223, 0.19078334], [ 0.13534768, 0.11948305, -0.81295149, -0.30458568]]) p = array([[ 0.70945677, -0.63349569, -0.15638607, 0.2662662 ], [ 0.211501 , -0.20218289, 0.17925377, -0.9392856... [ 0.60832511, 0.59973378, 0.50914112, 0.10504891], [-0.28614502, -0.44511199, 0.82715585, 0.18923411]]) q = array([[-0.17600994, -0.11475276, 0.85828799, 0.46818163], [-0.46998004, -0.33249548, -0.49558939, 0.6503511... [-0.0770259 , 0.92813344, -0.08489247, 0.354159 ], [-0.86151394, 0.12184777, 0.10259709, -0.48210029]]) rtol = 1e-05, atol = 1e-08 def assert_bidiagonalized_by(m, p, q, rtol: float = 1e-5, atol: float = 1e-8): d = p.dot(m).dot(q) > assert ( cirq.is_orthogonal(p) and cirq.is_orthogonal(q) and cirq.is_diagonal(d, atol=atol) ), _get_assert_bidiagonalized_by_str(m, p, q, d) E AssertionError: m.round(3) : [[ 0.334 -0.642 0.08 -0.483] E [ 0.588 0.067 -0.17 0.536] E [ 0.401 -0.214 0.122 0.191] E [ 0.135 0.119 -0.813 -0.305]], p.round(3) : [[ 0.709 -0.633 -0.156 0.266] E [ 0.212 -0.202 0.179 -0.939] E [ 0.608 0.6 0.509 0.105] E [-0.286 -0.445 0.827 0.189]], q.round(3): [[-0.176 -0.115 0.858 0.468] E [-0.47 -0.332 -0.496 0.65 ] E [-0.077 0.928 -0.085 0.354] E [-0.862 0.122 0.103 -0.482]], np.abs(p.T @ m @ p).round(2): [[0.92 0. 0. 0. ] E [0. 0.9 0. 0. ] E [0. 0. 0.9 0. ] E [0. 0. 0. 0. ]] E assert (True and True and False) E + where True = <function is_orthogonal at 0x7fc49042b290>(array([[ 0.70945677, -0.63349569, -0.15638607, 0.2662662 ],\n [ 0.211501 , -0.20218289, 0.17925377, -0.9392856... [ 0.60832511, 0.59973378, 0.50914112, 0.10504891],\n [-0.28614502, -0.44511199, 0.82715585, 0.18923411]])) E + where <function is_orthogonal at 0x7fc49042b290> = cirq.is_orthogonal E + and True = <function is_orthogonal at 0x7fc49042b290>(array([[-0.17600994, -0.11475276, 0.85828799, 0.46818163],\n [-0.46998004, -0.33249548, -0.49558939, 0.6503511... [-0.0770259 , 0.92813344, -0.08489247, 0.354159 ],\n [-0.86151394, 0.12184777, 0.10259709, -0.48210029]])) E + where <function is_orthogonal at 0x7fc49042b290> = cirq.is_orthogonal E + and False = <function is_diagonal at 0x7fc4904273b0>(array([[ 9.20304375e-01, -3.90039323e-17, -6.84034194e-17, -1.19018274e-16],\n [-4.92727203e-17, 9.01642270e-01,...1e-07, 9.01641372e-01, 3.07323624e-17],\n [-6.18416776e-17, 1.16821231e-16, -1.27458159e-17, 3.20614510e-17]]), atol=1e-08) E + where <function is_diagonal at 0x7fc4904273b0> = cirq.is_diagonal cirq/linalg/diagonalize_test.py:88: AssertionError
I wasn't able to reproduce this, so I am not sure if it is still an issue.
Description of the issue
https://github.com/quantumlib/Cirq/pull/3914/checks?check_run_id=2107089159