Skip to content

Conversation

@sankshi
Copy link
Contributor

@sankshi sankshi commented Nov 19, 2025

Purpose of PR

This PR fixes a measurement-handling bug in execute_circuit() where the backend incorrectly checks circuit.cregs to determine whether measurements already exist. This caused duplicate measurement operations to be added when execute_circuit() was called multiple times on the same circuit, producing invalid results.
The fix ensures that the code checks for actual measurement operations in the circuit data before adding new measurements.

Related Issues or PRs

#632 – [Bug] get_final_state_vector fails with measurements

Changes Made

  • [ x] Bug fix
  • New feature
  • Refactoring
  • Documentation
  • Test
  • CI/CD pipeline
  • Other

Breaking Changes

  • Yes
  • [ x] No

Checklist

  • Added or updated unit tests for all changes
  • [x ] Added or updated documentation for all changes
  • Successfully built and ran all unit tests or manual tests locally
  • PR title follows "MAHOUT-XXX: Brief Description" format (if related to an issue)
  • [ x] Code follows ASF guidelines

@shiavm006
Copy link
Contributor

@sankshi it is duplicate of #633

@shiavm006
Copy link
Contributor

@sankshi , I noticed a few issues that should be addressed

  • Community page update (unrelated to the bug fix)
  • Bug fix for duplicate measurements
    Two diffrent unrelated commits these should be in separate PRs to follow the single responsibility and make review easier.

@sankshi sankshi closed this Nov 20, 2025
@sankshi sankshi deleted the fix-duplicate-measurements branch November 20, 2025 08:18
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