def test_rxxyy_unitary(rads):
    X = np.array([[0, 1], [1, 0]])
    Y = np.array([[0, -1j], [1j, 0]])
    XX = kron(X, X)
    YY = kron(Y, Y)
    np.testing.assert_allclose(cirq.unitary(ofc.Rxxyy(rads)),
                               expm(-1j * rads * (XX + YY) / 2),
                               atol=1e-8)
예제 #2
0
def test_crxxyy_unitary(rads):
    np.testing.assert_allclose(
            cirq.unitary(ofc.CRxxyy(rads)),
            cirq.unitary(cirq.ControlledGate(ofc.Rxxyy(rads))),
            atol=1e-8)