def test_stinespring_dims(self, dimension): """ Stinespring: Check that dims of channels are preserved. """ chan = super_tensor(to_super(sigmax()), to_super(qeye(dimension))) A, B = to_stinespring(chan) assert A.dims == [[2, dimension, 1], [2, dimension]] assert B.dims == [[2, dimension, 1], [2, dimension]]
def test_stinespring_cp(self, dimension): """ Stinespring: A and B match for CP maps. """ superop = rand_super_bcsz(dimension) A, B = to_stinespring(superop) assert norm(A - B) < tol
def test_stinespring_dims(self): """ Stinespring: Check that dims of channels are preserved. """ # FIXME: not the most general test, since this assumes a map # from square matrices to square matrices on the same space. chan = super_tensor(to_super(sigmax()), to_super(qeye(3))) A, B = to_stinespring(chan) assert_equal(A.dims, [[2, 3, 1], [2, 3]]) assert_equal(B.dims, [[2, 3, 1], [2, 3]])
def case(map, state): S = to_super(map) A, B = to_stinespring(map) q1 = vector_to_operator(S * operator_to_vector(state)) # FIXME: problem if Kraus index is implicitly # ptraced! q2 = (A * state * B.dag()).ptrace((0, )) assert_((q1 - q2).norm('tr') <= thresh)
def case(map, state): S = to_super(map) A, B = to_stinespring(map) q1 = vector_to_operator( S * operator_to_vector(state) ) # FIXME: problem if Kraus index is implicitly # ptraced! q2 = (A * state * B.dag()).ptrace((0,)) assert_((q1 - q2).norm('tr') <= thresh)
def test_stinespring_agrees(self, dimension): """ Stinespring: Partial Tr over pair agrees w/ supermatrix. """ map = rand_super_bcsz(dimension) state = rand_dm_ginibre(dimension) S = to_super(map) A, B = to_stinespring(map) q1 = vector_to_operator(S * operator_to_vector(state)) # FIXME: problem if Kraus index is implicitly # ptraced! q2 = (A * state * B.dag()).ptrace((0, )) assert (q1 - q2).norm('tr') <= tol
def case(map): A, B = to_stinespring(map) assert_(norm((A - B).data.todense()) < thresh)
def case(map): A, B = to_stinespring(map) assert_(norm((A - B).full()) < thresh)