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

Representation + Wires refactor #498

Merged
merged 103 commits into from
Oct 29, 2024
Merged

Representation + Wires refactor #498

merged 103 commits into from
Oct 29, 2024

Conversation

apchytr
Copy link
Collaborator

@apchytr apchytr commented Oct 8, 2024

Context: One bottleneck currently in Mr Mustard is that Representation and Wires are treated separately when they are in fact very closely related. Here is presented an alternative implementation based on the Merging Representation and Ansatz PR. In this, we now have a single Representation class that contains the ansatz, the wires and a dictionary mapping wires to their respective representation.

To consider: Remove ArrayAnsatz and only use PolyExp?

Description of the Change:

  • Introduced the new Representation class.
  • Introduced RepEnum class.
  • What is currently on develop as Ansatz and Representation is replaced with just Ansatz.
  • All CircuitComponents are initialized with a Representation and a name. Exposed classes are still initialized with modes where they make use of the new from_modes class method.
  • Renamed bargmann.py and fock.py to bargmann_utils.py and fock_utils.py
  • Renamed fock to fock_array

Benefits: We now have an object responsible for managing multi representations and keeping track of what wire each representation is. Fewer classes to maintain (6 -> 4). Clearer separation of responsibilities. Much cleaner codebase.

Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

What a truckload of good work!
thanks Anthony 🥇

Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

amazing work 🚀

Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

re-approved

@apchytr apchytr requested a review from ziofil October 29, 2024 18:06
Copy link
Collaborator

@ziofil ziofil left a comment

Choose a reason for hiding this comment

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

I like this PR so much I'm happy to keep re-approving it ^^

@apchytr apchytr merged commit e5c02ce into develop Oct 29, 2024
8 checks passed
@apchytr apchytr deleted the repWires2 branch October 29, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request no changelog Pull request does not require a CHANGELOG entry Review effort [1-5]: 4 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants