Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue in copying QuantumCircuit #438

Closed
chunfuchen opened this issue Apr 30, 2018 · 1 comment
Closed

issue in copying QuantumCircuit #438

chunfuchen opened this issue Apr 30, 2018 · 1 comment

Comments

@chunfuchen
Copy link
Contributor

When copying a QuantumCircuit with deepcopy, the name of circuit will not be automatically updated.
Thus, the results are wrong trying to get results based on circuit object.

Expected Behavior

The results should be consistent with provided circuit object.

Current Behavior

The results are still based on circuit name rather than circuit object.

Possible Solution

No idea.

Steps to Reproduce (for bugs)

def main():

	qr = QuantumRegister(2)
	cr = ClassicalRegister(2)

	c = QuantumCircuit(qr, cr)

	c.x(qr[1])
	c2 = copy.deepcopy(c)
	c2.x(qr[0])
	backend_name ='local_statevector_simulator'
	result = q_execute([c, c2], backend_name=backend_name, skip_translation=False)
	print(result.get_statevector(c))
	print(result.get_statevector(c2))

c and c2 will produce the same statevector.

Your Environment

  • Version used: master branch
  • Environment name and version (e.g. Python 3.6.1): 3.6
  • Operating System and version: macOS, 10.13
@chunfuchen
Copy link
Contributor Author

A workaround is #389 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant