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

Move all Pauli measurements to the front before Pauli presimulation #209

Merged

Conversation

thierry-martinez
Copy link
Contributor

@thierry-martinez thierry-martinez commented Sep 3, 2024

This commit adds a method __extract_pauli_nodes that applies exchange rules to move all Pauli measurements to the front of a pattern. This allows all the Pauli measurements to be presimulated, even if their initial domains depend on other measurements.

On random circuits of 10 qubits (depth 10), number of remaining nodes after Pauli presimulation is reduced by a factor of 4 on average, and the time spent on state vector simulation is reduced by a factor 75 (including the time for Pauli presimulation).

This commit adds a method "__extract_pauli_nodes" that applies
exchange rules to move all Pauli measurements to the front of a
pattern.  This allows all the Pauli measurements to be presimulated,
even if their initial domains depend on other measurements.

On random circuits of 10 qubits (depth 10), number of remaining nodes
after Pauli presimulation is reduced by a factor of 4 in average, and
the time spent on state vector simulation is reduced by a factor
75 (including the time for Pauli presimulation).
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
tests/test_pattern.py Outdated Show resolved Hide resolved
tests/test_pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
graphix/pattern.py Outdated Show resolved Hide resolved
Suggested by EarlMilktea: TeamGraphix#209 (comment)
else:
new_seq.append(cmd)
if not pauli_nodes_inserted:
new_seq.extend(pauli_nodes.values())
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this possible? I guess you need a standardization (I know we do it in measure_pauli but we should be explicit rather than implicit.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, this might move the comand across possible dependency. please add a line of two of notes about consequences of this skipping or if this doesn't affect at all, then why so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed to a clearer structure in 7483827, providing proofs of the signal shifting: the function extract_pauli_nodes has been renamed to move_pauli_measurements_to_the_front and is now responsible for both shifting and moving the Pauli measurements in the sequence.

Copy link
Contributor

@shinich1 shinich1 left a comment

Choose a reason for hiding this comment

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

Looks great. thank you!

@thierry-martinez thierry-martinez merged commit b58111a into TeamGraphix:master Sep 15, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants