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

Allow flattening of subcircuits #4997

Merged
merged 9 commits into from
Feb 23, 2022
Merged

Conversation

daxfohl
Copy link
Contributor

@daxfohl daxfohl commented Feb 15, 2022

Add a CircuitOperation.use_repetition_ids option that when False, flattens the keys of measurements in the subcircuit, making them repeated keys instead of distinct per repetition.

Step 5 of #4274 (comment). (@95-martin-orion @maffoo does this close the issue? It looks like everything else is complete. If so, I'll add the flag here)

@daxfohl daxfohl requested review from a team, vtomole and cduck as code owners February 15, 2022 22:51
@daxfohl daxfohl requested a review from viathor February 15, 2022 22:51
@CirqBot CirqBot added the size: S 10< lines changed <50 label Feb 15, 2022
@maffoo
Copy link
Contributor

maffoo commented Feb 15, 2022

I find the name "flatten_repetitions" somewhat confusing. Could we name this something different, perhaps "use_repetition_ids" with default True?

Also, we could in the future change the default behavior so that specifying repetition_ids=None would omit repetition ids instead of internally generating default repetitions ids "0", "1", ..., at which point a flag like this would no longer be needed.

@daxfohl
Copy link
Contributor Author

daxfohl commented Feb 23, 2022

@95-martin-orion checking whether you saw this one

Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good apart from some naming issues, and doesn't look like it conflicts with #5014 which is convenient.

@95-martin-orion
Copy link
Collaborator

@95-martin-orion checking whether you saw this one

Apologies for the delay, wanted to first make sure the fix for #5000 wouldn't break this (which it looks like it doesn't)

@95-martin-orion 95-martin-orion merged commit bded331 into quantumlib:master Feb 23, 2022
@daxfohl daxfohl deleted the repeated3 branch February 23, 2022 20:20
95-martin-orion pushed a commit to 95-martin-orion/Cirq that referenced this pull request Mar 2, 2022
* Allow flattening of subcircuits

* format

* Add serialization logic and tests

* Change flatten_repetitions (default False) to use_repetition_ids (default True)

* Add shape tests for simulation results from flattened subcircuits

* docs

* address PR comments

* Add json test for use_repetition_ids
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
* Allow flattening of subcircuits

* format

* Add serialization logic and tests

* Change flatten_repetitions (default False) to use_repetition_ids (default True)

* Add shape tests for simulation results from flattened subcircuits

* docs

* address PR comments

* Add json test for use_repetition_ids
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
* Allow flattening of subcircuits

* format

* Add serialization logic and tests

* Change flatten_repetitions (default False) to use_repetition_ids (default True)

* Add shape tests for simulation results from flattened subcircuits

* docs

* address PR comments

* Add json test for use_repetition_ids
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants