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

CtrlSpec add support for symbolic Shaped control values #1168

Closed
anurudhp opened this issue Jul 20, 2024 · 5 comments · Fixed by #1491
Closed

CtrlSpec add support for symbolic Shaped control values #1168

anurudhp opened this issue Jul 20, 2024 · 5 comments · Fixed by #1491
Labels
Milestone

Comments

@anurudhp
Copy link
Contributor

anurudhp commented Jul 20, 2024

Useful when we know the number of controls, e.g. #1155 (comment)

Related #786

@mpharrigan
Copy link
Collaborator

What is missing?

@anurudhp
Copy link
Contributor Author

Requires some fixes to how shapes and num_qubits are computed to work with symbolics, and updated type hints. Didn't want to over-complicate #1155, so this can be done in a follow-up.

@fpapa250
Copy link
Contributor

@anurudhp @mpharrigan I am finding that MultiControlX(symbolic n).controlled() is causing issues. This issue was linked in the build_call_graph function for MultiControlX with symbolic cvs - what's required to fix this?

Code to reproduce:

n = sympy.symbols('n', integer=True)
bloq = MultiControlX(cvs=HasLength(n)).controlled(ctrl_spec=CtrlSpec(cvs=0))
cost = get_cost_value(bloq, QECGatesCost()).total_t_and_ccz_count()

@anurudhp
Copy link
Contributor Author

@fpapa250 this will be fixed by #1492 (which removes the call graph override and uses the default from ControlledViaAnd). I tested the code snippet against that branch and it prints {'n_t': 0, 'n_ccz': n}

@fpapa250
Copy link
Contributor

Awesome! That will unblock #1489. Equals.controlled breaks down to that case and is causing issues with the symbolic cost unit test.

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

Successfully merging a pull request may close this issue.

3 participants