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

feat: Add dot(), power(), and to_circuit() to PauliString #574

Merged
merged 8 commits into from
Jul 18, 2023

Conversation

kvathupo
Copy link
Contributor

What?

  • Implements half of Pauli and Clifford groups #553
  • I was confused why the phase is only allowed to be positive or negative one, so I just assumed the convention of dropping the global phase whilst maintaining sign (e.g. -iX being treated as -X)

Further Development

  • Doesn't include a test case for to_circuit()

@kvathupo kvathupo requested a review from a team as a code owner June 13, 2023 03:45
@kvathupo
Copy link
Contributor Author

Pinging for feedback (perhaps @speller26 ?). PR should be independent of the clifford tableau feature.

Copy link
Member

@speller26 speller26 left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution; this is a great improvement to existing functionality! Would you also mind implementing __imul__ and __ipow__?

src/braket/quantum_information/pauli_string.py Outdated Show resolved Hide resolved
src/braket/quantum_information/pauli_string.py Outdated Show resolved Hide resolved
src/braket/quantum_information/pauli_string.py Outdated Show resolved Hide resolved
@kvathupo
Copy link
Contributor Author

kvathupo commented Jul 8, 2023

Changes applied 👍

@codecov
Copy link

codecov bot commented Jul 11, 2023

Codecov Report

Merging #574 (48332a1) into main (b6bc169) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #574   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          121       121           
  Lines         7828      7885   +57     
  Branches      1739      1754   +15     
=========================================
+ Hits          7828      7885   +57     
Impacted Files Coverage Δ
src/braket/quantum_information/pauli_string.py 100.00% <100.00%> (ø)

Copy link
Member

@speller26 speller26 left a comment

Choose a reason for hiding this comment

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

Looking good! Just needs some tests to bring the changes to full coverage

pauli_other._nontrivial = {}
else:
for _ in range(n - 1):
pauli_other.dot(self, inplace=True)
Copy link
Member

Choose a reason for hiding this comment

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

Try to take advantage of the fact that the Pauli matrices are involutory; $\sigma_i^k = \sigma_i^{k \, mod \, 2}$.

@kvathupo kvathupo requested a review from a team as a code owner July 17, 2023 00:35
@kvathupo
Copy link
Contributor Author

Coverage should be clear now 🤞 Apologies, work has been a little hectic hah

@speller26 speller26 changed the title Add dot(), power(), and to_circuit() to PauliString feat: Add dot(), power(), and to_circuit() to PauliString Jul 18, 2023
Copy link
Member

@speller26 speller26 left a comment

Choose a reason for hiding this comment

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

Great job! This greatly expands the functionality of PauliString

@speller26 speller26 merged commit d4178f0 into amazon-braket:main Jul 18, 2023
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