예제 #1
0
def test_random_state_vector_real_state_purity_with_k_param():
    """Check that real state vector with k_param > 0."""
    vec = random_state_vector(2, True, 1)
    mat = vec.conj().T * vec
    np.testing.assert_equal(is_pure(mat), False)
예제 #2
0
def test_random_state_vector_complex_state_purity():
    """Check that complex state vector from random state vector is pure."""
    vec = random_state_vector(2)
    mat = vec.conj().T * vec
    np.testing.assert_equal(is_pure(mat), True)
예제 #3
0
def test_random_state_vector_complex_state_purity_k_param_dim_list():
    """Check that complex state vector with k_param > 0 and dim list."""
    vec = random_state_vector([2, 2], False, 1)
    mat = vec.conj().T * vec
    np.testing.assert_equal(is_pure(mat), False)
    def genRho(self):
        dim = self.dimension**self.nbJoueurs

        psi = random_state_vector(dim)
        rho = pure_to_mixed(psi)
        return rho
예제 #5
0
def test_random_state_vector_real_state_purity():
    """Check that real state vector from random state vector is pure."""
    vec = random_state_vector(2, True).reshape(-1, 1)
    mat = vec * vec.conj().T
    np.testing.assert_equal(np.isclose(purity(mat), 1), True)
예제 #6
0
def test_random_state_vector_real_state_purity_with_k_param():
    """Check that real state vector with k_param > 0."""
    vec = random_state_vector(2, True, 1).reshape(-1, 1)
    mat = vec * vec.conj().T
    np.testing.assert_equal(np.isclose(purity(mat), 1), True)
예제 #7
0
def test_random_state_vector_complex_state_purity_k_param_dim_list():
    """Check that complex state vector with k_param > 0 and dim list."""
    vec = random_state_vector([2, 2], False, 1).reshape(-1, 1)
    mat = vec * vec.conj().T
    np.testing.assert_equal(np.isclose(purity(mat), 1), True)