Skip to content

Conversation

NoureldinYosri
Copy link
Collaborator

@NoureldinYosri NoureldinYosri commented Sep 11, 2025

Adding a gauge compiler that surrounds empty sequences by randomly chosen gates ... this gauge is technically half way between a gauge and dynmical decoupling

@github-actions github-actions bot added the size: L 250< lines changed <1000 label Sep 11, 2025
Copy link
Collaborator

@zlatko-minev zlatko-minev left a comment

Choose a reason for hiding this comment

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

Awesome! Some small docstring changes

@zlatko-minev
Copy link
Collaborator

Awesome this looks really nice and useful

@NoureldinYosri
Copy link
Collaborator Author

Awesome this looks really nice and useful

great I will add tests and send for review

@zlatko-minev
Copy link
Collaborator

Great, looking forward to having it in the codebase

@NoureldinYosri NoureldinYosri marked this pull request as ready for review September 15, 2025 22:39
@NoureldinYosri NoureldinYosri requested review from vtomole and a team as code owners September 15, 2025 22:39
Copy link

codecov bot commented Sep 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.37%. Comparing base (1fa73c7) to head (f3dbbbd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #7648    +/-   ##
========================================
  Coverage   99.37%   99.37%            
========================================
  Files        1078     1080     +2     
  Lines       96212    96378   +166     
========================================
+ Hits        95609    95775   +166     
  Misses        603      603            

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@zlatko-minev zlatko-minev left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

I think we can remove the gauges_inverse and compute it from the gauges list instead. Otherwise LGTM after addressing inline comments.



def _repr_fn(gauges: tuple[cirq.Gate, ...]) -> str:
if gauges is _PAULIS:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit - here and below in case named gate tuples are created from a sequence.

Suggested change
if gauges is _PAULIS:
if gauges == _PAULIS:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I prefer to do both

Copy link
Collaborator

@pavoljuhas pavoljuhas Sep 17, 2025

Choose a reason for hiding this comment

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

That makes a little difference for small tuples, but why not. :-)
There was a typo in variable name - fixed in 365e6c6
(in cached_property it is not worth to check identity)

tr = gc.IdleMomentsGauge(2, gauges='pauli')

circuit = cirq.Circuit.from_moments([], [], [], cirq.X(cirq.q(0)), [], [], cirq.X(cirq.q(0)))
transformed_circuit = tr(circuit, rng_or_seed=0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here we rely on np.random.default_rng(0).choice(4) returning always the same value at

gate_index = rng.choice(len(self.gauges))

This can break if numpy generator changes in the future.

We could make this more secure by adding a local mock for rng.choice() which would return preset values to get reproducible results. Your pick if it is worthwhile to do now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if a change in the generated cases breaks the test then the code is buggy ... the only reason I'm adding a seed is so that if it breaks we would know exactly which case it is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

actually you are right, I changed to using a mock

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

LGTM after pushing in eb2e865 to avoid overlap with the builtin gc module.

Thanks for adding this!

@NoureldinYosri NoureldinYosri added this pull request to the merge queue Sep 17, 2025
Merged via the queue into quantumlib:main with commit 7673240 Sep 17, 2025
35 checks passed
@NoureldinYosri NoureldinYosri deleted the gauge_empty branch September 17, 2025 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants