-
Notifications
You must be signed in to change notification settings - Fork 1
Support cirq classical control when lowering a circuit to squin #315
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
base: main
Are you sure you want to change the base?
Conversation
# NOTE: there is currently no convenient ilist.any method, so we need to use foldl | ||
# with a simple function that just does an or | ||
|
||
def bool_op_or(x: bool, y: bool) -> bool: | ||
return x or y | ||
|
||
f_code = state.current_frame.push( | ||
lowering.Python(self.dialects).python_function(bool_op_or) | ||
) | ||
fn = ir.Method( | ||
mod=None, | ||
py_func=bool_op_or, | ||
sym_name="bool_op_or", | ||
arg_names=[], | ||
dialects=self.dialects, | ||
code=f_code, | ||
) | ||
f_const = state.current_frame.push(py.constant.Constant(fn)) | ||
init_val = state.current_frame.push(py.Constant(False)).result | ||
condition = state.current_frame.push( | ||
ilist.Foldl(f_const.result, measurement_outcome, init=init_val) | ||
).result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Roger-luo Please take a look at this part here specifically. I'm not sure if I'm adding the function here correctly.
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
Codecov ReportAttention: Patch coverage is
📢 Thoughts on this report? Let us know! |
Still need to support classical control with measurements on multiple qubits resulting in an ilist.