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

refactor: align the keep_only_odd logic between backends #55

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

mrossinek
Copy link
Member

@mrossinek mrossinek commented Jan 29, 2025

This PR aligns the internal handling of the keep_only_odd logic to be identical between the tenpy- and quimb-based backend. This guarantees that the LayerModel implementations for each backend report the same bond interaction Hamiltonians, ensuring a consistent user experience.

In doing so, the keep_only_odd attribute of quimb's LayerModel class has been removed, as it is now entirely processed during the LayerModel.from_quantum_circuit construction.

Furthermore, the scaling_factor arguments of the LayerModel.from_quantum_circuit constructors actually became redundant due to this change, which is why they are also being removed.

Rather than having the `.terms` of the `LayerModel` report confusing
values, this refactors the internal workings of this method to be
in-line with the tenpy-based implementation.

This also removes an unnecessary factor of 2.0 in the Rz gate
conversion. In doing so, this commit ensures that the reported
Hamiltonian interactions terms are compatible between the quimb- and
tenpy-based implementations.
@coveralls
Copy link

coveralls commented Jan 29, 2025

Pull Request Test Coverage Report for Build 13054286509

Details

  • 15 of 15 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 12929856364: 0.0%
Covered Lines: 579
Relevant Lines: 579

💛 - Coveralls

@mrossinek mrossinek marked this pull request as draft January 29, 2025 13:21
@mrossinek mrossinek changed the title refactor: quimb_layers.LayerModel.keep_only_odd logic refactor: align the keep_only_odd logic between backends Jan 30, 2025
@mrossinek mrossinek marked this pull request as ready for review January 30, 2025 14:56
@mrossinek mrossinek merged commit 8918dd1 into main Jan 30, 2025
15 checks passed
@mrossinek mrossinek deleted the quimb-refactor-keep_only_odd branch January 30, 2025 14:57
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.

2 participants