This is an automated email from the ASF dual-hosted git repository.
rawkintrevo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/mahout.git
The following commit(s) were added to refs/heads/main by this push:
new 09b2f8e44 fix qiskit measurement duplication (#633)
09b2f8e44 is described below
commit 09b2f8e446cd5a4651a0b31ec0f0dfef7597b710
Author: Shivam Mittal <[email protected]>
AuthorDate: Fri Nov 21 02:13:38 2025 +0530
fix qiskit measurement duplication (#633)
---
qumat/qiskit_backend.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/qumat/qiskit_backend.py b/qumat/qiskit_backend.py
index 706126604..919523054 100644
--- a/qumat/qiskit_backend.py
+++ b/qumat/qiskit_backend.py
@@ -87,7 +87,12 @@ def apply_pauli_z_gate(circuit, qubit_index):
def execute_circuit(circuit, backend, backend_config):
# Add measurements if they are not already present
- if not circuit.cregs:
+ # Check if circuit already has measurement operations
+ has_measurements = any(
+ isinstance(inst.operation, qiskit.circuit.Measure)
+ for inst in circuit.data
+ )
+ if not has_measurements:
circuit.measure_all()
# Ensure the circuit is parameterized properly