-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add a bb.add_flat(bloq, flat_list_of_soqs)
and use it to provide a sensible default for bloq.get_ctrl_system
infrastructure
#931
Comments
+1 On top of this, I think we should add |
I'm thinking of being in a world where users can simply override
I think that's a temporary interface which should be deprecated. |
Ah yeah, if we add a separate |
Is this really necessary? It feels like yet another layer between the user and the bloq/circuit. IMHO cirq has too many protocols between a list of gates and an simulator and this feels similar. Maybe you can expand on why this default is necessary to begin with? |
I'm wary of adding flat and position-dependent args to bloqs. One of the selling points is that using (the equivalent of) keyword args everywhere removes an entire class of errors. This comes at the expense of slightly more complicated logic "on the back-end" for places where wiring things up needs to be automated. Defining controlled versions of bloqs is a place where this distinction gets a bit muddled. I did think about it for some time, and the But I think this all needs to be carefully thought out. I'd like to see the custom controlled versions of gates implemented using the current system so that any refactoring can be accompanied by clear examples of how/whether it actually cleans up the code. |
Having a method on
BloqBuilder
that can accept a flat list of soquets and do the necessary reshapes would allow us to provide a default implementation forBloq.get_ctrl_system
s.t. in most cases (where the assumption that all ctrl registers occur before all original registers) users can simply overrideBloq.controlled()
method instead of overridingBloq.get_ctrl_system
. The former is much more nature for users.This would also allow us to avoid the complexity of having specialized base classes for defining singly controlled bloqs like the one added in #927
The text was updated successfully, but these errors were encountered: