예제 #1
0
def test_is_product_separable_state():
    """Check that is_product_vector returns True for a separable state."""
    e_0, e_1 = basis(2, 0), basis(2, 1)
    sep_vec = (
        1
        / 2
        * (
            np.kron(e_0, e_0)
            - np.kron(e_0, e_1)
            - np.kron(e_1, e_0)
            + np.kron(e_1, e_1)
        )
    )
    np.testing.assert_equal(is_product_vector(sep_vec), True)
예제 #2
0
def test_is_product_entangled_state():
    """Check that is_product_vector returns False for an entangled state."""
    ent_vec = max_entangled(3)
    np.testing.assert_equal(is_product_vector(ent_vec), False)
예제 #3
0
def test_is_product_entangled_state_3_sys():
    """Check that dimension argument as list is supported."""
    ent_vec = max_entangled(4)
    np.testing.assert_equal(is_product_vector(ent_vec, dim=[2, 2, 2, 2]),
                            False)