Skip to content

Fix unexpected behavior of symmetry_conserving_bravyi_kitaev#734

Merged
ncrubin merged 6 commits intoquantumlib:masterfrom
r-imai-67:fix-SCBK
Nov 7, 2021
Merged

Fix unexpected behavior of symmetry_conserving_bravyi_kitaev#734
ncrubin merged 6 commits intoquantumlib:masterfrom
r-imai-67:fix-SCBK

Conversation

@r-imai-67
Copy link
Copy Markdown
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-67
Copy link
Copy Markdown
Contributor Author

Could someone please review it?

@r-imai-67
Copy link
Copy Markdown
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?

return qubit_hamiltonian


def remove_indices(symbolic_operator, indices):
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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-67
Copy link
Copy Markdown
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 <rubinnc0@gmail.com>
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