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

Fix unexpected behavior of symmetry_conserving_bravyi_kitaev #734

Merged
merged 6 commits into from
Nov 7, 2021

Conversation

r-imai-quantum
Copy link
Contributor

This pull request fixes the unexpected behavior of symmetry_conserving_bravyi_kitaev.

It is the following:

>>> symmetry_conserving_bravyi_kitaev(FermionOperator("3^ 3"), 8, 4)
0.5 [] +
-0.5 [Z0 Z1]

This is caused by prune_unused_indices, which deletes all unused indices.

The expected result is

0.5 [] +
-0.5 [Z3 Z4]

@google-cla google-cla bot added the cla: yes label Jul 12, 2021
@r-imai-quantum
Copy link
Contributor Author

Could someone please review it?

@r-imai-quantum
Copy link
Contributor Author

Most of the SCBK features seem to be written by @sammcardle30 and @babbush.
Would it be possible for you to review changes in this pull request?

@@ -131,3 +133,23 @@ def edit_hamiltonian_for_spin(qubit_hamiltonian, spin_orbital, orbital_parity):
qubit_hamiltonian.compress()

return qubit_hamiltonian


def remove_indices(symbolic_operator, indices):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a small nit could you add a more detailed description of what this function is doing and type annotations? A minimal requirement is a description of input parameters and types. even for a small function like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry to keep you waiting.
I have updated the docstring, so please check it again.

Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM other than some small linting issues. I'll merge right after those are resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for reviewing. Linting errors has been fixed.

@ncrubin ncrubin self-requested a review October 26, 2021 18:58
@ncrubin ncrubin merged commit f4c17a6 into quantumlib:master Nov 7, 2021
@r-imai-quantum
Copy link
Contributor Author

Thank you!

@mpharrigan mpharrigan mentioned this pull request Dec 6, 2021
ncrubin added a commit to ncrubin/OpenFermion that referenced this pull request Jul 25, 2022
…lib#734)

* Fix unexpected behavior of symmetry_conserving_bravyi_kitaev

* Update docstring

* fix lint errors

Co-authored-by: Nicholas Rubin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants