def test_ryxxy_unitary(rads):
    X = np.array([[0, 1], [1, 0]])
    Y = np.array([[0, -1j], [1j, 0]])
    YX = kron(Y, X)
    XY = kron(X, Y)
    np.testing.assert_allclose(cirq.unitary(ofc.Ryxxy(rads)),
                               expm(-1j * rads * (YX - XY) / 2),
                               atol=1e-8)
Exemple #2
0
def test_cryxxy_unitary(rads):
    np.testing.assert_allclose(
            cirq.unitary(ofc.CRyxxy(rads)),
            cirq.unitary(cirq.ControlledGate(ofc.Ryxxy(rads))),
            atol=1e-8)
def test_compare_ryxxy_to_cirq_equivalent(rads):
    old_gate = ofc.Ryxxy(rads=rads)
    new_gate = cirq.GivensRotation(angle_rads=rads)
    np.testing.assert_allclose(cirq.unitary(old_gate), cirq.unitary(new_gate))