From 10b6aaf3ef6bb78e353a7ec0ec002c5f48fe6844 Mon Sep 17 00:00:00 2001 From: Alex McCaskey Date: Sat, 16 Sep 2023 12:17:33 +0000 Subject: [PATCH] minor Signed-off-by: Alex McCaskey --- qswift/compiler.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/qswift/compiler.py b/qswift/compiler.py index ac88672..cbd5567 100644 --- a/qswift/compiler.py +++ b/qswift/compiler.py @@ -129,6 +129,8 @@ def __init__(self, operator_pool: OperatorPool, obs_map, initializer: CircuitIni self._tool = tool def compute(self, code, **kwargs): + # qpu_id = kwargs['qpu_id'] if 'qpu_id' in kwargs else 0 + ancilla_index = self._nqubit - 1 qc = self._initializer.init_circuit(self._nqubit, {ancilla_index}, self._tool) operators = [] @@ -149,10 +151,10 @@ def compute(self, code, **kwargs): if isinstance(operator, MeasurementOperator): tmp = self._observables[operator.j].get_value(qc, self._nshot, **kwargs) if isinstance(tmp, float): - value = coeff * tmp - else: - value = (coeff, tmp) - return value + return coeff * tmp + + return (coeff, tmp) + raise AttributeError("measurement is not set") def add_gate(self, qc: QWrapper, operator: Operator, tau, ancilla_index, targets):