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

Greedy vs Simple Qubit Ancilla Manager decompose bug with prepareuniformsuperposition #818

Closed
akurlej opened this issue Mar 22, 2024 · 3 comments

Comments

@akurlej
Copy link

akurlej commented Mar 22, 2024

Greedy qubit manager fails with a duplicate QID on a CNOT in the LessThanConstant , SimpleQubitManager works without issue.

Issue occurs with current release of qualtran (0.2.0)

Code to reproduce:

import cirq
from qualtran.bloqs.prepare_uniform_superposition import PrepareUniformSuperposition

n=3
target = cirq.NamedQubit.range((n-1).bit_length(),prefix='target')
control = [cirq.NamedQubit('control')]
circuit_error = cirq.inverse(cirq.Circuit(PrepareUniformSuperposition(n,cvs=(0,)).on_registers(ctrl=control,target=target)))

#Greedy fails, simple works
gqm = cirq.GreedyQubitManager(prefix="_ancilla", maximize_reuse=True)
#gqm = cirq.SimpleQubitManager(prefix="_ancilla")
cirq.decompose(circuit_error,context = cirq.DecompositionContext(gqm))
@rroodll
Copy link

rroodll commented Apr 12, 2024

@mpharrigan is there any update on this one? Thanks
btw - sent an email to your outlook addr when you get a chance

@tanujkhattar
Copy link
Collaborator

@akurlej @rroodll This is now fixed. Please let us know if you still run into any issues. Thanks for reporting and apologies it took so long to fix!

@rroodll
Copy link

rroodll commented Jul 8, 2024

Thanks @tanujkhattar! This is great. One of us will pull the latest and give it a test.

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

3 participants