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

definition of _add_ctrled is too restrictive #1272

Closed
NoureldinYosri opened this issue Aug 9, 2024 · 3 comments
Closed

definition of _add_ctrled is too restrictive #1272

NoureldinYosri opened this issue Aug 9, 2024 · 3 comments
Milestone

Comments

@NoureldinYosri
Copy link
Contributor

NoureldinYosri commented Aug 9, 2024

The second return return value of get_ctrl_system is _add_ctrled which is defined as

https://github.com/quantumlib/Qualtran/blob/a4365b26a01956bb0341f12e673176e3a66ab33b/qualtran/_infra/bloq.py#L384C33-L389

This definition is too restrictive since it assumes that no new registers may be created which is not true. for example And().controlled() should be MultiAnd which creates an extra junk register.

@mpharrigan
Copy link
Collaborator

I think this is out of scope for the notion of a "controlled" operation.

Controlled(A) = $\ket{0}\bra{0}\otimes I + \ket{1}\bra{1} \otimes A$

@mpharrigan
Copy link
Collaborator

@NoureldinYosri can you provide more context on your use case

@mpharrigan
Copy link
Collaborator

I wrote some more here: #1304 (comment)

The contract (irrespective of whether the registers are RIGHT or THRU) is that the controlled version can only add new registers that comport with CtrlSpec.qdtypes. The system has no idea what to do with the extra junk registers. If you wanted to encode the idea that "this junk needs to get cleaned up by And^dag" you'd use something like #1221

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

No branches or pull requests

2 participants