Skip to content

QubitOperator upgrades - #857

Draft
renezander90 wants to merge 2 commits into
mainfrom
ops_upgrades_1
Draft

QubitOperator upgrades#857
renezander90 wants to merge 2 commits into
mainfrom
ops_upgrades_1

Conversation

@renezander90

@renezander90 renezander90 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Description

This PR improves the performance of Hamiltonian term grouping and qubit-wise commutativity checks. It replaces NetworkX graph construction with NumPy adjacency matrices, and reduces the work performed by QubitTerm.commute_qw() for sparse terms.

Related Issues

Closes #
Related to #

Type of Change

  • Feature (new functionality)
  • Change Request (modification of existing functionality)
  • Bug Fix
  • Refactoring (no behavior change)
  • Performance improvement
  • Documentation
  • CI / Build

Breaking Change?

  • Yes
  • No

If yes, describe the impact and migration path:

What was changed?

  • Replaced NetworkX-based graph construction in group_up_iterable() with a NumPy adjacency matrix.
  • Added type annotations and documentation for the Hamiltonian grouping utilities.
  • Preserved the existing coloring behavior while avoiding NetworkX conversion and graph-management overhead.
  • Optimized QubitTerm.commute_qw() by iterating over the smaller factor dictionary.
  • Kept the existing grouping and commutativity APIs unchanged.

Checklist

  • My code follows the project's coding standards
  • I have performed a self-review
  • I have added/updated tests (referencing issue Test-IDs)
  • All tests pass locally and in CI
  • I have updated the documentation
  • I have added a changelog entry to changelog-dev.rst
  • Breaking changes are documented with migration path

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.

1 participant