tensorcircuit icon indicating copy to clipboard operation
tensorcircuit copied to clipboard

`copy` operation of DM circuit forgets previous `apply_general_kraus` operations

Open SUSYUSTC opened this issue 6 months ago • 1 comments

copy operation of DM circuit forgets previous apply_general_kraus operations.

n = 1
c = tc.DMCircuit(n)
c.h(0)
P0 = np.array([[1.0, 0.0], [0.0, 0.0]])
P1 = np.array([[0.0, 0.0], [0.0, 1.0]])
c.apply_general_kraus([P0, P1], 0)
print('without copy')
print(c.densitymatrix())
print('with copy')
print(c.copy().densitymatrix())

Error Output

without copy
[[0.5+0.j 0. +0.j]
 [0. +0.j 0.5+0.j]]
with copy
[[0.5+0.j 0.5+0.j]
 [0.5+0.j 0.5+0.j]]

SUSYUSTC avatar Jan 24 '24 00:01 SUSYUSTC