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

GateWithRegisters.controlled does not work with call graph #865

Closed
anurudhp opened this issue Apr 9, 2024 · 2 comments · Fixed by #879
Closed

GateWithRegisters.controlled does not work with call graph #865

anurudhp opened this issue Apr 9, 2024 · 2 comments · Fixed by #879

Comments

@anurudhp
Copy link
Contributor

anurudhp commented Apr 9, 2024

#848 (comment)

Replacing Controlled(self.U, CtrlSpec(cvs=0)) with self.U.controlled(control_values=[0]) in GQSP results in:

AttributeError: 'BloqAsCirqGate' object has no attribute 'pretty_name'

Minimal code to reproduce error:

from qualtran.bloqs.basic_gates import XPowGate
from qualtran.bloqs.qsp.generalized_qsp import GeneralizedQSP
from qualtran.drawing import show_call_graph

gqsp = GeneralizedQSP.from_qsp_polynomial(XPowGate(), (0.5, 0.5))
g, _ = gqsp.call_graph(max_depth=1)
show_call_graph(g)
@mpharrigan
Copy link
Collaborator

I can't reproduce this on main. There was a recent PR merged that moved controlled to the bloqs one; maybe @tanujkhattar knows more

@anurudhp
Copy link
Contributor Author

It still crashes for me on main, on replacing

counts.add((Controlled(self.U, CtrlSpec(cvs=0)), degree - self.negative_power))

with

counts.add((self.U.controlled(control_values=[0]), degree - self.negative_power))

(in build_call_graph)

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

Successfully merging a pull request may close this issue.

2 participants