Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #748 from chunfuchen/align_qubit_for_meas_err_miti
Browse files Browse the repository at this point in the history
fix error when only using a subset of qubits in error mitigation
  • Loading branch information
manoelmarques authored Dec 12, 2019
2 parents 6147c54 + b88e95f commit 107bfce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Fixed
- fix bug in list concatenation in VQC algorithm (#733)
- A bug where `UCCSD` might generate an empty operator and try to evolve it. (#680)
- Decompose causes DAG failure using feature maps. (#719)
- Fixes error when only using a subset of qubits in error mitigation. (#748)

Removed
-------
Expand Down
12 changes: 9 additions & 3 deletions qiskit/aqua/utils/measurement_error_mitigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

""" Measurement error mitigation """

import copy
import logging

from qiskit import compiler
Expand Down Expand Up @@ -91,7 +92,7 @@ def build_measurement_error_mitigation_qobj(qubit_list, fitter_cls, backend,
run_config=None):
"""
Args:
qubit_list (list[int]): list of qubits used in the algorithm
qubit_list (list[int]): list of ordered qubits used in the algorithm
fitter_cls (callable): CompleteMeasFitter or TensoredMeasFitter
backend (BaseBackend): backend instance
backend_config (dict, optional): configuration for backend
Expand All @@ -114,14 +115,19 @@ def build_measurement_error_mitigation_qobj(qubit_list, fitter_cls, backend,

if fitter_cls == CompleteMeasFitter:
meas_calibs_circuits, state_labels = \
complete_meas_cal(qubit_list=qubit_list, circlabel=circlabel)
complete_meas_cal(qubit_list=range(len(qubit_list)), circlabel=circlabel)
elif fitter_cls == TensoredMeasFitter:
# TODO support different calibration
raise AquaError("Does not support TensoredMeasFitter yet.")
else:
raise AquaError("Unknown fitter {}".format(fitter_cls))

# the provided `qubit_list` would be used as the initial layout to
# assure the consistent qubit mapping used in the main circuits.

tmp_compile_config = copy.deepcopy(compile_config)
tmp_compile_config['initial_layout'] = qubit_list
t_meas_calibs_circuits = compiler.transpile(meas_calibs_circuits, backend,
**backend_config, **compile_config)
**backend_config, **tmp_compile_config)
cals_qobj = compiler.assemble(t_meas_calibs_circuits, backend, **run_config.to_dict())
return cals_qobj, state_labels, circlabel

0 comments on commit 107bfce

Please sign in to comment.