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

Simplify StatePreparationAliasSampling tests by relying on Cirq simulators to simulate operations allocating ancillas #6204

Merged
merged 3 commits into from Jul 17, 2023

Conversation

tanujkhattar
Copy link
Collaborator

@tanujkhattar tanujkhattar commented Jul 17, 2023

Fixes #6197

The two changes are

  1. Use cirq.Simulator to simulate operations that can allocate new ancilla qubits
  2. Update unary iteration implementation to proactively allocate all required ancillas so that a GreedyQubitManager is not required for an optimal ancilla allocation; and a SimpleQubitManager also works fine. This is useful because cirq.Simulator by default uses SimpleQubitManager to decompose operations and the trivial strategy results in all Unary Iteration based gates to allocate a LOT more ancillas than needed.

As part of looking into this issue, I also identified a general improvement that we can make to Cirq simulators s.t. for simulating operations that can allocate ancilla qubits, the simulation is optimized by potentially using SimulationProductState instead of StateVectorSimulationState to simulate the decomposed operations (right now, the former is used only at the top-level circuit simulation). But we can track this in a separate issue.

…ators capability to simulate operations allocating ancilla qubits
@tanujkhattar tanujkhattar requested a review from a team as a code owner July 17, 2023 21:57
@CirqBot CirqBot added the size: M 50< lines changed <250 label Jul 17, 2023
@tanujkhattar tanujkhattar added the area/cirq-ft Issues related to the Cirq-FT sub-package label Jul 17, 2023
Copy link
Collaborator

@mpharrigan mpharrigan left a comment

Choose a reason for hiding this comment

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

lgtm

@tanujkhattar tanujkhattar enabled auto-merge (squash) July 17, 2023 22:48
@tanujkhattar tanujkhattar merged commit 344d020 into quantumlib:master Jul 17, 2023
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cirq-ft Issues related to the Cirq-FT sub-package size: M 50< lines changed <250
Projects
None yet
4 participants