Skip to content

feature: add weighted PauliString sums#1282

Open
caijintaoduolacmeng-star wants to merge 2 commits into
amazon-braket:mainfrom
caijintaoduolacmeng-star:codex/pauli-string-sum
Open

feature: add weighted PauliString sums#1282
caijintaoduolacmeng-star wants to merge 2 commits into
amazon-braket:mainfrom
caijintaoduolacmeng-star:codex/pauli-string-sum

Conversation

@caijintaoduolacmeng-star

Copy link
Copy Markdown

Issue #, if available:
Closes #1256

Description of changes:

  • Adds a PauliStringSum container for weighted sums of PauliString objects.
  • Supports addition, subtraction, scalar multiplication, multiplication by PauliString, iteration, lookup, and coefficient normalization.
  • Exports PauliStringSum from braket.quantum_information.

Testing done:

  • ..venv\Scripts\python -m pytest -o addopts='' test\unit_tests\braket\quantum_information\test_pauli_string.py -q
  • ..venv\Scripts\python -m ruff check src\braket\quantum_information\pauli_string.py

Merge Checklist

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@caijintaoduolacmeng-star caijintaoduolacmeng-star requested a review from a team as a code owner June 5, 2026 00:32
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.63248% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.77%. Comparing base (a5ee47d) to head (1a37e7e).

Files with missing lines Patch % Lines
src/braket/quantum_information/pauli_string.py 78.44% 18 Missing and 7 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##              main    #1282      +/-   ##
===========================================
- Coverage   100.00%   99.77%   -0.23%     
===========================================
  Files          169      169              
  Lines        10963    11078     +115     
  Branches      1412     1434      +22     
===========================================
+ Hits         10963    11053      +90     
- Misses           0       18      +18     
- Partials         0        7       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Allow for Sums of PauliStrings

1 participant