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

enable simulation of controlled gates in classical simulator #6589

Merged

Conversation

GregDMeyer
Copy link
Contributor

Currently, only X, CNOT, TOFFOLI, SWAP, and measurement are supported by cirq.ClassicalStateSimulator. This pull request adds support for versions of the first four gates with an arbitrary number of controls (as generated by the .controlled() function).

@GregDMeyer GregDMeyer requested review from vtomole, cduck and a team as code owners May 8, 2024 02:20
@GregDMeyer GregDMeyer requested a review from dabacon May 8, 2024 02:20
@CirqBot CirqBot added the size: M 50< lines changed <250 label May 8, 2024
@NoureldinYosri NoureldinYosri self-assigned this May 8, 2024
@NoureldinYosri NoureldinYosri self-requested a review May 8, 2024 03:05
Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.81%. Comparing base (f246c2b) to head (083f79c).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6589   +/-   ##
=======================================
  Coverage   97.81%   97.81%           
=======================================
  Files        1063     1063           
  Lines       91761    91796   +35     
=======================================
+ Hits        89755    89793   +38     
+ Misses       2006     2003    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

thanks for noticing this and offering to help, I left a couple of comments

cirq-core/cirq/sim/classical_simulator.py Outdated Show resolved Hide resolved
cirq-core/cirq/sim/classical_simulator.py Outdated Show resolved Hide resolved
cirq-core/cirq/sim/classical_simulator.py Show resolved Hide resolved
cirq-core/cirq/sim/classical_simulator_test.py Outdated Show resolved Hide resolved
cirq-core/cirq/sim/classical_simulator_test.py Outdated Show resolved Hide resolved
cirq-core/cirq/sim/classical_simulator_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

one more thing + CI

cirq-core/cirq/sim/classical_simulator.py Outdated Show resolved Hide resolved
@GregDMeyer
Copy link
Contributor Author

whoops, I realized why I wasn't seeing the linter errors locally---I was mistaken about what running format-incremental checked for. I thought it was equivalent to pylint but only on changed lines. Anyway all pylint checks seem to pass with my latest commit so I think CI should pass now :-)

Copy link
Collaborator

@NoureldinYosri NoureldinYosri left a comment

Choose a reason for hiding this comment

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

@GregDMeyer thanks for your contribution. great work

@NoureldinYosri NoureldinYosri merged commit ee4d702 into quantumlib:main May 23, 2024
34 checks passed
jselig-rigetti pushed a commit to jselig-rigetti/Cirq that referenced this pull request May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants