Skip to content

Commit a65b777

Browse files
fix: fix error introduced in multi-observable execution
1 parent 8323371 commit a65b777

File tree

1 file changed

+1
-21
lines changed
  • mpqp/execution/providers

1 file changed

+1
-21
lines changed

mpqp/execution/providers/ibm.py

+1-21
Original file line numberDiff line numberDiff line change
@@ -487,27 +487,7 @@ def run_aer(job: Job):
487487
result = extract_result(result_sim, job, job.device)
488488

489489
elif job.job_type == JobType.OBSERVABLE:
490-
if isinstance(job.device, (IBMDevice, IBMSimulatedDevice)):
491-
492-
results = []
493-
494-
for _ in job.measure.observables:
495-
expectation_value = compute_expectation_value(
496-
qiskit_circuit, job, backend_sim
497-
)
498-
499-
if isinstance(expectation_value, BatchResult):
500-
results.extend(expectation_value.results)
501-
elif isinstance(expectation_value, Result):
502-
results.append(expectation_value)
503-
else:
504-
raise TypeError(
505-
f"compute_expectation_value() returned {type(expectation_value)}, expected Result or BatchResult."
506-
)
507-
508-
# results.append(expectation_value)
509-
510-
result = BatchResult(results) if len(results) > 1 else results[0]
490+
result = compute_expectation_value(qiskit_circuit, job, backend_sim)
511491

512492
else:
513493
raise ValueError(f"Job type {job.job_type} not handled.")

0 commit comments

Comments
 (0)