Skip to content

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

Merged
tanujkhattar merged 3 commits into
quantumlib:masterfrom
tanujkhattar:update_state_prep_tests
Jul 17, 2023
Merged

tanujkhattar merged 3 commits into
quantumlib:masterfrom
tanujkhattar:update_state_prep_tests

Conversation

@tanujkhattar

@tanujkhattar tanujkhattar commented Jul 17, 2023

Copy link
Copy Markdown
Collaborator

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
@tanujkhattar
tanujkhattar requested a review from mpharrigan July 17, 2023 22:26

@mpharrigan mpharrigan left a comment

Copy link
Copy Markdown
Collaborator

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
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

Development

Successfully merging this pull request may close these issues.

test_state_preparation_via_coherent_alias_sampling in state_preparation_test.py is sensitive to decomposition changes

4 participants