Skip to content

Conversation

@eliottrosenberg
Copy link
Contributor

@eliottrosenberg eliottrosenberg commented Nov 5, 2025

Code to run the experiments for Figures 1 and 3 of arXiv:2410.06557.

@NoureldinYosri
Copy link

@shashwatk1998 can you add docstrings to public methods and then we can merge this?

@shashwatk1998
Copy link

Trying to push now with added missing public method docstrings, facing permission issue

@NoureldinYosri
Copy link

@shashwatk1998 what permission issues?

@eliottrosenberg
Copy link
Contributor Author

@shashwatk1998 just added you as a collaborator to my fork

@NoureldinYosri
Copy link

NoureldinYosri commented Nov 8, 2025

thanks @shashwatk1998 I see you managed to push the docstring

@@ -0,0 +1,312 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add proper copyright notice to all files.

mu: float,
two_qubit_gate="cz",
) -> cirq.Circuit:
"""Constructs the Trotter circuit for 1D DFL simulation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What's a DFL? Avoid abbreviations or at least define them once per file.

https://google.github.io/styleguide/pyguide.html#316-naming

dt: The time step size for the Trotterization.
h: The gauge field strength coefficient.
mu: The matter field strength coefficient.
two_qubit_gate: The type of two-qubit gate to use in the layers.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably be an enum not a string if there are only two choices. (or maybe a bool?)

def _layer_floquet_cphase_first(
grid: Sequence[cirq.GridQubit], dt: float, h: float, mu: float
) -> cirq.Circuit:
n = len(grid)
Copy link
Collaborator

Choose a reason for hiding this comment

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

it looks like n is only used here once. Probably cleaner to just have for i in range(len(grid)) below. Same elsewhere.

Args:
grid: The 1D sequence of qubits used in the experiment.
initial_state: The initial state preparation. Valid values are
"single_sector" or "superposition".
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here that initial_state and basis should not be stringy if they represent a choice between two values.

```

Args:
repetitions_post_selection: How many repetitions to use for the gauge invariant initial state at each cycle number.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should explain why it can be a list[int] or int. Same elsewhere.


Note: These default values are used for the 1D experiment. For the 2D experiment, we use
```
repetitions_post_selection = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do these gigantic lists need to be repeated everywhere?

@@ -0,0 +1,183 @@
import os
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copyright

import cirq
import numpy as np

from . import dfl_experiment as dfl
Copy link
Collaborator

Choose a reason for hiding this comment

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

No relative imports.


from . import dfl_experiment as dfl

if not os.path.isdir("test_circuits"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please put this in a file. If anyone imports this file, it will create this directory in their working directory, which is not good behavior.

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.

4 participants